ruby-changes:61511
From: Frank <ko1@a...>
Date: Fri, 5 Jun 2020 07:33:40 +0900 (JST)
Subject: [ruby-changes:61511] 58267fa59e (master): [rubygems/rubygems] Conditionally display test framework help text
https://git.ruby-lang.org/ruby.git/commit/?id=58267fa59e From 58267fa59e6ea2e4e90a7459a5d7d2f0f57d4f02 Mon Sep 17 00:00:00 2001 From: Frank Lam <ryzingsun11@y...> 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 diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 7fe76ad..57fc635 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -177,6 +177,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L177 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 https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L222 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 <value>. 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 https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L237 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 v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/