Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #5513 - useed:feature/add-coc-to-readme-when-enabled, r…
Browse files Browse the repository at this point in the history
…=segiddins

Add Code of Conduct content to README template

Adds feature discussed in #5512

When the --coc flag is set or otherwise enabled when generating a new
gem, a Code of Conduct is generated. This adds an additional link to
that Code of Conduct in the README, and adds default text for the
Code of Conduct based on language used in other popular ruby open
source libraries (bundler, rails).
  • Loading branch information
bundlerbot committed Mar 14, 2017
2 parents 6b3ec9e + 762c50e commit 3c605d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/bundler/templates/newgem/README.md.tt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/<%= co

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
<% end %>

<% if config[:coc] %>
## Code of Conduct

Everyone interacting in the <%= config[:constant_name] %> project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).
<% end %>
14 changes: 14 additions & 0 deletions spec/commands/newgem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ def gem_skeleton_assertions(gem_name)
gem_skeleton_assertions(gem_name)
expect(bundled_app("test-gem/CODE_OF_CONDUCT.md")).to exist
end

describe "README additions" do
it "generates the README with a section for the Code of Conduct" do
expect(bundled_app("test-gem/README.md").read).to include("## Code of Conduct")
expect(bundled_app("test-gem/README.md").read).to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
end
end
end

shared_examples_for "--no-coc flag" do
Expand All @@ -113,6 +120,13 @@ def gem_skeleton_assertions(gem_name)
gem_skeleton_assertions(gem_name)
expect(bundled_app("test-gem/CODE_OF_CONDUCT.md")).to_not exist
end

describe "README additions" do
it "generates the README without a section for the Code of Conduct" do
expect(bundled_app("test-gem/README.md").read).not_to include("## Code of Conduct")
expect(bundled_app("test-gem/README.md").read).not_to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
end
end
end

context "README.md" do
Expand Down

0 comments on commit 3c605d0

Please sign in to comment.