Add compatibility layer to convert caskroom/*
to homebrew/cask(-*)
.
This commit is contained in:
parent
5e773353fa
commit
ff8d14fe2a
@ -9,3 +9,4 @@ require "compat/extend/string"
|
|||||||
require "compat/gpg"
|
require "compat/gpg"
|
||||||
require "compat/dependable"
|
require "compat/dependable"
|
||||||
require "compat/os/mac"
|
require "compat/os/mac"
|
||||||
|
require "compat/tap"
|
||||||
|
18
Library/Homebrew/compat/tap.rb
Normal file
18
Library/Homebrew/compat/tap.rb
Normal file
@ -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
|
@ -12,7 +12,7 @@ class Tap
|
|||||||
|
|
||||||
TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps"
|
TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps"
|
||||||
|
|
||||||
def self.fetch(*args)
|
def self.parse_user_repo(*args)
|
||||||
case args.length
|
case args.length
|
||||||
when 1
|
when 1
|
||||||
user, repo = args.first.split("/", 2)
|
user, repo = args.first.split("/", 2)
|
||||||
@ -29,6 +29,13 @@ class Tap
|
|||||||
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
||||||
repo = repo.strip_prefix "homebrew-"
|
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)
|
if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
||||||
return CoreTap.instance
|
return CoreTap.instance
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user