Merge env variables into HOMEBREW_JSON_CORE
This commit is contained in:
parent
1d516b628b
commit
60203afdd5
@ -25,7 +25,7 @@ module Homebrew
|
|||||||
args = untap_args.parse
|
args = untap_args.parse
|
||||||
|
|
||||||
args.named.to_installed_taps.each do |tap|
|
args.named.to_installed_taps.each do |tap|
|
||||||
odie "Untapping #{tap} is not allowed" if tap.core_tap? && ENV["HOMEBREW_UNTAP_HOMEBREW_CORE"].blank?
|
odie "Untapping #{tap} is not allowed" if tap.core_tap? && ENV["HOMEBREW_JSON_CORE"].blank?
|
||||||
|
|
||||||
installed_tap_formulae = Formula.installed.select { |formula| formula.tap == tap }
|
installed_tap_formulae = Formula.installed.select { |formula| formula.tap == tap }
|
||||||
installed_tap_casks = Cask::Caskroom.casks.select { |cask| cask.tap == tap }
|
installed_tap_casks = Cask::Caskroom.casks.select { |cask| cask.tap == tap }
|
||||||
|
|||||||
@ -207,7 +207,7 @@ module Homebrew
|
|||||||
|
|
||||||
def install_core_tap_if_necessary
|
def install_core_tap_if_necessary
|
||||||
return if ENV["HOMEBREW_UPDATE_TEST"]
|
return if ENV["HOMEBREW_UPDATE_TEST"]
|
||||||
return if ENV["HOMEBREW_UNTAP_HOMEBREW_CORE"].present?
|
return if ENV["HOMEBREW_JSON_CORE"].present?
|
||||||
|
|
||||||
core_tap = CoreTap.instance
|
core_tap = CoreTap.instance
|
||||||
return if core_tap.installed?
|
return if core_tap.installed?
|
||||||
|
|||||||
@ -361,7 +361,7 @@ module Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_formula(*)
|
def get_formula(*)
|
||||||
if !CoreTap.instance.installed? && ENV["HOMEBREW_UNTAP_HOMEBREW_CORE"].present?
|
if !CoreTap.instance.installed? && ENV["HOMEBREW_JSON_CORE"].present?
|
||||||
raise CoreTapFormulaUnavailableError, name
|
raise CoreTapFormulaUnavailableError, name
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ module Formulary
|
|||||||
)
|
)
|
||||||
raise ArgumentError, "Formulae must have a ref!" unless ref
|
raise ArgumentError, "Formulae must have a ref!" unless ref
|
||||||
|
|
||||||
if ENV["HOMEBREW_BOTTLE_JSON"].present? &&
|
if ENV["HOMEBREW_JSON_CORE"].present? &&
|
||||||
@formula_name_local_bottle_path_map.present? &&
|
@formula_name_local_bottle_path_map.present? &&
|
||||||
@formula_name_local_bottle_path_map.key?(ref)
|
@formula_name_local_bottle_path_map.key?(ref)
|
||||||
ref = @formula_name_local_bottle_path_map[ref]
|
ref = @formula_name_local_bottle_path_map[ref]
|
||||||
@ -431,8 +431,8 @@ module Formulary
|
|||||||
# @param formula_name the formula name string to map.
|
# @param formula_name the formula name string to map.
|
||||||
# @param local_bottle_path a path pointing to the target bottle archive.
|
# @param local_bottle_path a path pointing to the target bottle archive.
|
||||||
def self.map_formula_name_to_local_bottle_path(formula_name, local_bottle_path)
|
def self.map_formula_name_to_local_bottle_path(formula_name, local_bottle_path)
|
||||||
if ENV["HOMEBREW_BOTTLE_JSON"].blank?
|
if ENV["HOMEBREW_JSON_CORE"].blank?
|
||||||
raise UsageError, "HOMEBREW_BOTTLE_JSON not set but required for #{__method__}!"
|
raise UsageError, "HOMEBREW_JSON_CORE not set but required for #{__method__}!"
|
||||||
end
|
end
|
||||||
|
|
||||||
@formula_name_local_bottle_path_map ||= {}
|
@formula_name_local_bottle_path_map ||= {}
|
||||||
|
|||||||
@ -734,7 +734,7 @@ class CoreTap < Tap
|
|||||||
|
|
||||||
def self.ensure_installed!
|
def self.ensure_installed!
|
||||||
return if instance.installed?
|
return if instance.installed?
|
||||||
return if ENV["HOMEBREW_UNTAP_HOMEBREW_CORE"].present?
|
return if ENV["HOMEBREW_JSON_CORE"].present?
|
||||||
|
|
||||||
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
||||||
end
|
end
|
||||||
@ -751,7 +751,7 @@ class CoreTap < Tap
|
|||||||
# @private
|
# @private
|
||||||
sig { params(manual: T::Boolean).void }
|
sig { params(manual: T::Boolean).void }
|
||||||
def uninstall(manual: false)
|
def uninstall(manual: false)
|
||||||
raise "Tap#uninstall is not available for CoreTap" if ENV["HOMEBREW_UNTAP_HOMEBREW_CORE"].blank?
|
raise "Tap#uninstall is not available for CoreTap" if ENV["HOMEBREW_JSON_CORE"].blank?
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|||||||
@ -216,12 +216,12 @@ describe Formulary do
|
|||||||
described_class.factory("formula-to-map")
|
described_class.factory("formula-to-map")
|
||||||
}.to raise_error(FormulaUnavailableError)
|
}.to raise_error(FormulaUnavailableError)
|
||||||
|
|
||||||
ENV["HOMEBREW_BOTTLE_JSON"] = nil
|
ENV["HOMEBREW_JSON_CORE"] = nil
|
||||||
expect {
|
expect {
|
||||||
described_class.map_formula_name_to_local_bottle_path "formula-to-map", formula_path
|
described_class.map_formula_name_to_local_bottle_path "formula-to-map", formula_path
|
||||||
}.to raise_error(UsageError, /HOMEBREW_BOTTLE_JSON not set/)
|
}.to raise_error(UsageError, /HOMEBREW_JSON_CORE not set/)
|
||||||
|
|
||||||
ENV["HOMEBREW_BOTTLE_JSON"] = "1"
|
ENV["HOMEBREW_JSON_CORE"] = "1"
|
||||||
described_class.map_formula_name_to_local_bottle_path "formula-to-map", formula_path
|
described_class.map_formula_name_to_local_bottle_path "formula-to-map", formula_path
|
||||||
|
|
||||||
expect(described_class.factory("formula-to-map")).to be_kind_of(Formula)
|
expect(described_class.factory("formula-to-map")).to be_kind_of(Formula)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user