Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When Bundler is being bundled, bundle the current version of bundler

  • Loading branch information...
commit f1a19680452e3003a78b89ecc011a375c68ab258 1 parent 4117623
@indirect indirect authored
View
11 lib/bundler/resolver.rb
@@ -98,8 +98,15 @@ def resolve(reqs, activated)
debug { "Requirements:\n" + reqs.map { |r| " #{r.name} (#{r.requirement})"}.join("\n") }
activated = activated.dup
- # Pull off the first requirement so that we can resolve it
- current = reqs.shift
+
+ if reqs.first.name == "bundler" && !activated["bundler"]
+ # activate the current version of bundler before other versions
+ bundler_version = ENV["BUNDLER_VERSION"] || Bundler::VERSION
+ current = Gem::Dependency.new("bundler", bundler_version, reqs.first.type)
+ else
+ # Pull off the first requirement so that we can resolve it
+ current = reqs.shift
+ end
debug { "Attempting:\n #{current.name} (#{current.requirement})"}
View
43 spec/install/gems/simple_case_spec.rb
@@ -423,4 +423,47 @@
should_be_installed "rcov 1.0.0"
end
end
+
+ describe "bundler dependencies" do
+ before(:each) do
+ build_repo2 do
+ build_gem "rails", "3.0" do |s|
+ s.add_dependency "bundler", "~>0.9.0"
+ end
+ build_gem "bundler", "0.9.1"
+ build_gem "bundler", Bundler::VERSION
+ end
+ ENV["BUNDLER_VERSION"] = "0.9.1"
+ end
+
+ after(:each) do
+ ENV["BUNDLER_VERSION"] = nil
+ end
+
+ it "are forced to the current bundler version" do
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "rails", "3.0"
+ G
+ should_be_installed "bundler 0.9.1"
+ end
+
+ it "are not added if not already present" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ should_not_be_installed "bundler 0.9.1"
+ end
+
+ it "cause a conflict if explicitly requesting a different version" do
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "rails", "3.0"
+ gem "bundler", "0.9.2"
+ G
+ out.should =~ /conflict on: "bundler"/i
+ end
+ end
+
end
View
4 spec/support/matchers.rb
@@ -20,7 +20,7 @@ def should_be_installed(*names)
groups = opts[:groups] || []
names.each do |name|
name, version = name.split(/\s+/)
- run "require '#{name}'; puts #{Spec::Builders.constantize(name)}", *groups
+ run "load '#{name}.rb'; puts #{Spec::Builders.constantize(name)}", *groups
Gem::Version.new(out).should == Gem::Version.new(version)
end
end
@@ -36,7 +36,7 @@ def should_not_be_installed(*names)
begin
require '#{name}'
puts #{Spec::Builders.constantize(name)}
- rescue LoadError
+ rescue LoadError, NameError
puts "WIN"
end
R
Please sign in to comment.
Something went wrong with that request. Please try again.