Skip to content

Commit 22473e4

Browse files
Merge pull request #3988 from voxik/fix-file-not-found-gemspec-gemspec
Append '.gemspec' extension only when it is not present. (cherry picked from commit 214fefc)
1 parent 0861f7f commit 22473e4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rubygems/commands/build_command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def find_gemspec
7979
end
8080

8181
def build_gem(gem_name)
82-
gemspec = File.exist?(gem_name) ? gem_name : "#{gem_name}.gemspec"
82+
gemspec = File.extname(gem_name) == ".gemspec" ? gem_name : "#{gem_name}.gemspec"
8383

8484
if File.exist?(gemspec)
8585
spec = Gem::Specification.load(gemspec)

test/rubygems/test_gem_commands_build_command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def test_execute_outside_dir
273273
end
274274

275275
def test_can_find_gemspecs_without_dot_gemspec
276-
gemspec_file = File.join(@tempdir, @gem.spec_name)
276+
gemspec_file = File.join(@tempdir, @gem.name)
277277

278278
File.open gemspec_file + ".gemspec", 'w' do |gs|
279279
gs.write @gem.to_ruby

0 commit comments

Comments
 (0)