Tap: add untapped_official_taps method
This commit is contained in:
parent
3ca68c076e
commit
ebba369887
@ -132,8 +132,7 @@ begin
|
||||
possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
|
||||
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
||||
|
||||
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
|
||||
if !possible_tap || possible_tap.installed? || untapped_official_taps.include?(possible_tap.name)
|
||||
if !possible_tap || possible_tap.installed? || Tap.untapped_official_taps.include?(possible_tap.name)
|
||||
odie "Unknown command: #{cmd}"
|
||||
end
|
||||
|
||||
|
||||
@ -5,8 +5,7 @@ class Tap
|
||||
def self.install_default_cask_tap_if_necessary
|
||||
return false if default_cask_tap.installed?
|
||||
|
||||
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
|
||||
return false if untapped_official_taps.include?(default_cask_tap.name)
|
||||
return false if Tap.untapped_official_taps.include?(default_cask_tap.name)
|
||||
|
||||
default_cask_tap.install
|
||||
true
|
||||
|
||||
@ -327,7 +327,7 @@ class Tap
|
||||
end
|
||||
|
||||
if official?
|
||||
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
|
||||
untapped = self.class.untapped_official_taps
|
||||
untapped -= [name]
|
||||
|
||||
if untapped.empty?
|
||||
@ -388,8 +388,7 @@ class Tap
|
||||
|
||||
return unless official?
|
||||
|
||||
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
|
||||
|
||||
untapped = self.class.untapped_official_taps
|
||||
return if untapped.include? name
|
||||
|
||||
untapped << name
|
||||
@ -644,6 +643,12 @@ class Tap
|
||||
Pathname.glob TAP_DIRECTORY/"*/*/cmd"
|
||||
end
|
||||
|
||||
# An array of official taps that have been manually untapped
|
||||
sig { returns(T::Array[String]) }
|
||||
def self.untapped_official_taps
|
||||
Homebrew::Settings.read(:untapped)&.split(";") || []
|
||||
end
|
||||
|
||||
# @private
|
||||
def formula_file_to_name(file)
|
||||
"#{name}/#{file.basename(".rb")}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user