Skip to content

Commit abe5607

Browse files
committed
Start of contributing doc.
1 parent 88bbf3d commit abe5607

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

Rakefile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require 'pathname'
44
require 'bundler'
55
require 'time'
66
require 'date'
7+
require 'erb'
78

89
Projects = ['rspec', 'rspec-core', 'rspec-expectations', 'rspec-mocks', 'rspec-rails', 'rspec-support']
910
UnDocumentedProjects = %w[ rspec rspec-support ]
@@ -287,23 +288,25 @@ end
287288
namespace :common_markdown_files do
288289
def update_common_markdown_files_in_repos
289290
update_files_in_repos('common markdown files', ' [ci skip]') do |name|
290-
common_markdown_files_with_comments.each do |file|
291+
common_markdown_files_with_comments(name).each do |file|
291292
full_file_name = ReposPath.join(name, file.file_name)
292293
full_file_name.write(file.contents)
293294
full_file_name.chmod(file.mode) # ensure executables are set
294295
end
295296
end
296297
end
297298

298-
def common_markdown_files_with_comments
299+
def common_markdown_files_with_comments(project_name)
299300
markdown_root = BaseRspecPath.join('common_markdown_files')
300301
file_names = Pathname.glob(markdown_root.join('**', '{*,.*}')).select do |f|
301302
f.file?
302303
end
303304

304305
file_names.map do |file|
305306
comments_added = false
306-
lines = file.each_line.each_with_object([]) do |line, all|
307+
content = markdown_file_content(file, project_name)
308+
309+
lines = content.each_line.each_with_object([]) do |line, all|
307310
if !comments_added && !line.start_with?('#!')
308311
all.concat([
309312
"<!---\n",
@@ -318,13 +321,26 @@ namespace :common_markdown_files do
318321
end
319322

320323
ReadFile.new(
321-
file.relative_path_from(markdown_root),
324+
file.relative_path_from(markdown_root).sub(/\.erb$/, ''),
322325
lines.join,
323326
file.stat.mode
324327
)
325328
end
326329
end
327330

331+
ERBRenderer = Struct.new(:project_name, :contents) do
332+
def render
333+
# Our `binding` makes `project_name` available to the ERB template.
334+
ERB.new(contents).result(binding)
335+
end
336+
end
337+
338+
def markdown_file_content(file, project_name)
339+
raw_contents = file.read
340+
return raw_contents unless file.extname == ".erb"
341+
ERBRenderer.new(project_name, raw_contents).render
342+
end
343+
328344
desc "Update common markdown files"
329345
task :update_files do
330346
update_common_markdown_files_in_repos
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Contributing
2+
3+
RSpec is a community-driven project that has benefited from improvements from over over *500* contributors.
4+
We welcome contributions from *everyone*. While contributing, please follow the project [code of conduct](../code_of_conduct.md), so that everyone can be included.
5+
6+
If you'd like to help make RSpec better, here are some ways you can contribute:
7+
8+
- by running RSpec HEAD to help us catch bugs before new releases
9+
- by [reporting bugs you encounter](https://github.com/rspec/<%= project_name %>/issues/new)
10+
- by [suggesting new features](https://github.com/rspec/<%= project_name %>/issues/new)
11+
- by improving RSpec's [Relish](https://relishapp.com/rspec) or [API](http://rspec.info/documentation/) documentation
12+
- by improving [RSpec's website](http://rspec.info/) ([source](https://github.com/rspec/rspec.github.io))
13+
- by taking part in [feature and issue discussions](https://github.com/rspec/<%= project_name %>/issues)
14+
- by adding a failing test for reproducible [reported bugs](https://github.com/rspec/<%= project_name %>/issues)
15+
- by reviewing [pull requests](https://github.com/rspec/<%= project_name %>/pulls) and suggesting improvements
16+
- by [writing code](../DEVELOPMENT.md) (no patch is too small! fix typos or bad whitespace)
17+
18+
If you need help getting started, check out the [DEVELOPMENT](../DEVELOPMENT.md) file for steps that will get you up and running.
19+
20+
Thanks for helping us make RSpec better!

0 commit comments

Comments
 (0)