summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbronzdoc <lsagastume1990@gmail.com>2019-08-18 14:57:41 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-09-05 18:42:56 +0900
commita02da1012bb391ae01affac7454ea28996fd7dbf (patch)
tree87315c1f855573e776e92c039eae3ac328bd2f7a /lib
parentbcf51dd76332bc28ee75494c51828a36774ff99f (diff)
[rubygems/rubygems] Build the first gemspec we found if no gemspec is specified
https://github.com/rubygems/rubygems/commit/ab186266b7
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/build_command.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index bc37ab9a94..69203d3ebc 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -57,11 +57,19 @@ Gems can be saved to a specified filename with the output option:
end
def execute
- build_gem
+ build_gem(gem_name)
end
private
+ def gem_name
+ get_one_optional_argument || find_gemspecs.first
+ end
+
+ def find_gemspecs
+ Dir.glob("*.gemspec").sort
+ end
+
def build_gem(gem_name = get_one_optional_argument)
gemspec = File.exist?(gem_name) ? gem_name : "#{gem_name}.gemspec"