2018-04-07 20:28:56 +01:00
require " pathname "
2017-06-10 20:12:55 +03:00
require " English "
2018-04-01 16:47:30 +05:30
require " ostruct "
2009-09-04 15:28:18 +01:00
2018-04-07 20:28:56 +01:00
require " pp "
require " extend/ARGV "
2009-10-15 12:36:09 +01:00
ARGV . extend ( HomebrewArgvExtension )
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 " ]
2017-02-12 13:57:52 +00:00
HOMEBREW_WWW = " https://brew.sh " . freeze
2009-10-15 12:36:09 +01:00
2015-04-28 22:37:26 -04:00
require " config "
2018-04-07 20:28:56 +01:00
require " extend/git_repository "
2013-12-14 09:35:58 -06:00
2016-07-02 09:44:48 +02:00
HOMEBREW_REPOSITORY . extend ( GitRepositoryExtension )
2018-04-07 20:28:56 +01:00
require " rbconfig "
2016-08-18 14:35:39 +08:00
RUBY_PATH = Pathname . new ( RbConfig . ruby )
2014-06-09 21:36:36 -05:00
RUBY_BIN = RUBY_PATH . dirname
2013-03-10 17:02:06 +00:00
2016-04-04 11:46:33 +01:00
HOMEBREW_USER_AGENT_CURL = ENV [ " HOMEBREW_USER_AGENT_CURL " ]
2016-09-17 15:17:27 +01:00
HOMEBREW_USER_AGENT_RUBY = " #{ ENV [ " HOMEBREW_USER_AGENT " ] } ruby/ #{ RUBY_VERSION } -p #{ RUBY_PATCHLEVEL } " . freeze
2017-01-26 16:19:38 +00:00
HOMEBREW_USER_AGENT_FAKE_SAFARI = " Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8 " . freeze
2009-11-05 21:37:51 +00:00
2018-04-07 20:28:56 +01:00
require " extend/fileutils "
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
2016-09-26 01:44:51 +02:00
class << self
2018-04-01 16:47:30 +05:30
attr_writer :failed , :raise_deprecation_exceptions , :auditing , :args
2016-08-12 21:06:00 +01:00
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-04-01 16:47:30 +05:30
def args
@args || = OpenStruct . 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
2016-03-06 15:11:34 +08:00
HOMEBREW_PULL_API_REGEX = %r{ https://api \ .github \ .com/repos/([ \ w-]+)/([ \ w-]+)?/pulls/( \ d+) }
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[ https://github \ .com/( [ \ w- ] +)/( [ \ w- ] +)?/(?:pull/( \ d+)|commit/ [ 0-9a-fA-F ] {4,40}) ]
2011-08-02 12:00:30 +01:00
2018-04-07 20:28:56 +01:00
require " forwardable "
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 |
2016-09-17 15:17:27 +01:00
begin
2016-09-17 17:01:04 +01:00
Pathname . new ( p ) . expand_path
rescue
nil
end
2016-09-17 15:17:27 +01:00
end . compact . freeze
2015-06-26 15:19:27 +08:00
HOMEBREW_INTERNAL_COMMAND_ALIASES = {
2015-08-03 13:09:07 +01:00
" ls " = > " list " ,
" homepage " = > " home " ,
" -S " = > " search " ,
" up " = > " update " ,
" ln " = > " link " ,
" instal " = > " install " , # gem does the same
2017-02-21 04:35:52 -08:00
" uninstal " = > " uninstall " ,
2015-08-03 13:09:07 +01:00
" rm " = > " uninstall " ,
" remove " = > " uninstall " ,
" configure " = > " diy " ,
" abv " = > " info " ,
" dr " = > " doctor " ,
" --repo " = > " --repository " ,
" environment " = > " --env " ,
2016-09-17 15:17:27 +01:00
" --config " = > " config " ,
} . freeze
2018-04-07 20:28:56 +01:00
require " set "
require " os "
require " extend/pathname "
require " extend/module "
require " extend/predicable "
require " extend/string "
require " constants "
require " exceptions "
require " utils "
require " official_taps "
require " tap "
require " tap_constants "
if ! ARGV . include? ( " --no-compat " ) && ! ENV [ " HOMEBREW_NO_COMPAT " ]
require " compat "
end