lib/bundler/definition.rb in bundler-1.7.15 vs lib/bundler/definition.rb in bundler-1.8.0.pre
- old
+ new
@@ -127,11 +127,11 @@
# 2. After that it tries and fetches gemspec of resolved dependencies
#
# @return [Bundler::SpecSet]
def specs
@specs ||= begin
- specs = resolve.materialize(requested_dependencies)
+ specs = resolve.materialize(Bundler.settings[:cache_all_platforms] ? dependencies : requested_dependencies)
unless specs["bundler"].any?
local = Bundler.settings[:frozen] ? rubygems_index : index
bundler = local.search(Gem::Dependency.new('bundler', VERSION)).last
specs["bundler"] = bundler if bundler
@@ -182,33 +182,30 @@
# are reused when resolving dependencies
#
# @return [SpecSet] resolved dependencies
def resolve
@resolve ||= begin
- last_resolve = converge_locked_specs
if Bundler.settings[:frozen] || (!@unlocking && nothing_changed?)
- last_resolve
+ @locked_specs
else
+ last_resolve = converge_locked_specs
+
# Run a resolve against the locally available gems
last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve)
end
end
end
def index
@index ||= Index.build do |idx|
dependency_names = @dependencies.map { |d| d.name }
- sources.all_sources.each do |source|
- source.dependency_names = dependency_names.dup
- idx.add_source source.specs
-
- if source.is_a?(Source::Git) || source.is_a?(Source::Path)
- dependency_names -= source.specs.map{|s| s.name }.uniq
- end
-
- dependency_names.push(*source.unmet_deps).uniq!
+ sources.all_sources.each do |s|
+ s.dependency_names = dependency_names.dup
+ idx.add_source s.specs
+ s.specs.each { |spec| dependency_names.delete(spec.name) }
+ dependency_names.push(*s.unmet_deps).uniq!
end
end
end
# used when frozen is enabled so we can find the bundler
@@ -273,11 +270,11 @@
# are ordered consistently
sort_by { |s| s.full_name }.
each do |spec|
next if spec.name == 'bundler'
out << spec.to_lock
- end
+ end
out << "\n"
end
out << "PLATFORMS\n"
@@ -515,13 +512,11 @@
end
end
converged = []
@locked_specs.each do |s|
- # Replace the locked dependency's source with the equivalent source from the Gemfile
- dep = @dependencies.find { |dep| s.satisfies?(dep) }
- s.source = (dep && dep.source) || sources.get(s.source)
+ s.source = sources.get(s.source)
# Don't add a spec to the list if its source is expired. For example,
# if you change a Git gem to Rubygems.
next if s.source.nil? || @unlock[:sources].include?(s.name)
# If the spec is from a path source and it doesn't exist anymore
@@ -557,18 +552,15 @@
end
resolve
end
- def in_locked_deps?(dep, locked_dep)
- # Because the lockfile can't link a dep to a specific remote, we need to
- # treat sources as equivalent anytime the locked dep has all the remotes
- # that the Gemfile dep does.
- locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
+ def in_locked_deps?(dep, d)
+ d && dep.source == d.source
end
def satisfies_locked_spec?(dep)
- @locked_specs.any? { |s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
+ @locked_specs.any? { |s| s.satisfies?(dep) && (!dep.source || s.source == dep.source) }
end
def expanded_dependencies
@expanded_dependencies ||= expand_dependencies(dependencies, @remote)
end