summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-01-29 21:05:42 -0800
committerCarl Lerche <carllerche@mac.com>2010-01-29 21:05:42 -0800
commit72867a15ca3813564389a9dfdc3236457af99fa2 (patch)
tree188ef1e53bb69505cc16c863e7ec31834b674d67
parent1b408875f7f53457fd680b97eda66c9fbc969675 (diff)
downloadbundler-72867a15ca3813564389a9dfdc3236457af99fa2.tar.gz
Minor refactor
-rw-r--r--bundler.gemspec2
-rw-r--r--lib/bundler/installer.rb6
-rw-r--r--lib/bundler/resolver.rb11
-rw-r--r--spec/runtime/setup_spec.rb4
4 files changed, 11 insertions, 12 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index a6af1e59f5..c56eb1cb99 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
- s.files = ["bin/bundle", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor/thor/actions/create_file.rb", "lib/bundler/vendor/thor/actions/directory.rb", "lib/bundler/vendor/thor/actions/empty_directory.rb", "lib/bundler/vendor/thor/actions/file_manipulation.rb", "lib/bundler/vendor/thor/actions/inject_into_file.rb", "lib/bundler/vendor/thor/actions.rb", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/group.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/rake_compat.rb", "lib/bundler/vendor/thor/runner.rb", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README"]
+ s.files = ["bin/bundle", "lib/bundler", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor", "lib/bundler/vendor/thor", "lib/bundler/vendor/thor/actions", "lib/bundler/vendor/thor/actions/create_file.rb", "lib/bundler/vendor/thor/actions/directory.rb", "lib/bundler/vendor/thor/actions/empty_directory.rb", "lib/bundler/vendor/thor/actions/file_manipulation.rb", "lib/bundler/vendor/thor/actions/inject_into_file.rb", "lib/bundler/vendor/thor/actions.rb", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/group.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/rake_compat.rb", "lib/bundler/vendor/thor/runner.rb", "lib/bundler/vendor/thor/shell", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README"]
s.homepage = %q{http://github.com/carlhuda/bundler}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 900630eb7e..1277f31f31 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -58,7 +58,11 @@ module Bundler
def resolve_remotely
index # trigger building the index
Bundler.ui.info "Resolving dependencies... "
- specs = Resolver.resolve(dependencies, index)
+ source_requirements = {}
+ dependencies.each do |dep|
+ source_requirements[dep.name] = dep.source.specs if dep.source
+ end
+ specs = Resolver.resolve(dependencies, index, source_requirements)
Bundler.ui.info "Done."
specs
end
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 86b3d4a8dd..55a96ebf44 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -34,10 +34,8 @@ 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 = {}
-
- resolver = new(index)
+ def self.resolve(requirements, index, source_requirements = {})
+ resolver = new(index, source_requirements)
result = catch(:success) do
resolver.resolve(requirements, {})
output = resolver.errors.inject("") do |o, (conflict, (origin, requirement))|
@@ -71,10 +69,11 @@ module Bundler
end
end
- def initialize(index)
+ def initialize(index, source_requirements)
@errors = {}
@stack = []
@index = index
+ @source_requirements = source_requirements
end
def debug
@@ -214,7 +213,7 @@ module Bundler
end
def search(dep)
- index = dep.source ? dep.source.specs : @index
+ index = @source_requirements[dep.name] || @index
index.search(dep)
end
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index c227e3a20c..e3bd28b700 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -2,10 +2,6 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Bundler.setup" do
- before :each do
- in_app_root
- end
-
it "works" do
pending
end