From b11cfed4c4fae51f7111c6cc0a3ec436a9c8faa3 Mon Sep 17 00:00:00 2001 From: bronzdoc Date: Wed, 21 Aug 2019 23:35:39 -0600 Subject: [rubygems/rubygems] Error out if there are multiple gemspecs and no gemspec is specified https://github.com/rubygems/rubygems/commit/547947bbf0 --- lib/rubygems/commands/build_command.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/rubygems') diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 69203d3ebc..c7d5fd31f5 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -63,11 +63,18 @@ Gems can be saved to a specified filename with the output option: private def gem_name - get_one_optional_argument || find_gemspecs.first + get_one_optional_argument || find_gemspec end - def find_gemspecs - Dir.glob("*.gemspec").sort + def find_gemspec + gemspecs = Dir.glob("*.gemspec").sort + + if gemspecs.size > 1 + alert_error "Multiple gemspecs found: #{gemspecs}, please specify one" + terminate_interaction(1) + end + + gemspecs.first end def build_gem(gem_name = get_one_optional_argument) -- cgit v1.2.3