diff --git a/Library/Homebrew/api/bottle.rb b/Library/Homebrew/api/bottle.rb index c472ca55d6..f7327bdf10 100644 --- a/Library/Homebrew/api/bottle.rb +++ b/Library/Homebrew/api/bottle.rb @@ -22,6 +22,7 @@ module Homebrew sig { params(name: String).returns(Hash) } def fetch(name) + name = name.sub(%r{^homebrew/core/}, "") Homebrew::API.fetch "#{bottle_api_path}/#{name}.json" end @@ -85,7 +86,9 @@ module Homebrew # 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`. - 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 diff --git a/Library/Homebrew/api/cask-source.rb b/Library/Homebrew/api/cask-source.rb index 86e380e252..0c1cd67a21 100644 --- a/Library/Homebrew/api/cask-source.rb +++ b/Library/Homebrew/api/cask-source.rb @@ -12,6 +12,7 @@ module Homebrew sig { params(token: String).returns(Hash) } def fetch(token) + token = token.sub(%r{^homebrew/cask/}, "") Homebrew::API.fetch "cask-source/#{token}.rb", json: false end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 95fceb3060..0b4f433b1d 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -138,11 +138,12 @@ module Homebrew end args.named.each do |name| - next if EnvConfig.install_from_api? 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)) + next if (tap.core_tap? || tap == "homebrew/cask") && EnvConfig.install_from_api? + tap.install unless tap.installed? end