diff options
-rw-r--r-- | lib/rubygems/commands/build_command.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_build_command.rb | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 27d8140428..bc37ab9a94 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -62,10 +62,8 @@ Gems can be saved to a specified filename with the output option: private - def build_gem(gemspec = get_one_optional_argument) - unless File.exist?(gemspec) - gemspec += ".gemspec" if File.exist?(gemspec + ".gemspec") - end + def build_gem(gem_name = get_one_optional_argument) + gemspec = File.exist?(gem_name) ? gem_name : "#{gem_name}.gemspec" if File.exist?(gemspec) spec = Gem::Specification.load(gemspec) diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb index 58fc9648bf..6d44d48c13 100644 --- a/test/rubygems/test_gem_commands_build_command.rb +++ b/test/rubygems/test_gem_commands_build_command.rb @@ -189,7 +189,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase end assert_equal '', @ui.output - assert_equal "ERROR: Gemspec file not found: some_gem\n", @ui.error + assert_equal "ERROR: Gemspec file not found: some_gem.gemspec\n", @ui.error end def test_execute_outside_dir |