summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-23 07:13:17 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-23 07:13:17 +0000
commit8680f4f8dec467afa58b6f993728d35c45fcefd6 (patch)
tree2ca0eea759a1909f9c1b0ac4f991fc35e0dc7245 /lib
parent0f7e52f9902a575cf76e63126f11793985dcf29e (diff)
merge revision(s) 44333: [Backport #9282]
* lib/rubygems/commands/install_command.rb: Restore gem install --ignore-dependencies for remote gems * test/rubygems/test_gem_commands_install_command.rb: Test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@44362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/install_command.rb32
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 56ff8fc564..4485eb12e8 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -69,7 +69,7 @@ class Gem::Commands::InstallCommand < Gem::Command
o[:explain] = v
end
- @installed_specs = nil
+ @installed_specs = []
end
def arguments # :nodoc:
@@ -200,10 +200,8 @@ to write the specification by hand. For example:
req = Gem::Requirement.create(version)
- if options[:ignore_dependencies]
- inst = Gem::Installer.new name, options
- inst.install
- @installed_specs.push(inst.spec)
+ if options[:ignore_dependencies] then
+ install_gem_without_dependencies name, req
else
inst = Gem::DependencyInstaller.new options
@@ -227,6 +225,30 @@ to write the specification by hand. For example:
end
end
+ def install_gem_without_dependencies name, req # :nodoc:
+ gem = nil
+
+ if remote? then
+ dependency = Gem::Dependency.new name, req
+ dependency.prerelease = options[:prerelease]
+
+ fetcher = Gem::RemoteFetcher.fetcher
+ gem = fetcher.download_to_cache dependency
+ end
+
+ if local? and not gem then
+ source = Gem::Source::Local.new
+ spec = source.find_gem name, req
+
+ gem = source.download spec
+ end
+
+ inst = Gem::Installer.new gem, options
+ inst.install
+
+ @installed_specs.push(inst.spec)
+ end
+
def install_gems # :nodoc:
exit_code = 0