Merge pull request #12340 from Rylan12/install-from-api-tap-names
Fix installing from API with tap names
This commit is contained in:
		
						commit
						241dd2ce22
					
				| @ -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 | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
|  | ||||
| @ -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 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Mike McQuaid
						Mike McQuaid