Remove legacy cask cache instead of migrating.
This commit is contained in:
parent
3be56aee71
commit
f7c6fc058f
@ -46,7 +46,7 @@ module Hbc
|
|||||||
|
|
||||||
def self.init
|
def self.init
|
||||||
Cache.ensure_cache_exists
|
Cache.ensure_cache_exists
|
||||||
Cache.migrate_legacy_cache
|
Cache.delete_legacy_cache
|
||||||
|
|
||||||
Caskroom.migrate_caskroom_from_repo_to_prefix
|
Caskroom.migrate_caskroom_from_repo_to_prefix
|
||||||
Caskroom.ensure_caskroom_exists
|
Caskroom.ensure_caskroom_exists
|
||||||
|
|||||||
@ -9,27 +9,10 @@ module Hbc
|
|||||||
Hbc.cache.mkpath
|
Hbc.cache.mkpath
|
||||||
end
|
end
|
||||||
|
|
||||||
def migrate_legacy_cache
|
def delete_legacy_cache
|
||||||
return unless Hbc.legacy_cache.exist?
|
return unless Hbc.legacy_cache.exist?
|
||||||
|
|
||||||
ohai "Migrating cached files to #{Hbc.cache}..."
|
ohai "Deleting legacy cache at #{Hbc.legacy_cache}..."
|
||||||
Hbc.legacy_cache.children.select(&:symlink?).each do |symlink|
|
|
||||||
file = symlink.readlink
|
|
||||||
|
|
||||||
new_name = file.basename
|
|
||||||
.sub(/\-((?:(\d|#{DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$/x,
|
|
||||||
'--\1')
|
|
||||||
|
|
||||||
renamed_file = Hbc.cache.join(new_name)
|
|
||||||
|
|
||||||
if file.exist?
|
|
||||||
puts "#{file} -> #{renamed_file}"
|
|
||||||
FileUtils.mv(file, renamed_file)
|
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.rm(symlink)
|
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.remove_entry_secure(Hbc.legacy_cache)
|
FileUtils.remove_entry_secure(Hbc.legacy_cache)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user