| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: false | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 14:23:33 +02:00
										 |  |  | require "English" | 
					
						
							| 
									
										
										
										
											2018-08-17 22:42:37 -04:00
										 |  |  | require "json" | 
					
						
							|  |  |  | require "json/add/exception" | 
					
						
							| 
									
										
										
										
											2018-09-02 23:30:07 +02:00
										 |  |  | require "pathname" | 
					
						
							|  |  |  | require "ostruct" | 
					
						
							|  |  |  | require "pp" | 
					
						
							| 
									
										
										
										
											2020-08-18 00:23:23 +01:00
										 |  |  | require "forwardable" | 
					
						
							| 
									
										
										
										
											2018-07-17 14:23:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-29 21:23:44 +01:00
										 |  |  | require "rbconfig" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | RUBY_PATH = Pathname.new(RbConfig.ruby).freeze | 
					
						
							|  |  |  | RUBY_BIN = RUBY_PATH.dirname.freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-02 23:30:07 +02:00
										 |  |  | require_relative "load_path" | 
					
						
							| 
									
										
										
										
											2018-07-17 14:23:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 10:36:40 +00:00
										 |  |  | require "rubygems" | 
					
						
							| 
									
										
										
										
											2020-08-11 12:33:51 +01:00
										 |  |  | # Only require "core_ext" here to ensure we're only requiring the minimum of | 
					
						
							|  |  |  | # what we need. | 
					
						
							| 
									
										
										
										
											2018-09-17 22:02:00 +02:00
										 |  |  | require "active_support/core_ext/object/blank" | 
					
						
							| 
									
										
										
										
											2018-09-17 04:11:09 +02:00
										 |  |  | require "active_support/core_ext/numeric/time" | 
					
						
							| 
									
										
										
										
											2020-08-11 12:33:51 +01:00
										 |  |  | require "active_support/core_ext/object/try" | 
					
						
							| 
									
										
										
										
											2018-09-17 19:30:00 +02:00
										 |  |  | require "active_support/core_ext/array/access" | 
					
						
							| 
									
										
										
										
											2020-08-11 12:33:51 +01:00
										 |  |  | require "active_support/core_ext/string/inflections" | 
					
						
							|  |  |  | require "active_support/core_ext/array/conversions" | 
					
						
							| 
									
										
										
										
											2020-09-01 14:05:52 +01:00
										 |  |  | require "active_support/core_ext/hash/deep_merge" | 
					
						
							|  |  |  | require "active_support/core_ext/file/atomic" | 
					
						
							| 
									
										
										
										
											2020-11-30 16:27:47 +00:00
										 |  |  | require "active_support/core_ext/enumerable" | 
					
						
							|  |  |  | require "active_support/core_ext/string/exclude" | 
					
						
							| 
									
										
										
										
											2020-12-21 16:17:39 -08:00
										 |  |  | require "active_support/core_ext/string/indent" | 
					
						
							| 
									
										
										
										
											2018-09-17 20:11:11 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | I18n.backend.available_locales # Initialize locales so they can be overwritten. | 
					
						
							|  |  |  | I18n.backend.store_translations :en, support: { array: { last_word_connector: " and " } } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ActiveSupport::Inflector.inflections(:en) do |inflect| | 
					
						
							|  |  |  |   inflect.irregular "formula", "formulae" | 
					
						
							|  |  |  |   inflect.irregular "is", "are" | 
					
						
							|  |  |  |   inflect.irregular "it", "they" | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-09 12:11:23 +02:00
										 |  |  | require "utils/sorbet" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-05 15:44:50 +01:00
										 |  |  | HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"] | 
					
						
							|  |  |  | HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_BREW_DEFAULT_GIT_REMOTE"] | 
					
						
							|  |  |  | HOMEBREW_CORE_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_CORE_DEFAULT_GIT_REMOTE"] | 
					
						
							|  |  |  | HOMEBREW_DEFAULT_CACHE = ENV["HOMEBREW_DEFAULT_CACHE"] | 
					
						
							|  |  |  | HOMEBREW_DEFAULT_LOGS = ENV["HOMEBREW_DEFAULT_LOGS"] | 
					
						
							|  |  |  | HOMEBREW_DEFAULT_TEMP = ENV["HOMEBREW_DEFAULT_TEMP"] | 
					
						
							| 
									
										
										
										
											2020-09-03 09:43:41 +01:00
										 |  |  | HOMEBREW_REQUIRED_RUBY_VERSION = ENV["HOMEBREW_REQUIRED_RUBY_VERSION"] | 
					
						
							| 
									
										
										
										
											2018-07-23 23:04:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-12 11:02:22 +01:00
										 |  |  | HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] | 
					
						
							| 
									
										
										
										
											2016-03-10 13:41:02 +00:00
										 |  |  | HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"] | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | HOMEBREW_WWW = "https://brew.sh" | 
					
						
							| 
									
										
										
										
											2009-10-15 12:36:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 11:46:33 +01:00
										 |  |  | HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] | 
					
						
							| 
									
										
										
										
											2018-09-02 16:15:09 +01:00
										 |  |  | HOMEBREW_USER_AGENT_RUBY = | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |   "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" | 
					
						
							| 
									
										
										
										
											2018-09-02 16:15:09 +01:00
										 |  |  | HOMEBREW_USER_AGENT_FAKE_SAFARI = | 
					
						
							|  |  |  |   "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \ | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |   "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8" | 
					
						
							| 
									
										
										
										
											2009-11-05 21:37:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-30 16:09:03 +02:00
										 |  |  | HOMEBREW_DEFAULT_PREFIX = "/usr/local" | 
					
						
							| 
									
										
										
										
											2020-12-09 13:53:10 +00:00
										 |  |  | HOMEBREW_DEFAULT_REPOSITORY = "#{HOMEBREW_DEFAULT_PREFIX}/Homebrew" | 
					
						
							| 
									
										
										
										
											2020-11-12 17:06:47 +00:00
										 |  |  | HOMEBREW_MACOS_ARM_DEFAULT_PREFIX = "/opt/homebrew" | 
					
						
							| 
									
										
										
										
											2020-12-09 13:53:10 +00:00
										 |  |  | HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY = HOMEBREW_MACOS_ARM_DEFAULT_PREFIX | 
					
						
							| 
									
										
										
										
											2020-11-12 17:06:47 +00:00
										 |  |  | HOMEBREW_LINUX_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew" | 
					
						
							| 
									
										
										
										
											2020-12-09 13:53:10 +00:00
										 |  |  | HOMEBREW_LINUX_DEFAULT_REPOSITORY = "#{HOMEBREW_LINUX_DEFAULT_PREFIX}/Homebrew" | 
					
						
							| 
									
										
										
										
											2019-09-30 16:09:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-29 21:23:44 +01:00
										 |  |  | HOMEBREW_PULL_API_REGEX = | 
					
						
							|  |  |  |   %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze | 
					
						
							|  |  |  | HOMEBREW_PULL_OR_COMMIT_URL_REGEX = | 
					
						
							|  |  |  |   %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze | 
					
						
							|  |  |  | HOMEBREW_RELEASES_URL_REGEX = | 
					
						
							|  |  |  |   %r{https://github\.com/([\w-]+)/([\w-]+)?/releases/download/(.+)}.freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 18:13:23 +01:00
										 |  |  | require "fileutils" | 
					
						
							| 
									
										
										
										
											2020-11-29 21:23:44 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | require "os" | 
					
						
							| 
									
										
										
										
											2018-09-06 16:58:17 -07:00
										 |  |  | require "os/global" | 
					
						
							| 
									
										
										
										
											2020-11-29 21:23:44 +01:00
										 |  |  | require "messages" | 
					
						
							| 
									
										
										
										
											2013-10-21 04:24:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   extend FileUtils | 
					
						
							| 
									
										
										
										
											2012-03-15 10:57:34 +13:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-30 16:09:03 +02:00
										 |  |  |   DEFAULT_PREFIX ||= HOMEBREW_DEFAULT_PREFIX | 
					
						
							| 
									
										
										
										
											2020-12-09 13:53:10 +00:00
										 |  |  |   DEFAULT_REPOSITORY ||= HOMEBREW_DEFAULT_REPOSITORY | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  |   DEFAULT_CELLAR = "#{DEFAULT_PREFIX}/Cellar" | 
					
						
							| 
									
										
										
										
											2020-11-26 14:29:42 +01:00
										 |  |  |   DEFAULT_MACOS_CELLAR = "#{HOMEBREW_DEFAULT_PREFIX}/Cellar" | 
					
						
							|  |  |  |   DEFAULT_MACOS_ARM_CELLAR = "#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar" | 
					
						
							|  |  |  |   DEFAULT_LINUX_CELLAR = "#{HOMEBREW_LINUX_DEFAULT_PREFIX}/Cellar" | 
					
						
							| 
									
										
										
										
											2018-09-06 16:58:17 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   class << self | 
					
						
							| 
									
										
										
										
											2020-09-23 03:43:54 +02:00
										 |  |  |     attr_writer :failed, :raise_deprecation_exceptions, :auditing | 
					
						
							| 
									
										
										
										
											2016-08-12 21:06:00 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 15:36:04 +11:00
										 |  |  |     def default_prefix?(prefix = HOMEBREW_PREFIX) | 
					
						
							| 
									
										
										
										
											2018-09-06 16:58:17 -07:00
										 |  |  |       prefix.to_s == DEFAULT_PREFIX | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |     def failed? | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  |       @failed ||= false | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |       @failed == true | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-20 02:10:54 -04:00
										 |  |  |     def messages | 
					
						
							|  |  |  |       @messages ||= Messages.new | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |     def raise_deprecation_exceptions? | 
					
						
							|  |  |  |       @raise_deprecation_exceptions == true | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2017-09-02 12:38:18 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     def auditing? | 
					
						
							|  |  |  |       @auditing == true | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-29 21:23:44 +01:00
										 |  |  | require "env_config" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "config" | 
					
						
							|  |  |  | require "context" | 
					
						
							|  |  |  | require "extend/pathname" | 
					
						
							|  |  |  | require "extend/predicable" | 
					
						
							|  |  |  | require "extend/module" | 
					
						
							|  |  |  | require "cli/args" | 
					
						
							| 
									
										
										
										
											2011-08-02 12:00:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  | require "PATH" | 
					
						
							| 
									
										
											  
											
												Core change: XCode only install, with CLT or both
Allow XCode without the Command Line Tools to
work with homebrew, so it's not necessary
to register an Apple Dev ID and/or go to the
XCode prefs and download the CLT. Yay!
Further, this commit allows to use the CLT
solely (without the need for XCode).
Saves quite some megs.
(Some furmulae require xcodebuild)
Of course XCode together with the CLT is still
fine and has been tested on 10.7 and 10.6
with Xcode 4 and Xcode 3.
Only on Lion or above, tell the user about the options,
which are
- Xcode without CLT
- CLT without Xcode
- both (ok, it's not directly stated, but implicit)
So if no Xcode is found and we are on Lion or above,
we don't fail but check for the CLTs now.
For older Macs, the old message that Xcode is needed
and the installer should be run is still displayed.
If the CLT are not found but Xcode is, then we
print out about the experimental status of this setup.
Closes Homebrew/homebrew#10510.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
											
										 
											2012-02-26 21:04:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-23 11:40:53 +01:00
										 |  |  | ENV["HOMEBREW_PATH"] ||= ENV["PATH"] | 
					
						
							| 
									
										
										
										
											2017-04-28 12:39:00 +02:00
										 |  |  | ORIGINAL_PATHS = PATH.new(ENV["HOMEBREW_PATH"]).map do |p| | 
					
						
							| 
									
										
										
										
											2019-10-13 10:03:26 +01:00
										 |  |  |   Pathname.new(p).expand_path | 
					
						
							|  |  |  | rescue | 
					
						
							|  |  |  |   nil | 
					
						
							| 
									
										
										
										
											2016-09-17 15:17:27 +01:00
										 |  |  | end.compact.freeze | 
					
						
							| 
									
										
										
										
											2015-06-26 15:19:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  | require "set" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "extend/string" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-02 14:32:31 +02:00
										 |  |  | require "system_command" | 
					
						
							| 
									
										
										
										
											2018-04-07 20:28:56 +01:00
										 |  |  | require "exceptions" | 
					
						
							|  |  |  | require "utils" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "official_taps" | 
					
						
							|  |  |  | require "tap" | 
					
						
							|  |  |  | require "tap_constants" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-05 15:44:50 +01:00
										 |  |  | require "compat" unless Homebrew::EnvConfig.no_compat? |