diff options
author | Frank Lam <ryzingsun11@yahoo.com> | 2020-05-30 17:06:57 +0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-06-18 19:14:15 +0900 |
commit | 8e3136a03bdaf1aa405a07e689206080f3dfed7b (patch) | |
tree | bda8693a301b2924c8f1f2c92295650cb2b2ef8a /lib/bundler/cli/gem.rb | |
parent | a80a5706b1d6737b866a164ad672a80de669dec1 (diff) | |
download | ruby-8e3136a03bdaf1aa405a07e689206080f3dfed7b.tar.gz |
[rubygems/rubygems] Make test framework/CI configuration for bundle gem consistent
* Add hints for --ci option
https://github.com/rubygems/rubygems/commit/5f779f45b0
Diffstat (limited to 'lib/bundler/cli/gem.rb')
-rw-r--r-- | lib/bundler/cli/gem.rb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 1303a883f6..05a5537d74 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -193,6 +193,12 @@ module Bundler "so -t is not needed if you want to continue using it. " \ "This setting can be changed anytime with `bundle config gem.test`." end + + if options[:ci] == Bundler.settings["gem.ci"] + Bundler.ui.info "Bundler is configured to generate CI files for #{Bundler.settings["gem.ci"]}, "\ + "so --ci is not needed if you want to continue using it. " \ + "This setting can be changed anytime with `bundle config gem.ci`." + end rescue Errno::EEXIST => e raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.") end @@ -231,8 +237,9 @@ module Bundler if test_framework.to_s.empty? Bundler.ui.confirm "Do you want to generate tests with your gem?" - Bundler.ui.info test_framework_hint - result = Bundler.ui.ask "Type 'rspec', 'minitest' or 'test-unit' to generate those test files now. " \ + Bundler.ui.info hint_text("test") + + result = Bundler.ui.ask "Enter a framework name to generate those test files now. " \ "rspec/minitest/test-unit/(none):" if result =~ /rspec|minitest|test-unit/ test_framework = result @@ -248,30 +255,31 @@ module Bundler test_framework end - def test_framework_hint - if Bundler.settings["gem.test"] == false + def hint_text(setting) + if Bundler.settings["gem.#{setting}"] == false "Your choice will only be applied to this gem." else "Future `bundle gem` calls will use your choice. " \ - "This setting can be changed anytime with `bundle config gem.test`." + "This setting can be changed anytime with `bundle config gem.#{setting}`." end end def ask_and_set_ci ci_template = options[:ci] || Bundler.settings["gem.ci"] - if ci_template.nil? + if ci_template.to_s.empty? Bundler.ui.confirm "Do you want to set up automated testing for your gem? " \ "Continuous integration services make it easy to see if pull requests have passing tests " \ - "before you merge them. Bundler supports these services:" \ + "before you merge them. Bundler supports these services:\n" \ "* CircleCI: https://circleci.com/\n" \ "* GitHub Actions: https://github.com/features/actions\n" \ "* GitLab CI: https://docs.gitlab.com/ee/ci/\n" \ "* Travis CI: https://travis-ci.org/\n" \ "\n" + Bundler.ui.info hint_text("ci") - result = Bundler.ui.ask "Enter a service name to generate a CI configuration now and " \ - "in the future. github/travis/gitlab/circle/(none):" + result = Bundler.ui.ask "Enter a service name to generate a CI configuration now. " \ + "github/travis/gitlab/circle/(none):" if result =~ /github|travis|gitlab|circle/ ci_template = result else |