diff options
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index d17f39ce6..72b4b8f03 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -35,6 +35,7 @@ class AbstractDownloadStrategy def fetch; end def stage; end def cached_location; end + def clear_cache; end end class VCSDownloadStrategy < AbstractDownloadStrategy @@ -63,6 +64,10 @@ class VCSDownloadStrategy < AbstractDownloadStrategy def cached_location @clone end + + def clear_cache + cached_location.rmtree if cached_location.exist? + end end class CurlDownloadStrategy < AbstractDownloadStrategy @@ -86,6 +91,10 @@ class CurlDownloadStrategy < AbstractDownloadStrategy tarball_path end + def clear_cache + [cached_location, temporary_path].each { |f| f.unlink if f.exist? } + end + def downloaded_size temporary_path.size? or 0 end |
