introduce Homebrew/core tap as new default core tap.
It will be auto installed whenever necessary.
This commit is contained in:
parent
91fd357c90
commit
c5132daf63
@ -1,6 +1,4 @@
|
|||||||
require "extend/string"
|
require "extend/string"
|
||||||
require "tap_migrations"
|
|
||||||
require "formula_renames"
|
|
||||||
|
|
||||||
# a {Tap} is used to extend the formulae provided by Homebrew core.
|
# a {Tap} is used to extend the formulae provided by Homebrew core.
|
||||||
# Usually, it's synced with a remote git repository. And it's likely
|
# Usually, it's synced with a remote git repository. And it's likely
|
||||||
@ -447,23 +445,35 @@ class Tap
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# A specialized {Tap} class to mimic the core formula file system, which shares many
|
# A specialized {Tap} class for the core formulae
|
||||||
# similarities with normal {Tap}.
|
|
||||||
# TODO Separate core formulae with core codes. See discussion below for future plan:
|
|
||||||
# https://github.com/Homebrew/homebrew/pull/46735#discussion_r46820565
|
|
||||||
class CoreTap < Tap
|
class CoreTap < Tap
|
||||||
|
if OS.mac?
|
||||||
|
OFFICIAL_REMOTE = "https://github.com/Homebrew/homebrew-core"
|
||||||
|
else
|
||||||
|
OFFICIAL_REMOTE = "https://github.com/Linuxbrew/homebrew-core"
|
||||||
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def initialize
|
def initialize
|
||||||
@user = "Homebrew"
|
super "Homebrew", "core"
|
||||||
@repo = "homebrew"
|
|
||||||
@name = "Homebrew/homebrew"
|
|
||||||
@path = HOMEBREW_REPOSITORY
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.instance
|
def self.instance
|
||||||
@instance ||= CoreTap.new
|
@instance ||= CoreTap.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.ensure_installed!(options = {})
|
||||||
|
return if instance.installed?
|
||||||
|
args = ["tap", instance.name]
|
||||||
|
args << "-q" if options.fetch(:quiet, true)
|
||||||
|
safe_system HOMEBREW_BREW_FILE, *args
|
||||||
|
end
|
||||||
|
|
||||||
|
def install(options = {})
|
||||||
|
options = { :clone_target => OFFICIAL_REMOTE }.merge(options)
|
||||||
|
super options
|
||||||
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def uninstall
|
def uninstall
|
||||||
raise "Tap#uninstall is not available for CoreTap"
|
raise "Tap#uninstall is not available for CoreTap"
|
||||||
@ -484,14 +494,9 @@ class CoreTap < Tap
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
|
||||||
def command_files
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def custom_remote?
|
def custom_remote?
|
||||||
remote != "https://github.com/#{user}/#{repo}.git"
|
remote != OFFICIAL_REMOTE
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
@ -501,22 +506,34 @@ class CoreTap < Tap
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def formula_dir
|
def formula_dir
|
||||||
@formula_dir ||= HOMEBREW_LIBRARY/"Formula"
|
@formula_dir ||= begin
|
||||||
|
self.class.ensure_installed!
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def alias_dir
|
def alias_dir
|
||||||
@alias_dir ||= HOMEBREW_LIBRARY/"Aliases"
|
@alias_dir ||= begin
|
||||||
|
self.class.ensure_installed!
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def formula_renames
|
def formula_renames
|
||||||
FORMULA_RENAMES
|
@formula_renames ||= begin
|
||||||
|
self.class.ensure_installed!
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def tap_migrations
|
def tap_migrations
|
||||||
TAP_MIGRATIONS
|
@tap_migrations ||= begin
|
||||||
|
self.class.ensure_installed!
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user