diff options
author | Carl Lerche <carllerche@mac.com> | 2010-06-06 22:18:57 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-06-06 22:18:57 -0700 |
commit | 6de6acae79bf339ac33a4ed32105384267ad2091 (patch) | |
tree | d90411058f48746fb924421ddf9a16402bed69e8 /lib | |
parent | 2f2b5a8700ea812534404a6e5d198e642f8c68bd (diff) | |
download | bundler-6de6acae79bf339ac33a4ed32105384267ad2091.tar.gz |
Fix materializing the lazy specifications
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/definition.rb | 2 | ||||
-rw-r--r-- | lib/bundler/index.rb | 2 | ||||
-rw-r--r-- | lib/bundler/lazy_specification.rb | 4 | ||||
-rw-r--r-- | lib/bundler/source.rb | 8 | ||||
-rw-r--r-- | lib/bundler/spec_set.rb | 13 |
5 files changed, 20 insertions, 9 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 93c79590e3..7c79127f94 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -234,7 +234,7 @@ module Bundler # Run a resolve against the locally available gems @last_resolve = Resolver.resolve(expanded_dependencies, index, source_requirements, @last_resolve) end - @last_resolve.materialize(expand_dependencies(requested_dependencies)) + @last_resolve.materialize(requested_dependencies) end end end diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 8b7975cca5..d100a5034d 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -83,7 +83,7 @@ module Bundler def search_by_spec(spec) @specs[spec.name].select do |s| - s.version == spec.version && s.platform == spec.platform + s.version == spec.version && Gem::Platform.new(s.platform) == Gem::Platform.new(spec.platform) end end diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index d4367db44d..c612218a6a 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -44,8 +44,8 @@ module Bundler out end - def __materialize__(index) - @specification = index.search(Gem::Dependency.new(name, version)).last + def __materialize__ + @specification = source[self] raise "Could not materialize #{full_name}" unless @specification @specification end diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 6802bbebd4..6aedbe5343 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -25,6 +25,10 @@ module Bundler @allow_remote = true end + def [](spec) + specs[spec].first + end + def hash Rubygems.hash end @@ -322,6 +326,10 @@ module Bundler index end + def [](spec) + specs[spec].first + end + def local_specs @local_specs ||= load_spec_files end diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 9edfaf79f1..c5ce467494 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -16,7 +16,7 @@ module Bundler @specs.length end - def for(dependencies, skip = [], check = false) + def for(dependencies, skip = [], check = false, match_current_platform = false) handled, deps, specs = {}, dependencies.dup, [] until deps.empty? @@ -24,7 +24,9 @@ module Bundler next if handled[dep] || skip.include?(dep.name) spec = lookup[dep.name].find do |s| - s.match_platform(dep.__platform) + match_current_platform ? + Gem::Platform.match(s.platform) : + s.match_platform(dep.__platform) end handled[dep] = true @@ -34,7 +36,8 @@ module Bundler spec.dependencies.each do |d| next if d.type == :development - deps << DepProxy.new(d, dep.__platform) + d = DepProxy.new(d, dep.__platform) unless match_current_platform + deps << d end elsif check return false @@ -62,10 +65,10 @@ module Bundler end def materialize(deps) - materialized = self.for(deps, []).to_a + materialized = self.for(deps, [], false, true).to_a materialized.map! do |s| next s unless s.is_a?(LazySpecification) - s.__materialize__(s.source.specs) + s.__materialize__ end SpecSet.new(materialized) end |