aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDov Murik <dov.murik@gmail.com>2014-10-06 01:10:01 -0400
committerAndre Arko <andre@arko.net>2014-10-19 23:18:32 -0700
commit1eb62f21d24e32029d5df1a279cecd957764f827 (patch)
treec3aef8a1d2103882f59e1dfd2a37c109dcc0af78
parent1334606435a6caf6aede845044c775e0339d386c (diff)
downloadbundler-1eb62f21d24e32029d5df1a279cecd957764f827.tar.gz
Remove satisfied dependecies from next source lookup
When iterating sources and checking for met dependencies, remove the actual specs that were satisified by the source from the lookup of following sources. This prevents lookup of local gems (from `gemspec` or `path` or `git` sources) in rubygems source. fixes #2909
-rw-r--r--lib/bundler/definition.rb1
-rw-r--r--spec/install/gemfile/path_spec.rb20
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index e5b6b243..eccc655e 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -203,6 +203,7 @@ module Bundler
sources.all_sources.each do |s|
s.dependency_names = dependency_names
idx.add_source s.specs
+ s.specs.each { |spec| dependency_names.delete(spec.name) }
dependency_names.push(*s.unmet_deps).uniq!
end
end
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index f36f3838..f88b6aa2 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -415,6 +415,26 @@ describe "bundle install with explicit source paths" do
end
end
+ describe "when there are both a gemspec and remote gems" do
+ it "doesn't query rubygems for local gemspec name" do
+ build_lib "private_lib", "2.2", :path => lib_path("private_lib")
+ gemfile = <<-G
+ source "http://localgemserver.test"
+ gemspec
+ gem 'rack'
+ G
+ File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile }
+
+ Dir.chdir(lib_path("private_lib")) do
+ bundle :install, :env => {"DEBUG" => 1}, :artifice => "endpoint"
+ expect(out).to match(/^HTTP GET http:\/\/localgemserver\.test\/api\/v1\/dependencies\?gems=rack$/)
+ expect(out).not_to match(/^HTTP GET.*private_lib/)
+ should_be_installed "private_lib 2.2"
+ should_be_installed "rack 1.0"
+ end
+ end
+ end
+
describe "gem install hooks" do
it "runs pre-install hooks" do
build_git "foo"