summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-07-17 10:22:12 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2012-07-17 10:22:12 +0200
commit1bd97f3c13c6a7d92d6b8eb62d8644400a06d21a (patch)
tree64858cf4540d99e38dbc00816d4354ff96b84723 /spec
parent51aaf18a0e2d8a76a44f789d0e31b4d2ce123024 (diff)
downloadbundler-1bd97f3c13c6a7d92d6b8eb62d8644400a06d21a.tar.gz
Prune git and path directories inside vendor/cache, closes #1988
From this commit on, we add a .bundlecache file inside each git/path directory in vendor/cache so we know it came from bundler. This allow us to delete those specific directories without messing with user's specific ones.
Diffstat (limited to 'spec')
-rw-r--r--spec/cache/git_spec.rb2
-rw-r--r--spec/cache/path_spec.rb18
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb
index 219d191387..6958bc3893 100644
--- a/spec/cache/git_spec.rb
+++ b/spec/cache/git_spec.rb
@@ -25,6 +25,7 @@ end
bundle "#{cmd} --all"
bundled_app("vendor/cache/foo-1.0-#{ref}").should exist
bundled_app("vendor/cache/foo-1.0-#{ref}/.git").should_not exist
+ bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache").should be_file
FileUtils.rm_rf lib_path("foo-1.0")
should_be_installed "foo 1.0"
@@ -84,6 +85,7 @@ end
bundle "#{cmd} --all"
bundled_app("vendor/cache/foo-1.0-#{ref}").should exist
+ bundled_app("vendor/cache/foo-1.0-#{old_ref}").should_not exist
FileUtils.rm_rf lib_path("foo-1.0")
run "require 'foo'"
diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb
index a50e5d9331..94c451819a 100644
--- a/spec/cache/path_spec.rb
+++ b/spec/cache/path_spec.rb
@@ -23,6 +23,7 @@ require "spec_helper"
bundle "#{cmd} --all"
bundled_app("vendor/cache/foo-1.0").should exist
+ bundled_app("vendor/cache/foo-1.0/.bundlecache").should be_file
FileUtils.rm_rf lib_path("foo-1.0")
should_be_installed "foo 1.0"
@@ -50,6 +51,23 @@ require "spec_helper"
out.should == "CACHE"
end
+ it "removes stale entries cache" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+
+ install_gemfile <<-G
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+ bundled_app("vendor/cache/bar-1.0").should_not exist
+ end
+
it "raises a warning without --all" do
build_lib "foo"