diff options
Diffstat (limited to 'lib/rubygems/commands/install_command.rb')
-rw-r--r-- | lib/rubygems/commands/install_command.rb | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 82631b1ffd..0085d68cf3 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -194,65 +194,21 @@ You can use `i` command instead of `install`. req = Gem::Requirement.create(version) - if options[:ignore_dependencies] - install_gem_without_dependencies name, req - else - inst = Gem::DependencyInstaller.new options - request_set = inst.resolve_dependencies name, req - - if options[:explain] - say "Gems to install:" - - request_set.sorted_requests.each do |s| - # shows platform specific gems if used - say (plat = s.spec.platform) == Gem::Platform::RUBY ? - " #{s.full_name}" : - " #{s.full_name}-#{plat}" - end - - return - else - @installed_specs.concat request_set.install options - end + dinst = Gem::DependencyInstaller.new options - show_install_errors inst.errors - end - end + request_set = dinst.resolve_dependencies name, req - def install_gem_without_dependencies(name, req) # :nodoc: - gem = nil + if options[:explain] + say "Gems to install:" - if local? - if name =~ /\.gem$/ and File.file? name - source = Gem::Source::SpecificFile.new name - spec = source.spec - else - source = Gem::Source::Local.new - spec = source.find_gem name, req + request_set.sorted_requests.each do |activation_request| + say " #{activation_request.full_name}" end - gem = source.download spec if spec - end - - if remote? and not gem - dependency = Gem::Dependency.new name, req - dependency.prerelease = options[:prerelease] - - fetcher = Gem::RemoteFetcher.fetcher - gem = fetcher.download_to_cache dependency + else + @installed_specs.concat request_set.install options end - inst = Gem::Installer.at gem, options - inst.install - - require 'rubygems/dependency_installer' - dinst = Gem::DependencyInstaller.new options - dinst.installed_gems.replace [inst.spec] - - Gem.done_installing_hooks.each do |hook| - hook.call dinst, [inst.spec] - end unless Gem.done_installing_hooks.empty? - - @installed_specs.push(inst.spec) + show_install_errors dinst.errors end def install_gems # :nodoc: |