cleanup: fix stale cask detection.

This method is also run to check formulae and if a formula and cask have
the same name (e.g. `cmake`) then this method would mark all formulae
downloads to being stale.

Instead, check the `dirname` (which we're using for globs anyway) to
double check that this is definitely a stale cask.
This commit is contained in:
Mike McQuaid 2019-02-03 15:32:30 +01:00
parent cbf049cc96
commit 6fe75fb154
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -112,6 +112,8 @@ module CleanupRefinement
def stale_cask?(scrub) def stale_cask?(scrub)
return false unless name = basename.to_s[/\A(.*?)\-\-/, 1] return false unless name = basename.to_s[/\A(.*?)\-\-/, 1]
return if dirname.basename.to_s != "Cask"
cask = begin cask = begin
Cask::CaskLoader.load(name) Cask::CaskLoader.load(name)
rescue Cask::CaskUnavailableError rescue Cask::CaskUnavailableError