aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2014-12-23 01:04:44 -0500
committerJack Nagel2014-12-23 01:11:08 -0500
commit7ca187f62a00ba5368a9e595dbe843e405a761e4 (patch)
tree1e2fc4887e3643df513456a4aa33280c7a5e1289 /Library/Homebrew
parent93516a994b8a3953f49c7a2ae5f450c6a0868fe4 (diff)
downloadhomebrew-7ca187f62a00ba5368a9e595dbe843e405a761e4.tar.bz2
Avoid check-then-act pattern in clear_cache
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/download_strategy.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 1ca262e78..793a59da6 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -28,6 +28,7 @@ class AbstractDownloadStrategy
# Remove {#cached_location} and any other files associated with the resource
# from the cache.
def clear_cache
+ rm_rf(cached_location)
end
def expand_safe_system_args args
@@ -127,10 +128,6 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
@clone
end
- def clear_cache
- cached_location.rmtree if cached_location.exist?
- end
-
def head?
version.head?
end
@@ -240,7 +237,8 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
end
def clear_cache
- [cached_location, temporary_path].each { |f| f.unlink if f.exist? }
+ super
+ rm_rf(temporary_path)
end
private