aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lock
diff options
context:
space:
mode:
authortomhuda <tomhuda@tilde.io>2012-03-07 00:51:31 -0800
committertomhuda <tomhuda@tilde.io>2012-03-07 00:51:31 -0800
commite31a1c7b24d3dfbce7ed39b6a723dd20f7d08c95 (patch)
tree89802ff67e901587aa019ca36c4bdd722c60fe69 /spec/lock
parent6d4962dbad7c620045a02393a5878b29ab11a55b (diff)
downloadbundler-e31a1c7b24d3dfbce7ed39b6a723dd20f7d08c95.tar.gz
Clean up corrupted lockfiles
Bundler 1.1.pre.5 introduced a bug that could introduce duplicate GIT sections, which then caused duplicate copies of gems in the GIT sections. This commit makes the LockfileParser aware of the bug, and has it clean up any corrupted lockfiles.
Diffstat (limited to 'spec/lock')
-rw-r--r--spec/lock/lockfile_spec.rb70
1 files changed, 70 insertions, 0 deletions
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index d920571e..07f61410 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -670,6 +670,76 @@ describe "the lockfile format" do
end
+ # Some versions of the Bundler 1.1 RC series introduced corrupted
+ # lockfiles. There were two major problems:
+ #
+ # * multiple copies of the same GIT section appeared in the lockfile
+ # * when this happened, those sections got multiple copies of gems
+ # in those sections.
+ it "fix corrupted lockfiles" do
+ build_git "omg", :path => lib_path('omg')
+ revision = revision_for(lib_path('omg'))
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "omg", :git => "#{lib_path('omg')}", :branch => 'master'
+ G
+
+ bundle "install --path vendor"
+ should_be_installed "omg 1.0"
+
+ # Create a Gemfile.lock that has duplicate GIT sections
+ lockfile <<-L
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+
+ PLATFORMS
+ #{local}
+
+ DEPENDENCIES
+ omg!
+ L
+
+ FileUtils.rm_rf(bundled_app('vendor'))
+ bundle "install"
+ should_be_installed "omg 1.0"
+
+ # Confirm that duplicate specs do not appear
+ File.read(bundled_app('Gemfile.lock')).should == strip_whitespace(<<-L)
+ GIT
+ remote: #{lib_path('omg')}
+ revision: #{revision}
+ branch: master
+ specs:
+ omg (1.0)
+
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+
+ PLATFORMS
+ #{local}
+
+ DEPENDENCIES
+ omg!
+ L
+ end
+
describe "line endings" do
def set_lockfile_mtime_to_known_value
time = Time.local(2000, 1, 1, 0, 0, 0)