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 = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
|
||||||
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
|
||||||
|
|
||||||
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
|
if !possible_tap || possible_tap.installed? || Tap.untapped_official_taps.include?(possible_tap.name)
|
||||||
if !possible_tap || possible_tap.installed? || untapped_official_taps.include?(possible_tap.name)
|
|
||||||
odie "Unknown command: #{cmd}"
|
odie "Unknown command: #{cmd}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,7 @@ class Tap
|
|||||||
def self.install_default_cask_tap_if_necessary
|
def self.install_default_cask_tap_if_necessary
|
||||||
return false if default_cask_tap.installed?
|
return false if default_cask_tap.installed?
|
||||||
|
|
||||||
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
|
return false if Tap.untapped_official_taps.include?(default_cask_tap.name)
|
||||||
return false if untapped_official_taps.include?(default_cask_tap.name)
|
|
||||||
|
|
||||||
default_cask_tap.install
|
default_cask_tap.install
|
||||||
true
|
true
|
||||||
|
|||||||
@ -327,7 +327,7 @@ class Tap
|
|||||||
end
|
end
|
||||||
|
|
||||||
if official?
|
if official?
|
||||||
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
|
untapped = self.class.untapped_official_taps
|
||||||
untapped -= [name]
|
untapped -= [name]
|
||||||
|
|
||||||
if untapped.empty?
|
if untapped.empty?
|
||||||
@ -388,8 +388,7 @@ class Tap
|
|||||||
|
|
||||||
return unless official?
|
return unless official?
|
||||||
|
|
||||||
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
|
untapped = self.class.untapped_official_taps
|
||||||
|
|
||||||
return if untapped.include? name
|
return if untapped.include? name
|
||||||
|
|
||||||
untapped << name
|
untapped << name
|
||||||
@ -644,6 +643,12 @@ class Tap
|
|||||||
Pathname.glob TAP_DIRECTORY/"*/*/cmd"
|
Pathname.glob TAP_DIRECTORY/"*/*/cmd"
|
||||||
end
|
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
|
# @private
|
||||||
def formula_file_to_name(file)
|
def formula_file_to_name(file)
|
||||||
"#{name}/#{file.basename(".rb")}"
|
"#{name}/#{file.basename(".rb")}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user