summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/build_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/build_command.rb')
-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"