diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-07-17 10:22:12 +0200 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-07-17 10:22:12 +0200 |
commit | 1bd97f3c13c6a7d92d6b8eb62d8644400a06d21a (patch) | |
tree | 64858cf4540d99e38dbc00816d4354ff96b84723 /lib/bundler/source.rb | |
parent | 51aaf18a0e2d8a76a44f789d0e31b4d2ce123024 (diff) | |
download | bundler-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 'lib/bundler/source.rb')
-rw-r--r-- | lib/bundler/source.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index e4117dd1..4f2ce4e7 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -374,6 +374,7 @@ module Bundler return if @original_path.expand_path(Bundler.root).to_s.index(Bundler.root.to_s) == 0 FileUtils.rm_rf(app_cache_path) FileUtils.cp_r("#{@original_path}/.", app_cache_path) + FileUtils.touch(app_cache_path.join(".bundlecache")) end def local_specs(*) @@ -387,10 +388,14 @@ module Bundler local_specs end + def app_cache_dirname + name + end + private def app_cache_path - @app_cache_path ||= Bundler.app_cache.join(name) + @app_cache_path ||= Bundler.app_cache.join(app_cache_dirname) end def has_app_cache? @@ -787,6 +792,7 @@ module Bundler git_proxy.checkout if requires_checkout? git_proxy.copy_to(app_cache_path, @submodules) FileUtils.rm_rf(app_cache_path.join(".git")) + FileUtils.touch(app_cache_path.join(".bundlecache")) end def load_spec_files @@ -811,6 +817,10 @@ module Bundler end end + def app_cache_dirname + "#{base_name}-#{shortref_for_path(cached_revision || revision)}" + end + private def set_local!(path) @@ -823,10 +833,6 @@ module Bundler cached_revision && super end - def app_cache_path - @app_cache_path ||= Bundler.app_cache.join("#{base_name}-#{shortref_for_path(cached_revision || revision)}") - end - def local? @local end |