summaryrefslogtreecommitdiff
path: root/lib/rubygems/dependency_installer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/dependency_installer.rb')
-rw-r--r--lib/rubygems/dependency_installer.rb28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index d811f62875..256c91ee9c 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -88,6 +88,7 @@ class Gem::DependencyInstaller
# we absolutely must.
@minimal_deps = options[:minimal_deps]
+ @available = nil
@installed_gems = []
@toplevel_specs = nil
@@ -101,6 +102,22 @@ class Gem::DependencyInstaller
attr_reader :errors
##
+ # Creates an AvailableSet to install from based on +dep_or_name+ and
+ # +version+
+
+ def available_set_for dep_or_name, version # :nodoc:
+ if String === dep_or_name then
+ find_spec_by_name_and_version dep_or_name, version, @prerelease
+ else
+ dep = dep_or_name.dup
+ dep.prerelease = @prerelease
+ @available = find_gems_with_sources dep
+ end
+
+ @available.pick_best!
+ end
+
+ ##
# Indicated, based on the requested domain, if local
# gems should be considered.
@@ -302,13 +319,7 @@ class Gem::DependencyInstaller
# separately.
def install dep_or_name, version = Gem::Requirement.default
- if String === dep_or_name then
- find_spec_by_name_and_version dep_or_name, version, @prerelease
- else
- dep = dep_or_name.dup
- dep.prerelease = @prerelease
- @available = find_gems_with_sources(dep).pick_best!
- end
+ available_set_for dep_or_name, version
@installed_gems = []
@@ -367,12 +378,9 @@ class Gem::DependencyInstaller
# it's documentation. Ideally the hook adder could decide whether to be in
# the background or not, and what to call it.
in_background "Installing documentation" do
- start = Time.now
Gem.done_installing_hooks.each do |hook|
hook.call self, @installed_gems
end
- finish = Time.now
- say "Done installing documentation for #{@installed_gems.map(&:name).join(', ')} (#{(finish-start).to_i} sec)."
end unless Gem.done_installing_hooks.empty?
@installed_gems