mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix mutable constants violations.
This commit is contained in:
parent
420e63ebcd
commit
d1ea6f38d3
@ -6,10 +6,10 @@ using HashValidator
|
|||||||
module Cask
|
module Cask
|
||||||
module Artifact
|
module Artifact
|
||||||
class Installer < AbstractArtifact
|
class Installer < AbstractArtifact
|
||||||
VALID_KEYS = Set.new [
|
VALID_KEYS = Set.new([
|
||||||
:manual,
|
:manual,
|
||||||
:script,
|
:script,
|
||||||
]
|
]).freeze
|
||||||
|
|
||||||
module ManualInstaller
|
module ManualInstaller
|
||||||
def install_phase(**)
|
def install_phase(**)
|
||||||
|
@ -22,8 +22,8 @@ module Cask
|
|||||||
#
|
#
|
||||||
|
|
||||||
ARTIFACTS =
|
ARTIFACTS =
|
||||||
DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
|
(DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
|
||||||
DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)
|
DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)).freeze
|
||||||
|
|
||||||
option "--table", :table, false
|
option "--table", :table, false
|
||||||
option "--quiet", :quiet, false
|
option "--quiet", :quiet, false
|
||||||
|
@ -46,34 +46,34 @@ module Cask
|
|||||||
Artifact::Zap,
|
Artifact::Zap,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
ACTIVATABLE_ARTIFACT_CLASSES = ORDINARY_ARTIFACT_CLASSES - [Artifact::StageOnly]
|
ACTIVATABLE_ARTIFACT_CLASSES = (ORDINARY_ARTIFACT_CLASSES - [Artifact::StageOnly]).freeze
|
||||||
|
|
||||||
ARTIFACT_BLOCK_CLASSES = [
|
ARTIFACT_BLOCK_CLASSES = [
|
||||||
Artifact::PreflightBlock,
|
Artifact::PreflightBlock,
|
||||||
Artifact::PostflightBlock,
|
Artifact::PostflightBlock,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
DSL_METHODS = Set.new [
|
DSL_METHODS = Set.new([
|
||||||
:appcast,
|
:appcast,
|
||||||
:artifacts,
|
:artifacts,
|
||||||
:auto_updates,
|
:auto_updates,
|
||||||
:caveats,
|
:caveats,
|
||||||
:conflicts_with,
|
:conflicts_with,
|
||||||
:container,
|
:container,
|
||||||
:depends_on,
|
:depends_on,
|
||||||
:homepage,
|
:homepage,
|
||||||
:language,
|
:language,
|
||||||
:languages,
|
:languages,
|
||||||
:name,
|
:name,
|
||||||
:sha256,
|
:sha256,
|
||||||
:staged_path,
|
:staged_path,
|
||||||
:url,
|
:url,
|
||||||
:version,
|
:version,
|
||||||
:appdir,
|
:appdir,
|
||||||
*ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
|
*ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
|
||||||
*ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
|
*ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
|
||||||
*ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
|
*ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
|
||||||
].freeze
|
]).freeze
|
||||||
|
|
||||||
attr_reader :cask, :token
|
attr_reader :cask, :token
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@ require "unpack_strategy"
|
|||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
class Container
|
class Container
|
||||||
VALID_KEYS = Set.new [
|
VALID_KEYS = Set.new([
|
||||||
:type,
|
:type,
|
||||||
:nested,
|
:nested,
|
||||||
]
|
]).freeze
|
||||||
|
|
||||||
attr_accessor(*VALID_KEYS)
|
attr_accessor(*VALID_KEYS)
|
||||||
attr_accessor :pairs
|
attr_accessor :pairs
|
||||||
|
@ -3,14 +3,14 @@ require "rubygems"
|
|||||||
module Cask
|
module Cask
|
||||||
class DSL
|
class DSL
|
||||||
class DependsOn < DelegateClass(Hash)
|
class DependsOn < DelegateClass(Hash)
|
||||||
VALID_KEYS = Set.new [
|
VALID_KEYS = Set.new([
|
||||||
:formula,
|
:formula,
|
||||||
:cask,
|
:cask,
|
||||||
:macos,
|
:macos,
|
||||||
:arch,
|
:arch,
|
||||||
:x11,
|
:x11,
|
||||||
:java,
|
:java,
|
||||||
].freeze
|
]).freeze
|
||||||
|
|
||||||
VALID_ARCHES = {
|
VALID_ARCHES = {
|
||||||
intel: { type: :intel, bits: 64 },
|
intel: { type: :intel, bits: 64 },
|
||||||
|
@ -119,7 +119,7 @@ module Homebrew
|
|||||||
class Cleanup
|
class Cleanup
|
||||||
extend Predicable
|
extend Predicable
|
||||||
|
|
||||||
PERIODIC_CLEAN_FILE = HOMEBREW_CACHE/".cleaned"
|
PERIODIC_CLEAN_FILE = (HOMEBREW_CACHE/".cleaned").freeze
|
||||||
|
|
||||||
attr_predicate :dry_run?, :scrub?
|
attr_predicate :dry_run?, :scrub?
|
||||||
attr_reader :args, :days, :cache
|
attr_reader :args, :days, :cache
|
||||||
|
@ -8,8 +8,8 @@ module CompilerConstants
|
|||||||
"llvm_clang" => :llvm_clang,
|
"llvm_clang" => :llvm_clang,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
COMPILERS = COMPILER_SYMBOL_MAP.values +
|
COMPILERS = (COMPILER_SYMBOL_MAP.values +
|
||||||
GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }
|
GNU_GCC_VERSIONS.map { |n| "gcc-#{n}" }).freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
class CompilerFailure
|
class CompilerFailure
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unless ENV["HOMEBREW_BREW_FILE"]
|
||||||
|
|
||||||
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
# Path to `bin/brew` main executable in `HOMEBREW_PREFIX`
|
||||||
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]).freeze
|
||||||
|
|
||||||
class MissingEnvironmentVariables < RuntimeError; end
|
class MissingEnvironmentVariables < RuntimeError; end
|
||||||
|
|
||||||
@ -11,42 +11,46 @@ def get_env_or_raise(env)
|
|||||||
ENV[env]
|
ENV[env]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "extend/git_repository"
|
||||||
|
|
||||||
# Where we link under
|
# Where we link under
|
||||||
HOMEBREW_PREFIX = Pathname.new(get_env_or_raise("HOMEBREW_PREFIX"))
|
HOMEBREW_PREFIX = Pathname.new(get_env_or_raise("HOMEBREW_PREFIX")).freeze
|
||||||
|
|
||||||
# Where `.git` is found
|
# Where `.git` is found
|
||||||
HOMEBREW_REPOSITORY = Pathname.new(get_env_or_raise("HOMEBREW_REPOSITORY"))
|
HOMEBREW_REPOSITORY = Pathname.new(get_env_or_raise("HOMEBREW_REPOSITORY"))
|
||||||
|
.extend(GitRepositoryExtension)
|
||||||
|
.freeze
|
||||||
|
|
||||||
# Where we store most of Homebrew, taps, and various metadata
|
# Where we store most of Homebrew, taps, and various metadata
|
||||||
HOMEBREW_LIBRARY = Pathname.new(get_env_or_raise("HOMEBREW_LIBRARY"))
|
HOMEBREW_LIBRARY = Pathname.new(get_env_or_raise("HOMEBREW_LIBRARY")).freeze
|
||||||
|
|
||||||
# Where shim scripts for various build and SCM tools are stored
|
# Where shim scripts for various build and SCM tools are stored
|
||||||
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims"
|
HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY/"Homebrew/shims").freeze
|
||||||
|
|
||||||
# Where we store symlinks to currently linked kegs
|
# Where we store symlinks to currently linked kegs
|
||||||
HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked"
|
HOMEBREW_LINKED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/linked").freeze
|
||||||
|
|
||||||
# Where we store symlinks to currently version-pinned kegs
|
# Where we store symlinks to currently version-pinned kegs
|
||||||
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned"
|
HOMEBREW_PINNED_KEGS = (HOMEBREW_PREFIX/"var/homebrew/pinned").freeze
|
||||||
|
|
||||||
# Where we store lock files
|
# Where we store lock files
|
||||||
HOMEBREW_LOCKS = HOMEBREW_PREFIX/"var/homebrew/locks"
|
HOMEBREW_LOCKS = (HOMEBREW_PREFIX/"var/homebrew/locks").freeze
|
||||||
|
|
||||||
# Where we store built products
|
# Where we store built products
|
||||||
HOMEBREW_CELLAR = Pathname.new(get_env_or_raise("HOMEBREW_CELLAR"))
|
HOMEBREW_CELLAR = Pathname.new(get_env_or_raise("HOMEBREW_CELLAR")).freeze
|
||||||
|
|
||||||
# Where downloads (bottles, source tarballs, etc.) are cached
|
# Where downloads (bottles, source tarballs, etc.) are cached
|
||||||
HOMEBREW_CACHE = Pathname.new(get_env_or_raise("HOMEBREW_CACHE"))
|
HOMEBREW_CACHE = Pathname.new(get_env_or_raise("HOMEBREW_CACHE")).freeze
|
||||||
|
|
||||||
# Where brews installed via URL are cached
|
# Where brews installed via URL are cached
|
||||||
HOMEBREW_CACHE_FORMULA = HOMEBREW_CACHE/"Formula"
|
HOMEBREW_CACHE_FORMULA = (HOMEBREW_CACHE/"Formula").freeze
|
||||||
|
|
||||||
# Where build, postinstall, and test logs of formulae are written to
|
# Where build, postinstall, and test logs of formulae are written to
|
||||||
HOMEBREW_LOGS = Pathname.new(get_env_or_raise("HOMEBREW_LOGS")).expand_path
|
HOMEBREW_LOGS = Pathname.new(get_env_or_raise("HOMEBREW_LOGS")).expand_path.freeze
|
||||||
|
|
||||||
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
|
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
|
||||||
HOMEBREW_TEMP = begin
|
HOMEBREW_TEMP = begin
|
||||||
tmp = Pathname.new(get_env_or_raise("HOMEBREW_TEMP"))
|
tmp = Pathname.new(get_env_or_raise("HOMEBREW_TEMP"))
|
||||||
tmp.mkpath unless tmp.exist?
|
tmp.mkpath unless tmp.exist?
|
||||||
tmp.realpath
|
tmp.realpath
|
||||||
end
|
end.freeze
|
||||||
|
@ -4,7 +4,7 @@ require "debrew/irb"
|
|||||||
module Debrew
|
module Debrew
|
||||||
extend Mutex_m
|
extend Mutex_m
|
||||||
|
|
||||||
Ignorable = Module.new
|
Ignorable = Module.new.freeze
|
||||||
|
|
||||||
module Raise
|
module Raise
|
||||||
def raise(*)
|
def raise(*)
|
||||||
|
@ -7,7 +7,7 @@ class Dependency
|
|||||||
|
|
||||||
attr_reader :name, :tags, :env_proc, :option_names
|
attr_reader :name, :tags, :env_proc, :option_names
|
||||||
|
|
||||||
DEFAULT_ENV_PROC = proc {}
|
DEFAULT_ENV_PROC = proc {}.freeze
|
||||||
|
|
||||||
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name])
|
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_names = [name])
|
||||||
raise ArgumentError, "Dependency must have a name!" unless name
|
raise ArgumentError, "Dependency must have a name!" unless name
|
||||||
|
@ -8,9 +8,9 @@ Dir.glob("#{HOMEBREW_LIBRARY_PATH}/{dev-,}cmd/*.rb").each { |cmd| require cmd }
|
|||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
SOURCE_PATH = HOMEBREW_LIBRARY_PATH/"manpages"
|
SOURCE_PATH = (HOMEBREW_LIBRARY_PATH/"manpages").freeze
|
||||||
TARGET_MAN_PATH = HOMEBREW_REPOSITORY/"manpages"
|
TARGET_MAN_PATH = (HOMEBREW_REPOSITORY/"manpages").freeze
|
||||||
TARGET_DOC_PATH = HOMEBREW_REPOSITORY/"docs"
|
TARGET_DOC_PATH = (HOMEBREW_REPOSITORY/"docs").freeze
|
||||||
|
|
||||||
def man_args
|
def man_args
|
||||||
Homebrew::CLI::Parser.new do
|
Homebrew::CLI::Parser.new do
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
class Keg
|
class Keg
|
||||||
GENERIC_KEG_LINK_DIRECTORIES = remove_const :KEG_LINK_DIRECTORIES
|
GENERIC_KEG_LINK_DIRECTORIES = (remove_const :KEG_LINK_DIRECTORIES).freeze
|
||||||
KEG_LINK_DIRECTORIES = (GENERIC_KEG_LINK_DIRECTORIES + ["Frameworks"]).freeze
|
KEG_LINK_DIRECTORIES = (GENERIC_KEG_LINK_DIRECTORIES + ["Frameworks"]).freeze
|
||||||
end
|
end
|
||||||
|
@ -28,21 +28,17 @@ require "extend/ARGV"
|
|||||||
require "messages"
|
require "messages"
|
||||||
require "system_command"
|
require "system_command"
|
||||||
|
|
||||||
ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup
|
ARGV_WITHOUT_MONKEY_PATCHING = ARGV.dup.freeze
|
||||||
ARGV.extend(HomebrewArgvExtension)
|
ARGV.extend(HomebrewArgvExtension)
|
||||||
|
|
||||||
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"]
|
HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"]
|
||||||
HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
|
HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"]
|
||||||
HOMEBREW_WWW = "https://brew.sh".freeze
|
HOMEBREW_WWW = "https://brew.sh".freeze
|
||||||
|
|
||||||
require "extend/git_repository"
|
|
||||||
|
|
||||||
HOMEBREW_REPOSITORY.extend(GitRepositoryExtension)
|
|
||||||
|
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
|
|
||||||
RUBY_PATH = Pathname.new(RbConfig.ruby)
|
RUBY_PATH = Pathname.new(RbConfig.ruby).freeze
|
||||||
RUBY_BIN = RUBY_PATH.dirname
|
RUBY_BIN = RUBY_PATH.dirname.freeze
|
||||||
|
|
||||||
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
|
HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"]
|
||||||
HOMEBREW_USER_AGENT_RUBY =
|
HOMEBREW_USER_AGENT_RUBY =
|
||||||
|
@ -77,9 +77,9 @@ class Keg
|
|||||||
|
|
||||||
# Keep relatively in sync with
|
# Keep relatively in sync with
|
||||||
# https://github.com/Homebrew/install/blob/master/install
|
# https://github.com/Homebrew/install/blob/master/install
|
||||||
MUST_EXIST_DIRECTORIES = MUST_EXIST_SUBDIRECTORIES + [
|
MUST_EXIST_DIRECTORIES = (MUST_EXIST_SUBDIRECTORIES + [
|
||||||
HOMEBREW_CELLAR,
|
HOMEBREW_CELLAR,
|
||||||
].uniq.sort.freeze
|
].sort.uniq).freeze
|
||||||
MUST_BE_WRITABLE_DIRECTORIES = (
|
MUST_BE_WRITABLE_DIRECTORIES = (
|
||||||
%w[
|
%w[
|
||||||
etc/bash_completion.d lib/pkgconfig
|
etc/bash_completion.d lib/pkgconfig
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath
|
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath.freeze
|
||||||
|
|
||||||
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
module Metafiles
|
module Metafiles
|
||||||
# https://github.com/github/markup#markups
|
# https://github.com/github/markup#markups
|
||||||
EXTENSIONS = Set.new %w[
|
EXTENSIONS = Set.new(%w[
|
||||||
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
|
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
|
||||||
.org .pod .rdoc .rst .rtf .textile .txt .wiki
|
.org .pod .rdoc .rst .rtf .textile .txt .wiki
|
||||||
].freeze
|
]).freeze
|
||||||
BASENAMES = Set.new %w[
|
BASENAMES = Set.new(%w[
|
||||||
about authors changelog changes copying copyright history license licence
|
about authors changelog changes copying copyright history license licence
|
||||||
news notes notice readme todo
|
news notes notice readme todo
|
||||||
].freeze
|
]).freeze
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
@ -3,7 +3,11 @@ module OS
|
|||||||
module Mac
|
module Mac
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
::MacOS = self # rubocop:disable Naming/ConstantName
|
# rubocop:disable Naming/ConstantName
|
||||||
|
# rubocop:disable Style/MutableConstant
|
||||||
|
::MacOS = self
|
||||||
|
# rubocop:enable Naming/ConstantName
|
||||||
|
# rubocop:enable Style/MutableConstant
|
||||||
|
|
||||||
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
|
@ -3,5 +3,5 @@ module Homebrew
|
|||||||
"/usr/local".freeze
|
"/usr/local".freeze
|
||||||
else
|
else
|
||||||
"/home/linuxbrew/.linuxbrew".freeze
|
"/home/linuxbrew/.linuxbrew".freeze
|
||||||
end
|
end.freeze
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,11 @@ module OS
|
|||||||
module Mac
|
module Mac
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
::MacOS = self # rubocop:disable Naming/ConstantName
|
# rubocop:disable Naming/ConstantName
|
||||||
|
# rubocop:disable Style/MutableConstant
|
||||||
|
::MacOS = self
|
||||||
|
# rubocop:enable Naming/ConstantName
|
||||||
|
# rubocop:enable Style/MutableConstant
|
||||||
|
|
||||||
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
X11 = XQuartz = Module.new
|
X11 = XQuartz = Module.new # rubocop:disable Style/MutableConstant
|
||||||
|
|
||||||
module XQuartz
|
module XQuartz
|
||||||
module_function
|
module_function
|
||||||
|
@ -19,11 +19,11 @@ module RuboCop
|
|||||||
|
|
||||||
MSG_NO_MATCH = "`%{url}` does not match `%{full_url}`".freeze
|
MSG_NO_MATCH = "`%{url}` does not match `%{full_url}`".freeze
|
||||||
|
|
||||||
MSG_MISSING = "`%{domain}` does not match `%{homepage}`, a comment has to be added " \
|
MSG_MISSING = ("`%{domain}` does not match `%{homepage}`, a comment has to be added " \
|
||||||
"above the `url` stanza. For details, see " + REFERENCE_URL
|
"above the `url` stanza. For details, see " + REFERENCE_URL).freeze
|
||||||
|
|
||||||
MSG_WRONG_FORMAT = "`%{comment}` does not match the expected comment format. " \
|
MSG_WRONG_FORMAT = ("`%{comment}` does not match the expected comment format. " \
|
||||||
"For details, see " + REFERENCE_URL
|
"For details, see " + REFERENCE_URL).freeze
|
||||||
|
|
||||||
MSG_UNNECESSARY = "The URL's domain `%{domain}` matches the homepage `%{homepage}`, " \
|
MSG_UNNECESSARY = "The URL's domain `%{domain}` matches the homepage `%{homepage}`, " \
|
||||||
"the comment above the `url` stanza is unnecessary".freeze
|
"the comment above the `url` stanza is unnecessary".freeze
|
||||||
|
@ -11,7 +11,7 @@ require "description_cache_store"
|
|||||||
class Tap
|
class Tap
|
||||||
extend Cachable
|
extend Cachable
|
||||||
|
|
||||||
TAP_DIRECTORY = HOMEBREW_LIBRARY/"Taps"
|
TAP_DIRECTORY = (HOMEBREW_LIBRARY/"Taps").freeze
|
||||||
|
|
||||||
def self.fetch(*args)
|
def self.fetch(*args)
|
||||||
case args.length
|
case args.length
|
||||||
|
@ -5,7 +5,7 @@ HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}.freeze
|
|||||||
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
|
# match taps' directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap
|
||||||
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
|
HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
|
||||||
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
|
# match taps' formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula
|
||||||
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
|
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze
|
||||||
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
||||||
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
|
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
|
||||||
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze
|
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze
|
||||||
|
@ -5,8 +5,8 @@ describe "patching" do
|
|||||||
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz".freeze
|
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz".freeze
|
||||||
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff".freeze
|
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff".freeze
|
||||||
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff".freeze
|
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff".freeze
|
||||||
PATCH_A_CONTENTS = File.read "#{TEST_FIXTURE_DIR}/patches/noop-a.diff"
|
PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
|
||||||
PATCH_B_CONTENTS = File.read "#{TEST_FIXTURE_DIR}/patches/noop-b.diff"
|
PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
|
||||||
APPLY_A = "noop-a.diff".freeze
|
APPLY_A = "noop-a.diff".freeze
|
||||||
APPLY_B = "noop-b.diff".freeze
|
APPLY_B = "noop-b.diff".freeze
|
||||||
APPLY_C = "noop-c.diff".freeze
|
APPLY_C = "noop-c.diff".freeze
|
||||||
|
@ -2,7 +2,7 @@ raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" unle
|
|||||||
|
|
||||||
require "pathname"
|
require "pathname"
|
||||||
|
|
||||||
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]).freeze
|
||||||
|
|
||||||
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
|
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
|
||||||
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
|
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
|
||||||
@ -12,25 +12,27 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
|
|||||||
FileUtils.remove_entry(dir) unless ENV["HOMEBREW_TEST_NO_EXIT_CLEANUP"]
|
FileUtils.remove_entry(dir) unless ENV["HOMEBREW_TEST_NO_EXIT_CLEANUP"]
|
||||||
end
|
end
|
||||||
ENV[k] = dir
|
ENV[k] = dir
|
||||||
end
|
end.freeze
|
||||||
|
|
||||||
# Paths pointing into the Homebrew code base that persist across test runs
|
# Paths pointing into the Homebrew code base that persist across test runs
|
||||||
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent/"Homebrew/shims"
|
HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY_PATH.parent/"Homebrew/shims").freeze
|
||||||
|
|
||||||
|
require "extend/git_repository"
|
||||||
|
|
||||||
# Paths redirected to a temporary directory and wiped at the end of the test run
|
# Paths redirected to a temporary directory and wiped at the end of the test run
|
||||||
HOMEBREW_PREFIX = Pathname(TEST_TMPDIR)/"prefix"
|
HOMEBREW_PREFIX = (Pathname(TEST_TMPDIR)/"prefix").freeze
|
||||||
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
|
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX.dup.extend(GitRepositoryExtension).freeze
|
||||||
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library"
|
HOMEBREW_LIBRARY = (HOMEBREW_REPOSITORY/"Library").freeze
|
||||||
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent/"cache"
|
HOMEBREW_CACHE = (HOMEBREW_PREFIX.parent/"cache").freeze
|
||||||
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent/"formula_cache"
|
HOMEBREW_CACHE_FORMULA = (HOMEBREW_PREFIX.parent/"formula_cache").freeze
|
||||||
HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX.parent/"linked"
|
HOMEBREW_LINKED_KEGS = (HOMEBREW_PREFIX.parent/"linked").freeze
|
||||||
HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX.parent/"pinned"
|
HOMEBREW_PINNED_KEGS = (HOMEBREW_PREFIX.parent/"pinned").freeze
|
||||||
HOMEBREW_LOCKS = HOMEBREW_PREFIX.parent/"locks"
|
HOMEBREW_LOCKS = (HOMEBREW_PREFIX.parent/"locks").freeze
|
||||||
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent/"cellar"
|
HOMEBREW_CELLAR = (HOMEBREW_PREFIX.parent/"cellar").freeze
|
||||||
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent/"logs"
|
HOMEBREW_LOGS = (HOMEBREW_PREFIX.parent/"logs").freeze
|
||||||
HOMEBREW_TEMP = HOMEBREW_PREFIX.parent/"temp"
|
HOMEBREW_TEMP = (HOMEBREW_PREFIX.parent/"temp").freeze
|
||||||
|
|
||||||
TEST_FIXTURE_DIR = HOMEBREW_LIBRARY_PATH/"test/support/fixtures"
|
TEST_FIXTURE_DIR = (HOMEBREW_LIBRARY_PATH/"test/support/fixtures").freeze
|
||||||
|
|
||||||
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze
|
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze
|
||||||
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze
|
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze
|
||||||
|
@ -5,19 +5,19 @@ module UnpackStrategy
|
|||||||
include UnpackStrategy
|
include UnpackStrategy
|
||||||
|
|
||||||
module Bom
|
module Bom
|
||||||
DMG_METADATA = Set.new %w[
|
DMG_METADATA = Set.new(%w[
|
||||||
.background
|
.background
|
||||||
.com.apple.timemachine.donotpresent
|
.com.apple.timemachine.donotpresent
|
||||||
.com.apple.timemachine.supported
|
.com.apple.timemachine.supported
|
||||||
.DocumentRevisions-V100
|
.DocumentRevisions-V100
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.fseventsd
|
.fseventsd
|
||||||
.MobileBackups
|
.MobileBackups
|
||||||
.Spotlight-V100
|
.Spotlight-V100
|
||||||
.TemporaryItems
|
.TemporaryItems
|
||||||
.Trashes
|
.Trashes
|
||||||
.VolumeIcon.icns
|
.VolumeIcon.icns
|
||||||
].freeze
|
]).freeze
|
||||||
private_constant :DMG_METADATA
|
private_constant :DMG_METADATA
|
||||||
|
|
||||||
refine Pathname do
|
refine Pathname do
|
||||||
|
@ -52,7 +52,7 @@ class Version
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
NULL_TOKEN = NullToken.new
|
NULL_TOKEN = NullToken.new.freeze
|
||||||
|
|
||||||
class StringToken < Token
|
class StringToken < Token
|
||||||
PATTERN = /[a-z]+[0-9]*/i.freeze
|
PATTERN = /[a-z]+[0-9]*/i.freeze
|
||||||
@ -189,7 +189,7 @@ class Version
|
|||||||
PatchToken::PATTERN,
|
PatchToken::PATTERN,
|
||||||
NumericToken::PATTERN,
|
NumericToken::PATTERN,
|
||||||
StringToken::PATTERN,
|
StringToken::PATTERN,
|
||||||
)
|
).freeze
|
||||||
|
|
||||||
class FromURL < Version
|
class FromURL < Version
|
||||||
def detected_from_url?
|
def detected_from_url?
|
||||||
|
@ -51,5 +51,5 @@ class Version
|
|||||||
def inspect
|
def inspect
|
||||||
"#<Version::NULL>".freeze
|
"#<Version::NULL>".freeze
|
||||||
end
|
end
|
||||||
end.new
|
end.new.freeze
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user