From 58267fa59e6ea2e4e90a7459a5d7d2f0f57d4f02 Mon Sep 17 00:00:00 2001 From: Frank Lam Date: Fri, 22 May 2020 10:27:12 +0800 Subject: [rubygems/rubygems] Conditionally display test framework help text https://github.com/rubygems/rubygems/commit/8b51a86265 --- lib/bundler/cli/gem.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 7fe76adf4c..57fc635341 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -177,6 +177,12 @@ module Bundler Bundler.ui.info "Gem '#{name}' was successfully created. " \ "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html" + + if options[:test] == Bundler.settings["gem.test"] + Bundler.ui.info "Bundler is configured to generate test files for #{Bundler.settings["gem.test"]}, "\ + "so -t is not needed if you want to continue using it. " \ + "This setting can be changed anytime with bundle config gem.test." + end rescue Errno::EEXIST => e raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.") end @@ -216,9 +222,7 @@ module Bundler if test_framework.to_s.empty? Bundler.ui.confirm "Do you want to generate tests with your gem?" result = Bundler.ui.ask "Type 'rspec', 'minitest' or 'test-unit' to generate those test files now. \n" \ - "If Bundler is configured to not generate test files, your choice will only be applied to this instance. \n" \ - "Otherwise, future bundle gem calls will use your choice, so -t is not needed if your choice will be the same. \n" \ - "This setting can be changed anytime with bundle config gem.test . rspec/minitest/test-unit/(none):" + "#{test_framework_help_info} rspec/minitest/test-unit/(none):" if result =~ /rspec|minitest|test-unit/ test_framework = result else @@ -233,6 +237,15 @@ module Bundler test_framework end + def test_framework_help_info + if Bundler.settings["gem.test"] == 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." + end + end + def bundler_dependency_version v = Gem::Version.new(Bundler::VERSION) req = v.segments[0..1] -- cgit v1.2.3