Permalink
Browse files

Switched all our user-facing code to Gem::Specification.unresolved_deps.

  • Loading branch information...
1 parent 2f10d7d commit 06397791fa8c8023c50c2ef4d896144680cd9461 @zenspider zenspider committed Jun 7, 2011
Showing with 10 additions and 7 deletions.
  1. +1 −1 lib/rubygems/custom_require.rb
  2. +6 −4 lib/rubygems/specification.rb
  3. +2 −1 lib/rubygems/test_case.rb
  4. +1 −1 test/rubygems/test_gem.rb
@@ -32,7 +32,7 @@ module Kernel
# that file has already been loaded is preserved.
def require path
- if Gem.unresolved_deps.empty? or Gem.loaded_path? path then
+ if Gem::Specification.unresolved_deps.empty? or Gem.loaded_path? path then
gem_original_require path
else
spec = Gem::Specification.find { |s|
@@ -756,7 +756,7 @@ def self.find_by_path path
def self.find_in_unresolved path
# TODO: do we need these?? Kill it
- specs = Gem.unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
specs.find_all { |spec| spec.contains_requirable_file? path }
end
@@ -766,7 +766,7 @@ def self.find_in_unresolved path
# specs that contain the file matching +path+.
def self.find_in_unresolved_tree path
- specs = Gem.unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
specs.reverse_each do |spec|
trails = []
@@ -1060,6 +1060,8 @@ def activate
# resolved later, as needed.
def activate_dependencies
+ unresolved = Gem::Specification.unresolved_deps
+
self.runtime_dependencies.each do |spec_dep|
# TODO: check for conflicts! not just name!
next if Gem.loaded_specs.include? spec_dep.name
@@ -1069,11 +1071,11 @@ def activate_dependencies
specs.first.activate
else
name = spec_dep.name
- Gem.unresolved_deps[name] = Gem.unresolved_deps[name].merge spec_dep
+ unresolved[name] = unresolved[name].merge spec_dep
end
end
- Gem.unresolved_deps.delete self.name
+ unresolved.delete self.name
end
##
@@ -149,10 +149,11 @@ def setup
FileUtils.mkdir_p @gemhome
FileUtils.mkdir_p @userhome
+ Gem::Specification.unresolved_deps.clear # done to avoid cross-test warnings
Gem.use_paths(@gemhome)
Gem.loaded_specs.clear
- Gem.unresolved_deps.clear
+ Gem::Specification.unresolved_deps.clear
Gem.configuration.verbose = true
Gem.configuration.update_sources = true
@@ -54,7 +54,7 @@ def loaded_spec_names
end
def unresolved_names
- Gem.unresolved_deps.values.map(&:to_s).sort
+ Gem::Specification.unresolved_deps.values.map(&:to_s).sort
end
# TODO: move these to specification

0 comments on commit 0639779

Please sign in to comment.