summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFrank Lam <ryzingsun11@yahoo.com>2020-05-22 10:27:12 +0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-05 07:32:42 +0900
commit58267fa59e6ea2e4e90a7459a5d7d2f0f57d4f02 (patch)
tree3a5716d7cf0d94026a2614d98b1befbfd12b2f04 /lib
parent3c9d3d18f6d54b4e11c22e1b0f5cecce2bb26c0a (diff)
[rubygems/rubygems] Conditionally display test framework help text
https://github.com/rubygems/rubygems/commit/8b51a86265
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3184
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli/gem.rb19
1 files 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 <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
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]