Skip to content
Snippets Groups Projects
Commit e22610ae authored by Markus Reiter's avatar Markus Reiter Committed by GitHub
Browse files

Merge pull request #1025 from reitermarkus/migrate-caskroom

Make `HOMEBREW_PREFIX/Caskroom` the default.
parents 3ffb9a2f c0cc7035
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ module Hbc
Hbc::Cache.ensure_cache_exists
Hbc::Cache.migrate_legacy_cache
Hbc::Caskroom.migrate_caskroom_from_repo_to_prefix
Hbc::Caskroom.ensure_caskroom_exists
end
......
module Hbc::Caskroom
module_function
def migrate_caskroom_from_repo_to_prefix
repo_caskroom = Hbc.homebrew_repository.join("Caskroom")
if !Hbc.caskroom.exist? && repo_caskroom.directory?
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
FileUtils.mv repo_caskroom, Hbc.caskroom
end
end
def ensure_caskroom_exists
unless Hbc.caskroom.exist?
ohai "Creating Caskroom at #{Hbc.caskroom}"
......
......@@ -79,4 +79,8 @@ class Hbc::CLI::List < Hbc::CLI::Base
def self.help
"with no args, lists installed Casks; given installed Casks, lists staged files"
end
def self.needs_init?
true
end
end
......@@ -9,7 +9,7 @@ module Hbc::Locations
end
def default_caskroom
@default_caskroom ||= homebrew_repository.join("Caskroom")
@default_caskroom ||= homebrew_prefix.join("Caskroom")
end
def caskroom
......
......@@ -231,12 +231,8 @@ module Homebrew
FileUtils.cp_r "#{HOMEBREW_REPOSITORY}/Library/Taps", "#{new_homebrew_repository}/Library/Taps"
end
if (HOMEBREW_REPOSITORY/"Caskroom").exist?
FileUtils.cp_r "#{HOMEBREW_REPOSITORY}/Caskroom", "#{new_homebrew_repository}/Caskroom"
end
unremovable_paths = []
extra_remove_paths = [".git", "Library/Locks", "Library/Taps", "Caskroom",
extra_remove_paths = [".git", "Library/Locks", "Library/Taps",
"Library/Homebrew/cask", "Library/Homebrew/test"]
(repo_files + extra_remove_paths).each do |file|
path = Pathname.new "#{HOMEBREW_REPOSITORY}/#{file}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment