brew/Library/Homebrew/global.rb

57 lines
1.5 KiB
Ruby
Raw Normal View History

require 'extend/module'
require 'extend/fileutils'
require 'extend/pathname'
require 'extend/ARGV'
2010-02-27 17:26:27 +00:00
require 'extend/string'
2013-10-18 12:56:51 -05:00
require 'os'
require 'utils'
require 'exceptions'
require 'set'
require 'rbconfig'
ARGV.extend(HomebrewArgvExtension)
HOMEBREW_VERSION = '0.9.5'
2013-04-06 15:50:23 -05:00
HOMEBREW_WWW = 'http://brew.sh'
require "config"
2013-12-14 09:35:58 -06:00
2014-06-09 21:36:36 -05:00
if RbConfig.respond_to?(:ruby)
RUBY_PATH = Pathname.new(RbConfig.ruby)
else
RUBY_PATH = Pathname.new(RbConfig::CONFIG["bindir"]).join(
RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
)
end
RUBY_BIN = RUBY_PATH.dirname
if RUBY_PLATFORM =~ /darwin/
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
2013-10-25 17:29:36 -05:00
MACOS_VERSION = MACOS_FULL_VERSION[/10\.\d+/]
2015-06-16 20:02:10 -04:00
OS_VERSION = "OS X #{MACOS_FULL_VERSION}"
else
2013-10-25 17:29:36 -05:00
MACOS_FULL_VERSION = MACOS_VERSION = "0"
OS_VERSION = RUBY_PLATFORM
end
HOMEBREW_GITHUB_API_TOKEN = ENV["HOMEBREW_GITHUB_API_TOKEN"]
HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}; #{OS_VERSION})"
HOMEBREW_CURL_ARGS = '-f#LA'
require 'tap_constants'
module Homebrew
include FileUtils
extend self
attr_accessor :failed
alias_method :failed?, :failed
end
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/homebrew(-[\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})]
2013-05-09 23:53:26 -05:00
require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT']
ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze