summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Katz <wycats@Yehuda-Katzs-MacBook-Pro-2.local>2010-11-13 16:31:57 -0600
committerYehuda Katz <wycats@Yehuda-Katzs-MacBook-Pro-2.local>2010-11-13 16:31:57 -0600
commit7737c627ef3a6751b630b22f6fabf48b27e5f2d4 (patch)
treee1c98ec1e7df88ba9dc5c6f89d81887e03c1880c
parent6bee5f6ce6c7befc4604ce5428975c4132f2335c (diff)
parent235e8c61f4d3b1388cdb3a825fc412baba9825c7 (diff)
downloadbundler-7737c627ef3a6751b630b22f6fabf48b27e5f2d4.tar.gz
Merge remote branch 'origin/1-0-stable'
-rw-r--r--lib/bundler/definition.rb8
-rw-r--r--lib/bundler/resolver.rb11
2 files changed, 5 insertions, 14 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 59813c6d2a..1c0e3667ca 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -148,9 +148,7 @@ module Bundler
end
# Run a resolve against the locally available gems
- local = Resolver.resolve(expanded_dependencies,
- index, source_requirements, last_resolve, unlocked?)
- last_resolve.merge(local)
+ last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve)
end
end
end
@@ -427,9 +425,5 @@ module Bundler
groups.map! { |g| g.to_sym }
dependencies.reject { |d| !d.should_include? || (d.groups & groups).empty? }
end
-
- def unlocked?
- @lockfile_contents.empty?
- end
end
end
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index f2fe1d59ce..5b01d4210b 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -121,9 +121,9 @@ module Bundler
# ==== Returns
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
# collection of gemspecs is returned. Otherwise, nil is returned.
- def self.resolve(requirements, index, source_requirements = {}, base = [], sort = true)
+ def self.resolve(requirements, index, source_requirements = {}, base = [])
base = SpecSet.new(base) unless base.is_a?(SpecSet)
- resolver = new(index, source_requirements, base, sort)
+ resolver = new(index, source_requirements, base)
result = catch(:success) do
resolver.start(requirements)
raise resolver.version_conflict
@@ -132,14 +132,13 @@ module Bundler
SpecSet.new(result)
end
- def initialize(index, source_requirements, base, sort)
+ def initialize(index, source_requirements, base)
@errors = {}
@stack = []
@base = base
@index = index
@missing_gems = Hash.new(0)
@source_requirements = source_requirements
- @sort = sort
end
def debug
@@ -172,14 +171,12 @@ module Bundler
# 1) Is this gem already activated?
# 2) Do the version requirements include prereleased gems?
# 3) Sort by number of gems available in the source.
- # This is a pretty expensive operation, so we skip it when the bundle is
- # locked and sorting isn't necessary.
reqs = reqs.sort_by do |a|
[ activated[a.name] ? 0 : 1,
a.requirement.prerelease? ? 0 : 1,
@errors[a.name] ? 0 : 1,
activated[a.name] ? 0 : search(a).size ]
- end if @sort
+ end
debug { "Activated:\n" + activated.values.map { |a| " #{a.name} (#{a.version})" }.join("\n") }
debug { "Requirements:\n" + reqs.map { |r| " #{r.name} (#{r.requirement})"}.join("\n") }