-
-
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
base: master
Are you sure you want to change the base?
Conversation
…butor covernent CoCs
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.
Pull request overview
This PR expands the bundle gem command to allow users to choose between different Code of Conducts (Contributor Covenant or Ruby Community Conduct Guideline) instead of a boolean on/off option. The change migrates the configuration from a boolean to a string value while maintaining backward compatibility with existing boolean configurations.
Changes:
- Updated
--cocoption to accept string values:contributor-covenant,ruby, ornone - Added two new Code of Conduct templates for the different options
- Implemented backward compatibility logic to migrate legacy boolean values (
true/false) to the new string-based system - Updated tests to cover all new functionality and edge cases
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| bundler/spec/commands/newgem_spec.rb | Comprehensive test coverage for new CoC options, backward compatibility, and configuration behavior |
| bundler/lib/bundler/templates/newgem/RUBY_SRC_CODE_OF_CONDUCT.md.tt | New template for Ruby Community Conduct Guideline |
| bundler/lib/bundler/templates/newgem/CONTRIBUTOR_COVENANT_CODE_OF_CONDUCT.md.tt | New template for Contributor Covenant v3.0 |
| bundler/lib/bundler/settings.rb | Moved gem.coc from BOOL_KEYS to STRING_KEYS to support string values |
| bundler/lib/bundler/man/bundle-gem.1.ronn | Updated documentation for the new --coc options |
| bundler/lib/bundler/cli/gem.rb | Implemented ask_and_set_coc method with backward compatibility logic |
| bundler/lib/bundler/cli.rb | Updated method_option for --coc to accept string enum with lazy_default |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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" |
Copilot
AI
Jan 19, 2026
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.
When a user explicitly provides the --coc flag without a value while gem.coc is set to the legacy boolean value false, the code will silently migrate the setting to "none" and return early without prompting the user. This contradicts the test expectation at lines 1270-1284 which expects the user to be prompted. The issue is that line 395 falls back to Bundler.settings["gem.coc"] even when options[:coc] is explicitly set to an empty string. The backwards compatibility check should only apply when the user hasn't explicitly provided the --coc flag.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
What was the end-user or developer problem that led to this PR?
The bundle gem command has been using the Contributor Covenant since 2014, but it was recently updated to the Ruby CoC when the RubyGems project was moved under the Ruby Organization.
I want to improve the project by updating the bundle gem command to offer a choice between the two going forward. This will also allow the Ruby community to nominate any future Code of Conducts more easily if needed.
What is your fix for the problem, implemented in this PR?
This Pull Request updates the bundle gem --coc option to allow users to select between the Ruby CoC or the Contributor Covenant. It takes into account any previous configuration (before: Boolean, after: String) for this option and handles the migration to the new functionality appropriately.
Make sure the following tasks are checked