1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems/dependency_installer.rb: Only install local gems if

they end in '.gem'.  Fixes github rubygems issue #407.
* test/rubygems/test_gem_dependency_installer.rb:  Test for the above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-02-07 22:17:08 +00:00
parent 972041696f
commit bab42629eb
3 changed files with 34 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Fri Feb 8 07:17:00 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/dependency_installer.rb: Only install local gems if
they end in '.gem'. Fixes github rubygems issue #407.
* test/rubygems/test_gem_dependency_installer.rb: Test for the above.
Fri Feb 8 00:02:48 2013 Tanaka Akira <akr@fsij.org>
* process.c (obj2gid): use getgrnam_r() only if getgrnam_r() and

View file

@ -260,7 +260,7 @@ class Gem::DependencyInstaller
set = Gem::AvailableSet.new
if consider_local?
if File.file? gem_name then
if gem_name =~ /\.gem$/ and File.file? gem_name then
src = Gem::Source::SpecificFile.new(gem_name)
set.add src.spec, src
else

View file

@ -794,6 +794,19 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal Gem::Source.new(@gem_repo), s.source
end
def test_find_spec_by_name_and_version_bad_gem
FileUtils.touch 'rdoc.gem'
inst = Gem::DependencyInstaller.new
e = assert_raises Gem::Package::FormatError do
inst.find_spec_by_name_and_version 'rdoc.gem'
end
full_path = File.join @tempdir, 'rdoc.gem'
assert_equal "package metadata is missing in #{full_path}", e.message
end
def test_find_spec_by_name_and_version_directory
Dir.mkdir 'rdoc'
@ -808,6 +821,20 @@ class TestGemDependencyInstaller < Gem::TestCase
e.message
end
def test_find_spec_by_name_and_version_file
FileUtils.touch 'rdoc'
inst = Gem::DependencyInstaller.new
e = assert_raises Gem::SpecificGemNotFoundException do
inst.find_spec_by_name_and_version 'rdoc'
end
assert_equal "Could not find a valid gem 'rdoc' (>= 0) " +
"locally or in a repository",
e.message
end
def test_find_gems_with_sources_local
util_setup_gems