-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand bundle gem to allow users to choose between Code of Conducts.
#9256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
colby-swandale
wants to merge
14
commits into
master
Choose a base branch
from
colby/newgem-coc-option
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+434
−57
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5a8dba0
Update gem command to allow users to choose between the Ruby & contri…
colby-swandale 70ed1b4
fix some message bugs & validation
colby-swandale 794cfc0
Honour previous decisions to say no to CoCs when generating a gem
colby-swandale ede10c0
Add none option to CoC argument
colby-swandale eb122e8
Handle when 'none' option is provided
colby-swandale 5a908b9
Set CoC template to "none" when invalid option is provided
colby-swandale d2c1ae6
Refactor CoC option handling to improve clarity and user feedback
colby-swandale 9c5d7d7
Update bundler/lib/bundler/man/bundle-gem.1.ronn
colby-swandale 8cab234
update manifest
colby-swandale 71a19d3
update bundler man pages
colby-swandale df0bdc1
Update man pages with expected order
colby-swandale ec2a9d5
Address PR feedback from Claude & Copilot
colby-swandale 4fa703b
Resolve incorrect quote characters in CC CoC & update tests
colby-swandale 08fca46
bin/rake man:build
hsbt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,13 +176,18 @@ def run | |
| templates.merge!("LICENSE.txt.tt" => "LICENSE.txt") | ||
| end | ||
|
|
||
| if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?", | ||
| "Codes of conduct can increase contributions to your project by contributors who " \ | ||
| "prefer safe, respectful, productive, and collaborative spaces. \n" \ | ||
| "See https://github.com/ruby/rubygems/blob/master/CODE_OF_CONDUCT.md") | ||
| coc_template = ask_and_set_coc | ||
| case coc_template | ||
| when "contributor-covenant" | ||
| config[:coc] = true | ||
| Bundler.ui.info "Code of conduct enabled in config" | ||
| templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") | ||
| Bundler.ui.info "Contributor Covenant enabled in config" | ||
| templates.merge!("CONTRIBUTOR_COVENANT_CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") | ||
| when "ruby" | ||
| config[:coc] = true | ||
| Bundler.ui.info "Ruby Community Conduct Guideline enabled in config" | ||
| templates.merge!("RUBY_SRC_CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") | ||
| when "none" | ||
| config[:coc] = false | ||
| end | ||
|
|
||
| if ask_and_set(:changelog, "Do you want to include a changelog?", | ||
|
|
@@ -387,6 +392,59 @@ def ask_and_set_ci | |
| ci_template | ||
| end | ||
|
|
||
| def ask_and_set_coc | ||
| return "none" if skip?(:coc) | ||
| coc_template = options[:coc] || Bundler.settings["gem.coc"] | ||
|
|
||
| # Handle backwards compatibility: if the old boolean `false` value is set, | ||
| # silently migrate to the new `none` value and honor the setting | ||
| if coc_template.to_s == "false" | ||
| Bundler.settings.set_global("gem.coc", "none") | ||
| return "none" | ||
colby-swandale marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| # Handle backwards compatibility: if the old boolean `true` value is set, | ||
| # prompt the user to choose a specific code of conduct | ||
| if coc_template.to_s == "true" | ||
| Bundler.ui.info "\nYour gem.coc setting is configured to `true`, but `bundle gem` now supports " \ | ||
| "multiple codes of conduct. Please select which code of conduct you'd like to use:\n" \ | ||
| "* Contributor Covenant: https://www.contributor-covenant.org/\n" \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just my personal preference, but I'd like the Ruby stuff to come first. |
||
| "* Ruby: https://www.ruby-lang.org/en/conduct/\n" | ||
| Bundler.ui.info "Your choice will update the global gem.coc setting." | ||
|
|
||
| coc_template = prompt_coc_selection | ||
| Bundler.settings.set_global("gem.coc", coc_template) | ||
| elsif coc_template.to_s.empty? | ||
| Bundler.ui.info "\nDo you want to include a code of conduct in gems you generate? " \ | ||
| "Codes of conduct can increase contributions to your project by contributors who " \ | ||
| "prefer safe, respectful, productive, and collaborative spaces.\n" \ | ||
| "Supported codes of conduct:\n" \ | ||
| "* Contributor Covenant: https://www.contributor-covenant.org/\n" \ | ||
| "* Ruby: https://www.ruby-lang.org/en/conduct/\n" | ||
| Bundler.ui.info hint_text("coc") | ||
|
|
||
| coc_template = prompt_coc_selection | ||
|
|
||
| if Bundler.settings["gem.coc"].nil? | ||
| Bundler.settings.set_global("gem.coc", coc_template) | ||
| end | ||
| end | ||
|
|
||
| if options[:coc] && !options[:coc].empty? && options[:coc] == Bundler.settings["gem.coc"] | ||
| Bundler.ui.info "Using configured code of conduct: #{options[:coc]}" | ||
| end | ||
|
|
||
| coc_template | ||
| end | ||
|
|
||
| def prompt_coc_selection | ||
| result = Bundler.ui.ask "Enter a code of conduct. contributor-covenant/ruby/(none):" | ||
| return result if %w[contributor-covenant ruby].include?(result) | ||
|
|
||
| Bundler.ui.info "Unrecognized input, skipping code of conduct" unless result.to_s.empty? || result == "none" | ||
| "none" | ||
| end | ||
|
|
||
| def ask_and_set_linter | ||
| return if skip?(:linter) | ||
| linter_template = options[:linter] || Bundler.settings["gem.linter"] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍