summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-07-24 12:12:57 -0700
committerCarl Lerche <carllerche@mac.com>2010-07-24 12:12:57 -0700
commitf64c6dac2503db5a0acb4e4a532c9c32b224eb67 (patch)
treec7edca0edacadae5d2d8dd09a7ed76df4ed2c2b4
parentdac471bdbe1442fa6aa5b6bed76bbb2b054631c3 (diff)
downloadbundler-f64c6dac2503db5a0acb4e4a532c9c32b224eb67.tar.gz
Fixes a bug where cached gems for other platforms were being removed when running `bundle update`
-rw-r--r--lib/bundler/definition.rb16
-rw-r--r--spec/cache/platform_spec.rb13
2 files changed, 23 insertions, 6 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index e9e7291df6..0127365a03 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -38,13 +38,21 @@ module Bundler
@specs = nil
@lockfile_contents = ""
- if lockfile && File.exists?(lockfile) && unlock != true
+ if lockfile && File.exists?(lockfile)
@lockfile_contents = File.read(lockfile)
locked = LockfileParser.new(@lockfile_contents)
@platforms = locked.platforms
- @locked_deps = locked.dependencies
- @last_resolve = SpecSet.new(locked.specs)
- @locked_sources = locked.sources
+
+ if unlock != true
+ @locked_deps = locked.dependencies
+ @last_resolve = SpecSet.new(locked.specs)
+ @locked_sources = locked.sources
+ else
+ @unlock = {}
+ @locked_deps = []
+ @last_resolve = SpecSet.new([])
+ @locked_sources = []
+ end
else
@unlock = {}
@platforms = []
diff --git a/spec/cache/platform_spec.rb b/spec/cache/platform_spec.rb
index 9e3f357060..7c9ec72867 100644
--- a/spec/cache/platform_spec.rb
+++ b/spec/cache/platform_spec.rb
@@ -35,14 +35,23 @@ describe "bundle cache with multiple platforms" do
activesupport (2.3.5)
activerecord (2.3.2)
G
- end
- it "does not delete gems for other platforms" do
cache_gems "rack-1.0.0", "activesupport-2.3.5", "activerecord-2.3.2"
+ end
+
+ it "ensures that bundle install does not delete gems for other platforms" do
bundle "install"
bundled_app("vendor/cache/rack-1.0.0.gem").should exist
bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist
bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist
end
+
+ it "ensures that bundle update does not delete gems for other platforms" do
+ bundle "update"
+
+ bundled_app("vendor/cache/rack-1.0.0.gem").should exist
+ bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist
+ bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist
+ end
end