summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
authorbronzdoc <lsagastume1990@gmail.com>2019-08-21 23:35:39 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-09-05 18:43:21 +0900
commitb11cfed4c4fae51f7111c6cc0a3ec436a9c8faa3 (patch)
treed29205322ad97da192fc55ea59f7bcffdae1d6c2 /lib/rubygems
parent400d693863cc8b500d9bcaee9529a395f3fe6da7 (diff)
[rubygems/rubygems] Error out if there are multiple gemspecs and no gemspec is specified
https://github.com/rubygems/rubygems/commit/547947bbf0
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/commands/build_command.rb13
1 files changed, 10 insertions, 3 deletions
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)