summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-03 13:05:03 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-03 13:05:03 -0800
commitb838b26a9fc27b5490da55ccd279cfac808b7972 (patch)
treec81659de0636fcab776e7fe5d8953ab203b6e364
parent2c972f2aec5599e7900ab1e93caadaf263a043fc (diff)
downloadbundler-b838b26a9fc27b5490da55ccd279cfac808b7972.tar.gz
Fix locking so that pinned dependencies remain pinned
-rw-r--r--bundler.gemspec2
-rw-r--r--lib/bundler/definition.rb6
-rw-r--r--lib/bundler/environment.rb10
-rw-r--r--spec/install/path_spec.rb18
-rw-r--r--spec/support/helpers.rb3
5 files changed, 34 insertions, 5 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index 4ea647a52a..11eb386b7a 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
s.authors = ["Carl Lerche", "Yehuda Katz"]
- s.date = %q{2010-02-02}
+ s.date = %q{2010-02-03}
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 038b46a337..f467977847 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -64,13 +64,15 @@ module Bundler
def actual_dependencies
@actual_dependencies ||= @details["specs"].map do |args|
- Gem::Dependency.new(*args.to_a.flatten)
+ name, details = args.to_a.flatten
+ details["source"] = sources[details["source"]] if details.include?("source")
+ Bundler::Dependency.new(name, details.delete("version"), details)
end
end
def dependencies
@dependencies ||= @details["dependencies"].map do |args|
- Gem::Dependency.new(*args.to_a.flatten)
+ Bundler::Dependency.new(*args.to_a.flatten)
end
end
end
diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb
index b2719b1eed..803e7ddce9 100644
--- a/lib/bundler/environment.rb
+++ b/lib/bundler/environment.rb
@@ -20,7 +20,7 @@ module Bundler
end
def dependencies
- @definition.dependencies
+ @definition.actual_dependencies
end
def lock
@@ -140,7 +140,13 @@ module Bundler
def details
details = {}
details["sources"] = sources.map { |s| { s.class.name.split("::").last => s.options} }
- details["specs"] = specs.map { |s| {s.name => s.version.to_s} }
+
+ details["specs"] = specs.map do |s|
+ options = {"version" => s.version.to_s}
+ options["source"] = sources.index(s.source) if sources.include?(s.source)
+ { s.name => options }
+ end
+
details["dependencies"] = dependencies.map { |d| {d.name => d.version_requirements.to_s} }
details
end
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb
index bffacd7874..d00d008cd8 100644
--- a/spec/install/path_spec.rb
+++ b/spec/install/path_spec.rb
@@ -42,4 +42,22 @@ describe "gemfile install with git sources" do
out.should == 'WIN OVERRIDE'
end
+ describe "when locked" do
+ it "keeps source pinning" do
+ build_lib "foo", "1.0", :path => lib_path('foo')
+ build_lib "omg", "1.0", :path => lib_path('omg')
+ build_lib "foo", "1.0", :path => lib_path('omg/foo') do |s|
+ s.write "lib/foo.rb", "puts 'FAIL'"
+ end
+
+ install_gemfile <<-G
+ gem "foo", :path => "#{lib_path('foo')}"
+ gem "omg", :path => "#{lib_path('omg')}"
+ G
+
+ bundle :lock
+
+ should_be_installed "foo 1.0"
+ end
+ end
end \ No newline at end of file
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 53e712d792..02cc0bef14 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -43,6 +43,9 @@ module Spec
gemfile = File.expand_path('../../../bin/bundle', __FILE__)
@in, @out, @err = Open3.popen3("#{Gem.ruby} -I#{lib} #{gemfile} #{cmd}#{args}")
@err = @err.read.strip
+
+ puts @err unless @err.empty?
+
@out = @out.read.strip
end