mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix installing from API with tap names
This commit is contained in:
parent
c6913dc70a
commit
9fee68c500
@ -22,6 +22,7 @@ module Homebrew
|
|||||||
|
|
||||||
sig { params(name: String).returns(Hash) }
|
sig { params(name: String).returns(Hash) }
|
||||||
def fetch(name)
|
def fetch(name)
|
||||||
|
name = name.sub(%r{^homebrew/core/}, "")
|
||||||
Homebrew::API.fetch "#{bottle_api_path}/#{name}.json"
|
Homebrew::API.fetch "#{bottle_api_path}/#{name}.json"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,7 +86,9 @@ module Homebrew
|
|||||||
|
|
||||||
# Map the name of this formula to the local bottle path to allow the
|
# Map the name of this formula to the local bottle path to allow the
|
||||||
# formula to be loaded by passing just the name to `Formulary::factory`.
|
# formula to be loaded by passing just the name to `Formulary::factory`.
|
||||||
Formulary.map_formula_name_to_local_bottle_path hash["name"], resource.downloader.cached_location
|
[hash["name"], "homebrew/core/#{hash["name"]}"].each do |name|
|
||||||
|
Formulary.map_formula_name_to_local_bottle_path name, resource.downloader.cached_location
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,6 +12,7 @@ module Homebrew
|
|||||||
|
|
||||||
sig { params(token: String).returns(Hash) }
|
sig { params(token: String).returns(Hash) }
|
||||||
def fetch(token)
|
def fetch(token)
|
||||||
|
token = token.sub(%r{^homebrew/cask/}, "")
|
||||||
Homebrew::API.fetch "cask-source/#{token}.rb", json: false
|
Homebrew::API.fetch "cask-source/#{token}.rb", json: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,11 +138,12 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
args.named.each do |name|
|
args.named.each do |name|
|
||||||
next if EnvConfig.install_from_api?
|
|
||||||
next if File.exist?(name)
|
next if File.exist?(name)
|
||||||
next if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
|
next unless name =~ HOMEBREW_TAP_FORMULA_REGEX
|
||||||
|
|
||||||
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
|
tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
|
||||||
|
next if (tap.core_tap? || tap == "homebrew/cask") && EnvConfig.install_from_api?
|
||||||
|
|
||||||
tap.install unless tap.installed?
|
tap.install unless tap.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user