diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index 1f8d3871b9..28630befb9 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -9,3 +9,4 @@ require "compat/extend/string" require "compat/gpg" require "compat/dependable" require "compat/os/mac" +require "compat/tap" diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb new file mode 100644 index 0000000000..aa2e2893f5 --- /dev/null +++ b/Library/Homebrew/compat/tap.rb @@ -0,0 +1,18 @@ +module CaskTapMigrationExtension + def parse_user_repo(*args) + user, repo = super + + if user == "caskroom" + user = "Homebrew" + repo = "cask-#{repo}" unless repo == "cask" + end + + [user, repo] + end +end + +class Tap + class << self + prepend CaskTapMigrationExtension + end +end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index bcd205bab8..b34307482e 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -12,7 +12,7 @@ class Tap TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps" - def self.fetch(*args) + def self.parse_user_repo(*args) case args.length when 1 user, repo = args.first.split("/", 2) @@ -29,6 +29,13 @@ class Tap user = user.capitalize if ["homebrew", "linuxbrew"].include? user repo = repo.strip_prefix "homebrew-" + [user, repo] + end + private_class_method :parse_user_repo + + def self.fetch(*args) + user, repo = parse_user_repo(*args) + if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo) return CoreTap.instance end