brew style --fix fixes.

This commit is contained in:
Mike McQuaid 2018-11-02 17:18:07 +00:00
parent acd7f5714e
commit 737b84b54b
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
88 changed files with 567 additions and 567 deletions

View File

@ -104,8 +104,8 @@ class Build
new_env = {
"TMPDIR" => HOMEBREW_TEMP,
"TEMP" => HOMEBREW_TEMP,
"TMP" => HOMEBREW_TEMP,
"TEMP" => HOMEBREW_TEMP,
"TMP" => HOMEBREW_TEMP,
}
with_env(new_env) do

View File

@ -269,9 +269,9 @@ module Cask
puts path
command.run!(
"/usr/bin/xargs",
args: ["-0", "--", "/bin/rm", "-r", "-f", "--"],
args: ["-0", "--", "/bin/rm", "-r", "-f", "--"],
input: resolved_paths.join("\0"),
sudo: true,
sudo: true,
)
end
end

View File

@ -52,8 +52,8 @@ module Cask
with_choices_file do |choices_path|
args << "-applyChoiceChangesXML" << choices_path if choices_path
env = {
"LOGNAME" => User.current,
"USER" => User.current,
"LOGNAME" => User.current,
"USER" => User.current,
"USERNAME" => User.current,
}
command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true, env: env)

View File

@ -60,7 +60,7 @@ module Cask
download = audit_download? && Download.new(cask, quarantine: quarantine?)
audit = Audit.new(cask, download: download,
check_token_conflicts: check_token_conflicts?,
commit_range: commit_range)
commit_range: commit_range)
audit.run!
puts audit.summary
audit.success?

View File

@ -116,13 +116,13 @@ module Cask
def to_h
{
"name" => name,
"homepage" => homepage,
"url" => url,
"appcast" => appcast,
"version" => version,
"sha256" => sha256,
"artifacts" => artifacts.map do |a|
"name" => name,
"homepage" => homepage,
"url" => url,
"appcast" => appcast,
"version" => version,
"sha256" => sha256,
"artifacts" => artifacts.map do |a|
if a.respond_to? :to_h
a.to_h
elsif a.respond_to? :to_a
@ -131,11 +131,11 @@ module Cask
a
end
end,
"caveats" => caveats,
"depends_on" => depends_on,
"caveats" => caveats,
"depends_on" => depends_on,
"conflicts_with" => conflicts_with.to_a,
"container" => container,
"auto_updates" => auto_updates,
"container" => container,
"auto_updates" => auto_updates,
}
end
end

View File

@ -19,9 +19,9 @@ module Cask
def audit(cask)
odebug "Auditing Cask #{cask}"
Auditor.audit(cask, audit_download: download?,
Auditor.audit(cask, audit_download: download?,
check_token_conflicts: token_conflicts?,
quarantine: quarantine?)
quarantine: quarantine?)
end
end
end

View File

@ -45,10 +45,10 @@ module Cask
old_cask = CaskLoader.load(old_cask.installed_caskfile)
old_cask_installer =
Installer.new(old_cask, binaries: binaries?,
verbose: verbose?,
force: force?,
upgrade: true)
Installer.new(old_cask, binaries: binaries?,
verbose: verbose?,
force: force?,
upgrade: true)
new_cask = CaskLoader.load(old_cask.to_s)

View File

@ -13,9 +13,9 @@ module Cask
].freeze
VALID_ARCHES = {
intel: { type: :intel, bits: 64 },
intel: { type: :intel, bits: 64 },
# specific
x86_64: { type: :intel, bits: 64 },
x86_64: { type: :intel, bits: 64 },
}.freeze
attr_accessor :java

View File

@ -8,9 +8,9 @@ module Cask
"/" => :slashes,
}.freeze
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
MAJOR_MINOR_PATCH_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/
MAJOR_MINOR_PATCH_REGEX = /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/.freeze
class << self
private

View File

@ -322,10 +322,10 @@ module Cask
not_installed.each do |cask|
Installer.new(
cask,
binaries: binaries?,
verbose: verbose?,
binaries: binaries?,
verbose: verbose?,
installed_as_dependency: true,
force: false,
force: false,
).install
end
end

View File

@ -18,11 +18,11 @@ module Cask
odebug "Deleting pkg files"
@command.run!(
"/usr/bin/xargs",
args: [
args: [
"-0", "--", "/bin/rm", "--"
],
input: pkgutil_bom_files.join("\0"),
sudo: true,
sudo: true,
)
end
@ -30,11 +30,11 @@ module Cask
odebug "Deleting pkg symlinks and special files"
@command.run!(
"/usr/bin/xargs",
args: [
args: [
"-0", "--", "/bin/rm", "--"
],
input: pkgutil_bom_specials.join("\0"),
sudo: true,
sudo: true,
)
end

View File

@ -28,7 +28,7 @@ module Cask
:no_swift
else
api_check = system_command(swift,
args: [QUARANTINE_SCRIPT],
args: [QUARANTINE_SCRIPT],
print_stderr: false)
case api_check.exit_status
@ -87,7 +87,7 @@ module Cask
odebug "Releasing #{download_path} from quarantine"
quarantiner = system_command(xattr,
args: [
args: [
"-d",
QUARANTINE_ATTRIBUTE,
download_path,
@ -107,7 +107,7 @@ module Cask
odebug "Quarantining #{download_path}"
quarantiner = system_command(swift,
args: [
args: [
QUARANTINE_SCRIPT,
download_path,
cask.url.to_s,
@ -137,7 +137,7 @@ module Cask
resolved_paths = Pathname.glob(to/"**/*", File::FNM_DOTMATCH)
system_command!("/usr/bin/xargs",
args: [
args: [
"-0",
"--",
"/bin/chmod",
@ -147,7 +147,7 @@ module Cask
input: resolved_paths.join("\0"))
quarantiner = system_command("/usr/bin/xargs",
args: [
args: [
"-0",
"--",
xattr,
@ -156,7 +156,7 @@ module Cask
QUARANTINE_ATTRIBUTE,
quarantine_status,
],
input: resolved_paths.join("\0"),
input: resolved_paths.join("\0"),
print_stderr: false)
return if quarantiner.success?

View File

@ -354,7 +354,7 @@ module Homebrew
end
dirs.select(&:directory?).each.parallel do |dir|
system_command "find",
args: [dir, "-name", ".DS_Store", "-delete"],
args: [dir, "-name", ".DS_Store", "-delete"],
print_stderr: false
end
end

View File

@ -13,10 +13,10 @@ module Homebrew
def self.global_options
{
quiet: [["-q", "--quiet"], :quiet, "Suppress any warnings."],
quiet: [["-q", "--quiet"], :quiet, "Suppress any warnings."],
verbose: [["-v", "--verbose"], :verbose, "Make some output more verbose."],
debug: [["-d", "--debug"], :debug, "Display any debugging information."],
force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."],
debug: [["-d", "--debug"], :debug, "Display any debugging information."],
force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."],
}
end

View File

@ -60,12 +60,12 @@ module Homebrew
def deps
mode = OpenStruct.new(
installed?: ARGV.include?("--installed"),
tree?: ARGV.include?("--tree"),
all?: ARGV.include?("--all"),
installed?: ARGV.include?("--installed"),
tree?: ARGV.include?("--tree"),
all?: ARGV.include?("--all"),
topo_order?: ARGV.include?("-n"),
union?: ARGV.include?("--union"),
for_each?: ARGV.include?("--for-each"),
union?: ARGV.include?("--union"),
for_each?: ARGV.include?("--for-each"),
)
if mode.tree?

View File

@ -87,11 +87,11 @@ module Homebrew
f.pkg_version.to_s
end
json << { name: f.full_name,
json << { name: f.full_name,
installed_versions: outdated_versions.map(&:to_s),
current_version: current_version,
pinned: f.pinned?,
pinned_version: f.pinned_version }
current_version: current_version,
pinned: f.pinned?,
pinned_version: f.pinned_version }
end
puts JSON.generate(json)

View File

@ -33,10 +33,10 @@ module Homebrew
fink: ->(query) { "http://pdb.finkproject.org/pdb/browse.php?summary=#{query}" },
opensuse: ->(query) { "https://software.opensuse.org/search?q=#{query}" },
fedora: ->(query) { "https://apps.fedoraproject.org/packages/s/#{query}" },
debian: lambda { |query|
debian: lambda { |query|
"https://packages.debian.org/search?keywords=#{query}&searchon=names&suite=all&section=all"
},
ubuntu: lambda { |query|
ubuntu: lambda { |query|
"https://packages.ubuntu.com/search?keywords=#{query}&searchon=names&suite=all&section=all"
},
}.freeze

View File

@ -45,10 +45,10 @@ module Homebrew
else
tap = Tap.fetch(ARGV.named.first)
begin
tap.install clone_target: ARGV.named.second,
tap.install clone_target: ARGV.named.second,
force_auto_update: force_auto_update?,
full_clone: full_clone?,
quiet: ARGV.quieter?
full_clone: full_clone?,
quiet: ARGV.quieter?
rescue TapRemoteMismatchError => e
odie e
rescue TapAlreadyTappedError, TapAlreadyUnshallowError # rubocop:disable Lint/HandleExceptions

View File

@ -84,8 +84,8 @@ module Homebrew
end
out, _, status = system_command("git",
args: ["describe", "--tags", "--abbrev=0", initial_revision],
chdir: HOMEBREW_REPOSITORY,
args: ["describe", "--tags", "--abbrev=0", initial_revision],
chdir: HOMEBREW_REPOSITORY,
print_stderr: false)
initial_version = Version.new(out) if status.success?

View File

@ -1,7 +1,7 @@
# @private
module CompilerConstants
GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze
GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/
GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/.freeze
COMPILER_SYMBOL_MAP = {
"gcc" => :gcc,
"gcc-4.0" => :gcc_4_0,
@ -67,7 +67,7 @@ class CompilerFailure
end
COLLECTIONS = {
cxx11: [
cxx11: [
create(:gcc_4_0),
create(:gcc_4_2),
create(:clang) { build 425 },
@ -75,7 +75,7 @@ class CompilerFailure
create(gcc: "4.5"),
create(gcc: "4.6"),
],
cxx14: [
cxx14: [
create(:clang) { build 600 },
create(:gcc_4_0),
create(:gcc_4_2),
@ -97,10 +97,10 @@ class CompilerSelector
Compiler = Struct.new(:name, :version)
COMPILER_PRIORITY = {
clang: [:clang, :gcc_4_2, :gnu, :gcc_4_0, :llvm_clang],
clang: [:clang, :gcc_4_2, :gnu, :gcc_4_0, :llvm_clang],
gcc_4_2: [:gcc_4_2, :gnu, :clang, :gcc_4_0],
gcc_4_0: [:gcc_4_0, :gcc_4_2, :gnu, :clang],
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2, :gcc_4_0],
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2, :gcc_4_0],
}.freeze
def self.select_for(formula, compilers = self.compilers)

View File

@ -556,9 +556,9 @@ module Homebrew
return unless DevelopmentTools.curl_handles_most_https_certificates?
if http_content_problem = curl_check_http_content(homepage,
user_agents: [:browser, :default],
user_agents: [:browser, :default],
check_content: true,
strict: @strict)
strict: @strict)
problem http_content_problem
end
end

View File

@ -99,11 +99,11 @@ module Homebrew
"formula file. Instead of a formula name, requires a JSON file generated with "\
"`brew bottle --json` <formula>."
switch "--write",
depends_on: "--merge",
depends_on: "--merge",
description: "Write the changes to the formula file. A new commit will be generated unless "\
"`--no-commit` is passed."
switch "--no-commit",
depends_on: "--write",
depends_on: "--write",
description: "When passed with `--write`, a new commit will not generated after writing changes "\
"to the formula file."
flag "--root-url=",
@ -420,23 +420,23 @@ module Homebrew
f.full_name => {
"formula" => {
"pkg_version" => f.pkg_version.to_s,
"path" => f.path.to_s.delete_prefix("#{HOMEBREW_REPOSITORY}/"),
"path" => f.path.to_s.delete_prefix("#{HOMEBREW_REPOSITORY}/"),
},
"bottle" => {
"bottle" => {
"root_url" => bottle.root_url,
"prefix" => bottle.prefix,
"cellar" => bottle.cellar.to_s,
"rebuild" => bottle.rebuild,
"tags" => {
"prefix" => bottle.prefix,
"cellar" => bottle.cellar.to_s,
"rebuild" => bottle.rebuild,
"tags" => {
tag => {
"filename" => filename.bintray,
"filename" => filename.bintray,
"local_filename" => filename.to_s,
"sha256" => sha256,
"sha256" => sha256,
},
},
},
"bintray" => {
"package" => Utils::Bottles::Bintray.package(f.name),
"package" => Utils::Bottles::Bintray.package(f.name),
"repository" => Utils::Bottles::Bintray.repository(tap),
},
},

View File

@ -71,7 +71,7 @@ module Homebrew
switch "-n", "--dry-run",
description: "Print what would be done rather than doing it."
switch "--write",
depends_on: "--dry-run",
depends_on: "--dry-run",
description: "When passed along with `--dry-run`, perform a not-so-dry run by making the expected "\
"file modifications but not taking any Git actions."
switch "--no-audit",
@ -92,13 +92,13 @@ module Homebrew
description: "Specify the <URL> for the new download. If a <URL> is specified, the <SHA-256> "\
"checksum of the new download should also be specified."
flag "--sha256=",
depends_on: "--url=",
depends_on: "--url=",
description: "Specify the <SHA-256> checksum of the new download."
flag "--tag=",
description: "Specify the new git commit <tag> for the formula."
flag "--revision=",
required_for: "--tag=",
description: "Specify the new git commit <revision> corresponding to a specified <tag>."
description: "Specify the new git commit <revision> corresponding to a specified <tag>."
switch :force
switch :quiet

View File

@ -33,7 +33,7 @@ module Homebrew
switch "--examples",
description: "Show several examples."
switch "--pry",
env: :pry,
env: :pry,
description: "Use Pry instead of IRB. Implied if `HOMEBREW_PRY` is set."
end
end

View File

@ -53,9 +53,9 @@ class AbstractDownloadStrategy
UnpackStrategy.detect(cached_location,
extension_only: true,
ref_type: @ref_type, ref: @ref)
.extract_nestedly(basename: basename,
.extract_nestedly(basename: basename,
extension_only: true,
verbose: ARGV.verbose? && !shutup)
verbose: ARGV.verbose? && !shutup)
chdir
end
@ -99,8 +99,8 @@ class AbstractDownloadStrategy
*args,
print_stdout: !shutup,
print_stderr: !shutup,
verbose: ARGV.verbose? && !shutup,
env: env,
verbose: ARGV.verbose? && !shutup,
env: env,
**options,
)
end
@ -464,7 +464,7 @@ class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
def stage
UnpackStrategy::Uncompressed.new(cached_location)
.extract(basename: basename,
verbose: ARGV.verbose? && !shutup)
verbose: ARGV.verbose? && !shutup)
end
end
@ -666,10 +666,10 @@ class GitDownloadStrategy < VCSDownloadStrategy
def config_repo
system_command! "git",
args: ["config", "remote.origin.url", @url],
args: ["config", "remote.origin.url", @url],
chdir: cached_location
system_command! "git",
args: ["config", "remote.origin.fetch", refspec],
args: ["config", "remote.origin.fetch", refspec],
chdir: cached_location
end
@ -678,11 +678,11 @@ class GitDownloadStrategy < VCSDownloadStrategy
if !shallow_clone? && shallow_dir?
system_command! "git",
args: ["fetch", "origin", "--unshallow"],
args: ["fetch", "origin", "--unshallow"],
chdir: cached_location
else
system_command! "git",
args: ["fetch", "origin"],
args: ["fetch", "origin"],
chdir: cached_location
end
end
@ -691,7 +691,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
system_command! "git", args: clone_args
system_command! "git",
args: ["config", "homebrew.cacheversion", cache_version],
args: ["config", "homebrew.cacheversion", cache_version],
chdir: cached_location
checkout
update_submodules if submodules?
@ -711,16 +711,16 @@ class GitDownloadStrategy < VCSDownloadStrategy
end
system_command! "git",
args: ["reset", "--hard", *ref],
args: ["reset", "--hard", *ref],
chdir: cached_location
end
def update_submodules
system_command! "git",
args: ["submodule", "foreach", "--recursive", "git submodule sync"],
args: ["submodule", "foreach", "--recursive", "git submodule sync"],
chdir: cached_location
system_command! "git",
args: ["submodule", "update", "--init", "--recursive"],
args: ["submodule", "update", "--init", "--recursive"],
chdir: cached_location
fix_absolute_submodule_gitdir_references!
end
@ -734,7 +734,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
# See https://github.com/Homebrew/homebrew-core/pull/1520 for an example.
def fix_absolute_submodule_gitdir_references!
submodule_dirs = system_command!("git",
args: ["submodule", "--quiet", "foreach", "--recursive", "pwd"],
args: ["submodule", "--quiet", "foreach", "--recursive", "pwd"],
chdir: cached_location).stdout
submodule_dirs.lines.map(&:chomp).each do |submodule_dir|
@ -867,13 +867,13 @@ class CVSDownloadStrategy < VCSDownloadStrategy
system_command! "cvs", args: [*quiet_flag, "-d", @url, "login"] if @url.include? "pserver"
system_command! "cvs",
args: [*quiet_flag, "-d", @url, "checkout", "-d", cached_location.basename, @module],
args: [*quiet_flag, "-d", @url, "checkout", "-d", cached_location.basename, @module],
chdir: cached_location.dirname
end
def update
system_command! "cvs",
args: [*quiet_flag, "update"],
args: [*quiet_flag, "update"],
chdir: cached_location
end
@ -958,7 +958,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
def env
{
"PATH" => PATH.new(Formula["bazaar"].opt_bin, ENV["PATH"]),
"PATH" => PATH.new(Formula["bazaar"].opt_bin, ENV["PATH"]),
"BZR_HOME" => HOMEBREW_TEMP,
}
end
@ -979,7 +979,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
def update
system_command! "bzr",
args: ["update"],
args: ["update"],
chdir: cached_location
end
end

View File

@ -5,10 +5,10 @@ module Hardware
features, sse4?
PPC_OPTIMIZATION_FLAGS = {
g3: "-mcpu=750",
g4: "-mcpu=7400",
g4e: "-mcpu=7450",
g5: "-mcpu=970",
g3: "-mcpu=750",
g4: "-mcpu=7400",
g4e: "-mcpu=7450",
g5: "-mcpu=970",
g5_64: "-mcpu=970 -arch ppc64",
}.freeze

View File

@ -111,7 +111,7 @@ class Keg
# Matches framework references like `XXX.framework/Versions/YYY/XXX` and
# `XXX.framework/XXX`, both with or without a slash-delimited prefix.
FRAMEWORK_RX = %r{(?:^|/)(([^/]+)\.framework/(?:Versions/[^/]+/)?\2)$}
FRAMEWORK_RX = %r{(?:^|/)(([^/]+)\.framework/(?:Versions/[^/]+/)?\2)$}.freeze
def find_dylib_suffix_from(bad_name)
if (framework = bad_name.match(FRAMEWORK_RX))

View File

@ -13,8 +13,8 @@ module UnpackStrategy
# Merge ._ files back into extended attributes.
# ._ files inside volumes are automatically merged by ditto.
system_command!("dot_clean",
args: ["-mv", "--keep=dotbar", unpack_dir],
verbose: verbose,
args: ["-mv", "--keep=dotbar", unpack_dir],
verbose: verbose,
print_stderr: false)
end
@ -26,7 +26,7 @@ module UnpackStrategy
# `ditto` keeps Finder attributes intact and does not skip volume labels
# like `unzip` does, which can prevent disk images from being unzipped.
system_command! "ditto",
args: ["-x", "-k", path, tmp_unpack_dir],
args: ["-x", "-k", path, tmp_unpack_dir],
verbose: verbose
volumes.each do |volume|

View File

@ -70,7 +70,7 @@ class Pathname
include DiskUsageExtension
# @private
BOTTLE_EXTNAME_RX = /(\.[a-z0-9_]+\.bottle\.(\d+\.)?tar\.gz)$/
BOTTLE_EXTNAME_RX = /(\.[a-z0-9_]+\.bottle\.(\d+\.)?tar\.gz)$/.freeze
# Moves a file from the original location to the {Pathname}'s.
def install(*sources)

View File

@ -335,7 +335,7 @@ class Formula
:bottled?,
:bottle_specification,
:downloader,
] => :active_spec
] => :active_spec
# The Bottle object for the currently active {SoftwareSpec}.
# @private
@ -994,11 +994,11 @@ class Formula
self.build = Tab.for_formula(self)
new_env = {
"TMPDIR" => HOMEBREW_TEMP,
"TEMP" => HOMEBREW_TEMP,
"TMP" => HOMEBREW_TEMP,
"TMPDIR" => HOMEBREW_TEMP,
"TEMP" => HOMEBREW_TEMP,
"TMP" => HOMEBREW_TEMP,
"HOMEBREW_PATH" => nil,
"PATH" => ENV["HOMEBREW_PATH"],
"PATH" => ENV["HOMEBREW_PATH"],
}
with_env(new_env) do
@ -1569,7 +1569,7 @@ class Formula
def runtime_formula_dependencies(read_from_tab: true, undeclared: true)
runtime_dependencies(
read_from_tab: read_from_tab,
undeclared: undeclared,
undeclared: undeclared,
).map do |d|
begin
d.to_formula
@ -1597,35 +1597,35 @@ class Formula
dependencies = deps
hsh = {
"name" => name,
"full_name" => full_name,
"oldname" => oldname,
"aliases" => aliases.sort,
"versioned_formulae" => versioned_formulae.map(&:name),
"desc" => desc,
"homepage" => homepage,
"versions" => {
"name" => name,
"full_name" => full_name,
"oldname" => oldname,
"aliases" => aliases.sort,
"versioned_formulae" => versioned_formulae.map(&:name),
"desc" => desc,
"homepage" => homepage,
"versions" => {
"stable" => stable&.version&.to_s,
"devel" => devel&.version&.to_s,
"head" => head&.version&.to_s,
"devel" => devel&.version&.to_s,
"head" => head&.version&.to_s,
"bottle" => !bottle_specification.checksums.empty?,
},
"revision" => revision,
"version_scheme" => version_scheme,
"bottle" => {},
"keg_only" => keg_only?,
"options" => [],
"build_dependencies" => dependencies.select(&:build?).map(&:name).uniq,
"dependencies" => dependencies.reject(&:optional?).reject(&:recommended?).reject(&:build?).map(&:name).uniq,
"revision" => revision,
"version_scheme" => version_scheme,
"bottle" => {},
"keg_only" => keg_only?,
"options" => [],
"build_dependencies" => dependencies.select(&:build?).map(&:name).uniq,
"dependencies" => dependencies.reject(&:optional?).reject(&:recommended?).reject(&:build?).map(&:name).uniq,
"recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq,
"optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq,
"requirements" => [],
"conflicts_with" => conflicts.map(&:name),
"caveats" => caveats,
"installed" => [],
"linked_keg" => linked_version&.to_s,
"pinned" => pinned?,
"outdated" => outdated?,
"optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq,
"requirements" => [],
"conflicts_with" => conflicts.map(&:name),
"caveats" => caveats,
"installed" => [],
"linked_keg" => linked_version&.to_s,
"pinned" => pinned?,
"outdated" => outdated?,
}
%w[stable devel].each do |spec_sym|
@ -1634,16 +1634,16 @@ class Formula
bottle_spec = spec.bottle_specification
bottle_info = {
"rebuild" => bottle_spec.rebuild,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
"prefix" => bottle_spec.prefix,
"rebuild" => bottle_spec.rebuild,
"cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? cellar.inspect : cellar,
"prefix" => bottle_spec.prefix,
"root_url" => bottle_spec.root_url,
}
bottle_info["files"] = {}
bottle_spec.collector.keys.each do |os|
checksum = bottle_spec.collector[os]
bottle_info["files"][os] = {
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}",
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}",
checksum.hash_type.to_s => checksum.hexdigest,
}
end
@ -1656,8 +1656,8 @@ class Formula
hsh["requirements"] = requirements.map do |req|
{
"name" => req.name,
"cask" => req.cask,
"name" => req.name,
"cask" => req.cask,
"download" => req.download,
}
end
@ -1666,13 +1666,13 @@ class Formula
tab = Tab.for_keg keg
hsh["installed"] << {
"version" => keg.version.to_s,
"used_options" => tab.used_options.as_flags,
"built_as_bottle" => tab.built_as_bottle,
"poured_from_bottle" => tab.poured_from_bottle,
"runtime_dependencies" => tab.runtime_dependencies,
"version" => keg.version.to_s,
"used_options" => tab.used_options.as_flags,
"built_as_bottle" => tab.built_as_bottle,
"poured_from_bottle" => tab.poured_from_bottle,
"runtime_dependencies" => tab.runtime_dependencies,
"installed_as_dependency" => tab.installed_as_dependency,
"installed_on_request" => tab.installed_on_request,
"installed_on_request" => tab.installed_on_request,
}
end
@ -1696,16 +1696,16 @@ class Formula
@prefix_returns_versioned_prefix = true
test_env = {
CURL_HOME: ENV["CURL_HOME"] || ENV["HOME"],
TMPDIR: HOMEBREW_TEMP,
TEMP: HOMEBREW_TEMP,
TMP: HOMEBREW_TEMP,
TERM: "dumb",
PATH: PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"),
CURL_HOME: ENV["CURL_HOME"] || ENV["HOME"],
TMPDIR: HOMEBREW_TEMP,
TEMP: HOMEBREW_TEMP,
TMP: HOMEBREW_TEMP,
TERM: "dumb",
PATH: PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"),
HOMEBREW_PATH: nil,
_JAVA_OPTIONS: "#{ENV["_JAVA_OPTIONS"]} -Duser.home=#{HOMEBREW_CACHE}/java_cache",
GOCACHE: "#{HOMEBREW_CACHE}/go_cache",
CARGO_HOME: "#{HOMEBREW_CACHE}/cargo_cache",
GOCACHE: "#{HOMEBREW_CACHE}/go_cache",
CARGO_HOME: "#{HOMEBREW_CACHE}/cargo_cache",
}
ENV.clear_sensitive_environment!
@ -1841,7 +1841,7 @@ class Formula
@exec_count += 1
logfn = format("#{logs}/#{active_log_prefix}%02<exec_count>d.%{cmd_base}",
exec_count: @exec_count,
cmd_base: File.basename(cmd).split(" ").first)
cmd_base: File.basename(cmd).split(" ").first)
logs.mkpath
File.open(logfn, "w") do |log|

View File

@ -92,7 +92,7 @@ class FormulaVersions
attributes.each do |attribute|
attributes_map[attribute] ||= {
stable: {},
devel: {},
devel: {},
}
end

View File

@ -104,8 +104,8 @@ module Homebrew
end
end
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})]
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
require "forwardable"
require "PATH"
@ -120,22 +120,22 @@ ORIGINAL_PATHS = PATH.new(ENV["HOMEBREW_PATH"]).map do |p|
end.compact.freeze
HOMEBREW_INTERNAL_COMMAND_ALIASES = {
"ls" => "list",
"homepage" => "home",
"-S" => "search",
"up" => "update",
"ln" => "link",
"instal" => "install", # gem does the same
"uninstal" => "uninstall",
"rm" => "uninstall",
"remove" => "uninstall",
"configure" => "diy",
"abv" => "info",
"dr" => "doctor",
"--repo" => "--repository",
"ls" => "list",
"homepage" => "home",
"-S" => "search",
"up" => "update",
"ln" => "link",
"instal" => "install", # gem does the same
"uninstal" => "uninstall",
"rm" => "uninstall",
"remove" => "uninstall",
"configure" => "diy",
"abv" => "info",
"dr" => "doctor",
"--repo" => "--repository",
"environment" => "--env",
"--config" => "config",
"-v" => "--version",
"--config" => "config",
"-v" => "--version",
}.freeze
require "set"

View File

@ -8,7 +8,7 @@ module Hardware
class << self
OPTIMIZATION_FLAGS = {
core2: "-march=core2",
core: "-march=prescott",
core: "-march=prescott",
armv6: "-march=armv6",
armv8: "-march=armv8-a",
}.freeze

View File

@ -63,8 +63,8 @@ class Keg
end
# locale-specific directories have the form language[_territory][.codeset][@modifier]
LOCALEDIR_RX = %r{(locale|man)/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?}
INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}
LOCALEDIR_RX = %r{(locale|man)/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?}.freeze
INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}.freeze
KEG_LINK_DIRECTORIES = %w[
bin etc include lib sbin share var
].freeze

View File

@ -34,11 +34,11 @@ class Keg
def replace_locations_with_placeholders
relocation = Relocation.new(
old_prefix: HOMEBREW_PREFIX.to_s,
old_cellar: HOMEBREW_CELLAR.to_s,
old_prefix: HOMEBREW_PREFIX.to_s,
old_cellar: HOMEBREW_CELLAR.to_s,
old_repository: HOMEBREW_REPOSITORY.to_s,
new_prefix: PREFIX_PLACEHOLDER,
new_cellar: CELLAR_PLACEHOLDER,
new_prefix: PREFIX_PLACEHOLDER,
new_cellar: CELLAR_PLACEHOLDER,
new_repository: REPOSITORY_PLACEHOLDER,
)
relocate_dynamic_linkage(relocation)
@ -47,11 +47,11 @@ class Keg
def replace_placeholders_with_locations(files, skip_linkage: false)
relocation = Relocation.new(
old_prefix: PREFIX_PLACEHOLDER,
old_cellar: CELLAR_PLACEHOLDER,
old_prefix: PREFIX_PLACEHOLDER,
old_cellar: CELLAR_PLACEHOLDER,
old_repository: REPOSITORY_PLACEHOLDER,
new_prefix: HOMEBREW_PREFIX.to_s,
new_cellar: HOMEBREW_CELLAR.to_s,
new_prefix: HOMEBREW_PREFIX.to_s,
new_cellar: HOMEBREW_CELLAR.to_s,
new_repository: HOMEBREW_REPOSITORY.to_s,
)
relocate_dynamic_linkage(relocation) unless skip_linkage
@ -66,8 +66,8 @@ class Keg
s = first.open("rb", &:read)
replacements = {
relocation.old_prefix => relocation.new_prefix,
relocation.old_cellar => relocation.new_cellar,
relocation.old_prefix => relocation.new_prefix,
relocation.old_cellar => relocation.new_cellar,
relocation.old_repository => relocation.new_repository,
}
changed = s.gsub!(Regexp.union(replacements.keys.sort_by(&:length).reverse), replacements)

View File

@ -2,11 +2,11 @@ class Locale
class ParserError < StandardError
end
LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2
REGION_REGEX = /(?:[A-Z]{2}|\d{3})/ # ISO 3166-1 or UN M.49
SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924
LANGUAGE_REGEX = /(?:[a-z]{2,3})/.freeze # ISO 639-1 or ISO 639-2
REGION_REGEX = /(?:[A-Z]{2}|\d{3})/.freeze # ISO 3166-1 or UN M.49
SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/.freeze # ISO 15924
LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/
LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/.freeze
def self.parse(string)
string = string.to_s

View File

@ -4,7 +4,7 @@ OFFICIAL_CASK_TAPS = %w[
].freeze
OFFICIAL_CMD_TAPS = {
"homebrew/bundle" => ["bundle"],
"homebrew/bundle" => ["bundle"],
"homebrew/test-bot" => ["test-bot"],
"homebrew/services" => ["services"],
}.freeze

View File

@ -4,18 +4,18 @@ module OS
module Mac
class Version < ::Version
SYMBOLS = {
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
yosemite: "10.10",
mavericks: "10.9",
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
yosemite: "10.10",
mavericks: "10.9",
mountain_lion: "10.8",
lion: "10.7",
snow_leopard: "10.6",
leopard_64: "10.5",
leopard: "10.5",
tiger: "10.4",
lion: "10.7",
snow_leopard: "10.6",
leopard_64: "10.5",
leopard: "10.5",
tiger: "10.4",
}.freeze
def self.from_symbol(sym)

View File

@ -11,21 +11,21 @@ module OS
FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze
PKGINFO_VERSION_MAP = {
"2.6.34" => "2.6.3",
"2.7.4" => "2.7.0",
"2.7.14" => "2.7.1",
"2.7.28" => "2.7.2",
"2.7.32" => "2.7.3",
"2.7.43" => "2.7.4",
"2.7.50" => "2.7.5_rc1",
"2.7.51" => "2.7.5_rc2",
"2.7.52" => "2.7.5_rc3",
"2.7.53" => "2.7.5_rc4",
"2.7.54" => "2.7.5",
"2.7.61" => "2.7.6",
"2.7.73" => "2.7.7",
"2.7.86" => "2.7.8",
"2.7.94" => "2.7.9",
"2.6.34" => "2.6.3",
"2.7.4" => "2.7.0",
"2.7.14" => "2.7.1",
"2.7.28" => "2.7.2",
"2.7.32" => "2.7.3",
"2.7.43" => "2.7.4",
"2.7.50" => "2.7.5_rc1",
"2.7.51" => "2.7.5_rc2",
"2.7.52" => "2.7.5_rc3",
"2.7.53" => "2.7.5_rc4",
"2.7.54" => "2.7.5",
"2.7.61" => "2.7.6",
"2.7.73" => "2.7.7",
"2.7.86" => "2.7.8",
"2.7.94" => "2.7.9",
"2.7.108" => "2.7.10",
"2.7.112" => "2.7.11",
}.freeze

View File

@ -3,7 +3,7 @@ require "version"
class PkgVersion
include Comparable
RX = /\A(.+?)(?:_(\d+))?\z/
RX = /\A(.+?)(?:_(\d+))?\z/.freeze
attr_reader :version, :revision

View File

@ -58,7 +58,7 @@ class JavaRequirement < Requirement
private
JAVA_CASK_MAP = {
"1.8" => "homebrew/cask-versions/java8",
"1.8" => "homebrew/cask-versions/java8",
"11.0" => "java",
}.freeze

View File

@ -54,7 +54,7 @@ module RuboCop
corrector.remove(
range_with_surrounding_comma(
range_with_surrounding_space(range: node.source_range,
side: :left),
side: :left),
),
)
end

View File

@ -37,9 +37,9 @@ module Homebrew
matches = begin
GitHub.search_code(
user: "Homebrew",
path: ["Formula", "Casks", "."],
filename: query,
user: "Homebrew",
path: ["Formula", "Casks", "."],
filename: query,
extension: "rb",
)
rescue GitHub::Error => error

View File

@ -117,11 +117,11 @@ class SystemConfig
f.puts "Core tap: N/A"
end
defaults_hash = {
HOMEBREW_PREFIX: Homebrew::DEFAULT_PREFIX,
HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY,
HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR,
HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew",
HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"],
HOMEBREW_PREFIX: Homebrew::DEFAULT_PREFIX,
HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY,
HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR,
HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew",
HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"],
HOMEBREW_RUBY_WARNINGS: "-W0",
}.freeze
boring_keys = %w[

View File

@ -19,29 +19,29 @@ class Tab < OpenStruct
build = formula.build
runtime_deps = formula.runtime_dependencies(undeclared: false)
attributes = {
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => build.used_options.as_flags,
"unused_options" => build.unused_options.as_flags,
"tabfile" => formula.prefix/FILENAME,
"built_as_bottle" => build.bottle?,
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => build.used_options.as_flags,
"unused_options" => build.unused_options.as_flags,
"tabfile" => formula.prefix/FILENAME,
"built_as_bottle" => build.bottle?,
"installed_as_dependency" => false,
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => Time.now.to_i,
"source_modified_time" => formula.source_modified_time.to_i,
"HEAD" => HOMEBREW_REPOSITORY.git_head,
"compiler" => compiler,
"stdlib" => stdlib,
"aliases" => formula.aliases,
"runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps),
"source" => {
"path" => formula.specified_path.to_s,
"tap" => formula.tap&.name,
"spec" => formula.active_spec_sym.to_s,
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => Time.now.to_i,
"source_modified_time" => formula.source_modified_time.to_i,
"HEAD" => HOMEBREW_REPOSITORY.git_head,
"compiler" => compiler,
"stdlib" => stdlib,
"aliases" => formula.aliases,
"runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps),
"source" => {
"path" => formula.specified_path.to_s,
"tap" => formula.tap&.name,
"spec" => formula.active_spec_sym.to_s,
"versions" => {
"stable" => formula.stable&.version.to_s,
"devel" => formula.devel&.version.to_s,
"head" => formula.head&.version.to_s,
"stable" => formula.stable&.version.to_s,
"devel" => formula.devel&.version.to_s,
"head" => formula.head&.version.to_s,
"version_scheme" => formula.version_scheme,
},
},
@ -88,9 +88,9 @@ class Tab < OpenStruct
if attributes["source"]["versions"].nil?
attributes["source"]["versions"] = {
"stable" => nil,
"devel" => nil,
"head" => nil,
"stable" => nil,
"devel" => nil,
"head" => nil,
"version_scheme" => 0,
}
end
@ -158,13 +158,13 @@ class Tab < OpenStruct
tab = empty
tab.unused_options = f.options.as_flags
tab.source = {
"path" => f.specified_path.to_s,
"tap" => f.tap&.name,
"spec" => f.active_spec_sym.to_s,
"path" => f.specified_path.to_s,
"tap" => f.tap&.name,
"spec" => f.active_spec_sym.to_s,
"versions" => {
"stable" => f.stable&.version.to_s,
"devel" => f.devel&.version.to_s,
"head" => f.head&.version.to_s,
"stable" => f.stable&.version.to_s,
"devel" => f.devel&.version.to_s,
"head" => f.head&.version.to_s,
"version_scheme" => f.version_scheme,
},
}
@ -175,28 +175,28 @@ class Tab < OpenStruct
def self.empty
attributes = {
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => [],
"unused_options" => [],
"built_as_bottle" => false,
"homebrew_version" => HOMEBREW_VERSION,
"used_options" => [],
"unused_options" => [],
"built_as_bottle" => false,
"installed_as_dependency" => false,
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => nil,
"source_modified_time" => 0,
"HEAD" => nil,
"stdlib" => nil,
"compiler" => DevelopmentTools.default_compiler,
"aliases" => [],
"runtime_dependencies" => nil,
"source" => {
"path" => nil,
"tap" => nil,
"spec" => "stable",
"installed_on_request" => true,
"poured_from_bottle" => false,
"time" => nil,
"source_modified_time" => 0,
"HEAD" => nil,
"stdlib" => nil,
"compiler" => DevelopmentTools.default_compiler,
"aliases" => [],
"runtime_dependencies" => nil,
"source" => {
"path" => nil,
"tap" => nil,
"spec" => "stable",
"versions" => {
"stable" => nil,
"devel" => nil,
"head" => nil,
"stable" => nil,
"devel" => nil,
"head" => nil,
"version_scheme" => 0,
},
},
@ -330,22 +330,22 @@ class Tab < OpenStruct
def to_json
attributes = {
"homebrew_version" => homebrew_version,
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
"built_as_bottle" => built_as_bottle,
"poured_from_bottle" => poured_from_bottle,
"homebrew_version" => homebrew_version,
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
"built_as_bottle" => built_as_bottle,
"poured_from_bottle" => poured_from_bottle,
"installed_as_dependency" => installed_as_dependency,
"installed_on_request" => installed_on_request,
"changed_files" => changed_files&.map(&:to_s),
"time" => time,
"source_modified_time" => source_modified_time.to_i,
"HEAD" => self.HEAD,
"stdlib" => (stdlib&.to_s),
"compiler" => (compiler&.to_s),
"aliases" => aliases,
"runtime_dependencies" => runtime_dependencies,
"source" => source,
"installed_on_request" => installed_on_request,
"changed_files" => changed_files&.map(&:to_s),
"time" => time,
"source_modified_time" => source_modified_time.to_i,
"HEAD" => self.HEAD,
"stdlib" => (stdlib&.to_s),
"compiler" => (compiler&.to_s),
"aliases" => aliases,
"runtime_dependencies" => runtime_dependencies,
"source" => source,
}
JSON.generate(attributes)

View File

@ -531,16 +531,16 @@ class Tap
def to_hash
hash = {
"name" => name,
"user" => user,
"repo" => repo,
"path" => path.to_s,
"installed" => installed?,
"official" => official?,
"name" => name,
"user" => user,
"repo" => repo,
"path" => path.to_s,
"installed" => installed?,
"official" => official?,
"formula_names" => formula_names,
"formula_files" => formula_files.map(&:to_s),
"command_files" => command_files.map(&:to_s),
"pinned" => pinned?,
"pinned" => pinned?,
}
if installed?

View File

@ -1,10 +1,10 @@
# match taps' formulae, e.g. someuser/sometap/someformula
HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}
HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze
# match taps' casks, e.g. someuser/sometap/somecask
HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}
HOMEBREW_TAP_CASK_REGEX = %r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}.freeze
# 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-]+)}
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
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
# 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+-.]+)$}
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze

View File

@ -12,12 +12,12 @@ describe Cask::Artifact::Pkg, :cask do
expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/installer",
args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/"],
sudo: true,
args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/"],
sudo: true,
print_stdout: true,
env: {
"LOGNAME" => ENV["USER"],
"USER" => ENV["USER"],
env: {
"LOGNAME" => ENV["USER"],
"USER" => ENV["USER"],
"USERNAME" => ENV["USER"],
},
)
@ -57,16 +57,16 @@ describe Cask::Artifact::Pkg, :cask do
expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/installer",
args: [
args: [
"-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"),
"-target", "/", "-applyChoiceChangesXML",
cask.staged_path.join("/tmp/choices.xml")
],
sudo: true,
sudo: true,
print_stdout: true,
env: {
"LOGNAME" => ENV["USER"],
"USER" => ENV["USER"],
env: {
"LOGNAME" => ENV["USER"],
"USER" => ENV["USER"],
"USERNAME" => ENV["USER"],
},
)

View File

@ -236,10 +236,10 @@ shared_examples "#uninstall_phase or #zap_phase" do
expect(fake_system_command).to receive(:run).with(
cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"),
args: ["--please"],
args: ["--please"],
must_succeed: true,
print_stdout: true,
sudo: false,
sudo: false,
)
InstallHelper.install_without_artifacts(cask)

View File

@ -49,11 +49,11 @@ describe "brew outdated", :integration_test do
expected_json = [
{
name: "testball",
name: "testball",
installed_versions: ["0.0.1"],
current_version: "0.1",
pinned: true,
pinned_version: "0.0.1",
current_version: "0.1",
pinned: true,
pinned_version: "0.0.1",
},
].to_json
@ -69,11 +69,11 @@ describe "brew outdated", :integration_test do
expected_json = [
{
name: "testball",
name: "testball",
installed_versions: ["0.0.1"],
current_version: "0.1",
pinned: false,
pinned_version: nil,
current_version: "0.1",
pinned: false,
pinned_version: nil,
},
].to_json

View File

@ -50,11 +50,11 @@ describe "brew search", :integration_test do
{
"macports" => "https://www.macports.org/ports.php?by=name&substr=testball",
"fink" => "http://pdb.finkproject.org/pdb/browse.php?summary=testball",
"debian" => "https://packages.debian.org/search?keywords=testball&searchon=names&suite=all&section=all",
"fink" => "http://pdb.finkproject.org/pdb/browse.php?summary=testball",
"debian" => "https://packages.debian.org/search?keywords=testball&searchon=names&suite=all&section=all",
"opensuse" => "https://software.opensuse.org/search?q=testball",
"fedora" => "https://apps.fedoraproject.org/packages/s/testball",
"ubuntu" => "https://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all&section=all",
"fedora" => "https://apps.fedoraproject.org/packages/s/testball",
"ubuntu" => "https://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all&section=all",
}.each do |flag, url|
specify "--#{flag}" do
expect { brew "search", "--#{flag}", "testball", "HOMEBREW_BROWSER" => "echo" }

View File

@ -11,8 +11,8 @@ describe CompilerSelector do
double(
gcc_4_0_build_version: Version::NULL,
gcc_4_2_build_version: Version.create("5666"),
llvm_build_version: Version::NULL,
clang_build_version: Version.create("425"),
llvm_build_version: Version::NULL,
clang_build_version: Version.create("425"),
)
end

View File

@ -99,11 +99,11 @@ describe "GitHubPrivateRepositoryReleaseDownloadStrategy", :needs_compat do
release_metadata = {
"assets" => [
{
"id" => 123,
"id" => 123,
"name" => "foo_v0.1.0_linux_amd64.tar.gz",
},
{
"id" => 456,
"id" => 456,
"name" => "foo_v0.1.0_darwin_amd64.tar.gz",
},
],

View File

@ -11,11 +11,11 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
end
RUBY
expected_offenses = [{ message: "Formula should have a homepage.",
expected_offenses = [{ message: "Formula should have a homepage.",
severity: :convention,
line: 1,
column: 0,
source: source }]
line: 1,
column: 0,
source: source }]
inspect_source(source)
@ -32,11 +32,11 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
end
RUBY
expected_offenses = [{ message: "The homepage should start with http or https (URL is ftp://example.com/foo).",
expected_offenses = [{ message: "The homepage should start with http or https (URL is ftp://example.com/foo).",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
inspect_source(source)
@ -47,18 +47,18 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
it "Homepage URLs" do
formula_homepages = {
"bar" => "http://www.freedesktop.org/wiki/bar",
"baz" => "http://www.freedesktop.org/wiki/Software/baz",
"qux" => "https://code.google.com/p/qux",
"quux" => "http://github.com/quux",
"corge" => "http://savannah.nongnu.org/corge",
"bar" => "http://www.freedesktop.org/wiki/bar",
"baz" => "http://www.freedesktop.org/wiki/Software/baz",
"qux" => "https://code.google.com/p/qux",
"quux" => "http://github.com/quux",
"corge" => "http://savannah.nongnu.org/corge",
"grault" => "http://grault.github.io/",
"garply" => "http://www.gnome.org/garply",
"sf1" => "http://foo.sourceforge.net/",
"sf2" => "http://foo.sourceforge.net",
"sf3" => "http://foo.sf.net/",
"sf4" => "http://foo.sourceforge.io/",
"waldo" => "http://www.gnu.org/waldo",
"sf1" => "http://foo.sourceforge.net/",
"sf2" => "http://foo.sourceforge.net",
"sf3" => "http://foo.sf.net/",
"sf4" => "http://foo.sourceforge.io/",
"waldo" => "http://www.gnu.org/waldo",
}
formula_homepages.each do |name, homepage|
@ -72,38 +72,38 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
inspect_source(source)
if homepage =~ %r{http:\/\/www\.freedesktop\.org}
if homepage =~ /Software/
expected_offenses = [{ message: "#{homepage} should be styled " \
expected_offenses = [{ message: "#{homepage} should be styled " \
"`https://wiki.freedesktop.org/www/Software/project_name`",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
else
expected_offenses = [{ message: "#{homepage} should be styled " \
"`https://wiki.freedesktop.org/project_name`",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
end
elsif homepage =~ %r{https:\/\/code\.google\.com}
expected_offenses = [{ message: "#{homepage} should end with a slash",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
elsif homepage =~ /foo\.(sf|sourceforge)\.net/
expected_offenses = [{ message: "#{homepage} should be `https://foo.sourceforge.io/`",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
else
expected_offenses = [{ message: "Please use https:// for #{homepage}",
severity: :convention,
line: 2,
column: 2,
source: source }]
line: 2,
column: 2,
source: source }]
end
expected_offenses.zip([cop.offenses.last]).each do |expected, actual|
expect_offense(expected, actual)

View File

@ -48,66 +48,66 @@ describe RuboCop::Cop::FormulaAudit::Patches do
inspect_source(source)
expected_offense = if patch_url =~ %r{/raw\.github\.com/}
[{ message:
<<~EOS.chomp,
GitHub/Gist patches should specify a revision:
#{patch_url}
EOS
<<~EOS.chomp,
GitHub/Gist patches should specify a revision:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 12,
source: source }]
line: 5,
column: 12,
source: source }]
elsif patch_url =~ %r{macports/trunk}
[{ message:
<<~EOS.chomp,
MacPorts patches should specify a revision instead of trunk:
#{patch_url}
EOS
<<~EOS.chomp,
MacPorts patches should specify a revision instead of trunk:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 33,
source: source }]
line: 5,
column: 33,
source: source }]
elsif patch_url =~ %r{^http://trac\.macports\.org}
[{ message:
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
#{patch_url}
EOS
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 5,
source: source }]
line: 5,
column: 5,
source: source }]
elsif patch_url =~ %r{^http://bugs\.debian\.org}
[{ message:
<<~EOS.chomp,
Patches from Debian should be https://, not http:
#{patch_url}
EOS
<<~EOS.chomp,
Patches from Debian should be https://, not http:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 5,
source: source }]
line: 5,
column: 5,
source: source }]
elsif patch_url =~ %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}
[{ message:
<<~EOS,
use GitHub pull request URLs:
https://github.com/foo/foo-bar/pull/100.patch
Rather than patch-diff:
https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch
EOS
<<~EOS,
use GitHub pull request URLs:
https://github.com/foo/foo-bar/pull/100.patch
Rather than patch-diff:
https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch
EOS
severity: :convention,
line: 5,
column: 5,
source: source }]
line: 5,
column: 5,
source: source }]
elsif patch_url =~ %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)}
[{ message:
<<~EOS,
GitHub patches should use the full_index parameter:
#{patch_url}?full_index=1
EOS
<<~EOS,
GitHub patches should use the full_index parameter:
#{patch_url}?full_index=1
EOS
severity: :convention,
line: 5,
column: 5,
source: source }]
line: 5,
column: 5,
source: source }]
end
expected_offense.zip([cop.offenses.last]).each do |expected, actual|
expect(actual.message).to eq(expected[:message])
@ -133,20 +133,20 @@ describe RuboCop::Cop::FormulaAudit::Patches do
end
RUBY
expected_offenses = [{ message: "Use the patch DSL instead of defining a 'patches' method",
expected_offenses = [{ message: "Use the patch DSL instead of defining a 'patches' method",
severity: :convention,
line: 4,
column: 2,
source: source },
line: 4,
column: 2,
source: source },
{ message:
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/
EOS
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
http://trac.macports.org/export/68507/trunk/dports/net/trafshow/files/
EOS
severity: :convention,
line: 8,
column: 26,
source: source }]
line: 8,
column: 26,
source: source }]
inspect_source(source)
@ -183,56 +183,56 @@ describe RuboCop::Cop::FormulaAudit::Patches do
inspect_source(source)
expected_offense = if patch_url =~ %r{/raw\.github\.com/}
[{ message:
<<~EOS.chomp,
GitHub/Gist patches should specify a revision:
#{patch_url}
EOS
<<~EOS.chomp,
GitHub/Gist patches should specify a revision:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 16,
source: source }]
line: 5,
column: 16,
source: source }]
elsif patch_url =~ %r{macports/trunk}
[{ message:
<<~EOS.chomp,
MacPorts patches should specify a revision instead of trunk:
#{patch_url}
EOS
<<~EOS.chomp,
MacPorts patches should specify a revision instead of trunk:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 37,
source: source }]
line: 5,
column: 37,
source: source }]
elsif patch_url =~ %r{^http://trac\.macports\.org}
[{ message:
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
#{patch_url}
EOS
<<~EOS.chomp,
Patches from MacPorts Trac should be https://, not http:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 9,
source: source }]
line: 5,
column: 9,
source: source }]
elsif patch_url =~ %r{^http://bugs\.debian\.org}
[{ message:
<<~EOS.chomp,
Patches from Debian should be https://, not http:
#{patch_url}
EOS
<<~EOS.chomp,
Patches from Debian should be https://, not http:
#{patch_url}
EOS
severity: :convention,
line: 5,
column: 9,
source: source }]
line: 5,
column: 9,
source: source }]
elsif patch_url =~ %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}
[{ message:
<<~EOS,
use GitHub pull request URLs:
https://github.com/foo/foo-bar/pull/100.patch
Rather than patch-diff:
https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch
EOS
<<~EOS,
use GitHub pull request URLs:
https://github.com/foo/foo-bar/pull/100.patch
Rather than patch-diff:
https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch
EOS
severity: :convention,
line: 5,
column: 9,
source: source }]
line: 5,
column: 9,
source: source }]
end
expected_offense.zip([cop.offenses.last]).each do |expected, actual|
expect(actual.message).to eq(expected[:message])

View File

@ -149,11 +149,11 @@ describe RuboCop::Cop::FormulaAudit::Urls do
url "#{formula["url"]}"
end
RUBY
expected_offenses = [{ message: formula["msg"],
expected_offenses = [{ message: formula["msg"],
severity: :convention,
line: 3,
column: formula["col"],
source: source }]
line: 3,
column: formula["col"],
source: source }]
inspect_source(source)

View File

@ -28,13 +28,13 @@ describe Homebrew::Search do
json_response = {
"items" => [
{
"path" => "Formula/some-formula.rb",
"path" => "Formula/some-formula.rb",
"repository" => {
"full_name" => "Homebrew/homebrew-foo",
},
},
{
"path" => "Casks/some-cask.rb",
"path" => "Casks/some-cask.rb",
"repository" => {
"full_name" => "Homebrew/homebrew-bar",
},

View File

@ -159,9 +159,9 @@ describe BottleSpecification do
specify "#sha256" do
checksums = {
snow_leopard_32: "deadbeef" * 8,
snow_leopard: "faceb00c" * 8,
lion: "baadf00d" * 8,
mountain_lion: "8badf00d" * 8,
snow_leopard: "faceb00c" * 8,
lion: "baadf00d" * 8,
mountain_lion: "8badf00d" * 8,
}
checksums.each_pair do |cat, digest|

View File

@ -72,13 +72,13 @@ RSpec.shared_context "integration test" do
].compact.join(File::PATH_SEPARATOR)
env.merge!(
"PATH" => path,
"HOMEBREW_PATH" => path,
"HOMEBREW_BREW_FILE" => HOMEBREW_PREFIX/"bin/brew",
"PATH" => path,
"HOMEBREW_PATH" => path,
"HOMEBREW_BREW_FILE" => HOMEBREW_PREFIX/"bin/brew",
"HOMEBREW_INTEGRATION_TEST" => command_id_from_args(args),
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
"HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
"GEM_HOME" => nil,
"HOMEBREW_TEST_TMPDIR" => TEST_TMPDIR,
"HOMEBREW_DEVELOPER" => ENV["HOMEBREW_DEVELOPER"],
"GEM_HOME" => nil,
)
@ruby_args ||= begin

View File

@ -3,10 +3,10 @@ describe SystemCommand do
subject(:command) {
described_class.new(
"env",
args: env_args,
env: env,
args: env_args,
env: env,
must_succeed: true,
sudo: sudo,
sudo: sudo,
)
}

View File

@ -31,13 +31,13 @@ describe Tab do
"stdlib" => "libcxx",
"runtime_dependencies" => [],
"source" => {
"tap" => CoreTap.instance.to_s,
"path" => CoreTap.instance.path.to_s,
"spec" => "stable",
"tap" => CoreTap.instance.to_s,
"path" => CoreTap.instance.path.to_s,
"spec" => "stable",
"versions" => {
"stable" => "0.10",
"devel" => "0.14",
"head" => "HEAD-1111111",
"devel" => "0.14",
"head" => "HEAD-1111111",
},
},
)

View File

@ -32,9 +32,9 @@ describe GitHub do
describe "::search_issues", :needs_network do
it "queries GitHub issues with the passed parameters" do
results = subject.search_issues("brew search",
repo: "Homebrew/legacy-homebrew",
repo: "Homebrew/legacy-homebrew",
author: "MikeMcQuaid",
is: "closed")
is: "closed")
expect(results).not_to be_empty
expect(results.first["title"]).to eq("Shall we run `brew update` automatically?")
end

View File

@ -246,7 +246,7 @@ describe "globally-scoped helper methods" do
expect {
odeprecated(
"method", "replacement",
caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
disable: true
)
}.to raise_error(

View File

@ -66,8 +66,8 @@ module UnpackStrategy
def self.from_type(type)
type = {
naked: :uncompressed,
nounzip: :uncompressed,
naked: :uncompressed,
nounzip: :uncompressed,
seven_zip: :p7zip,
}.fetch(type, type)

View File

@ -28,7 +28,7 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! AIR_APPLICATION_INSTALLER,
args: ["-silent", "-location", unpack_dir, path],
args: ["-silent", "-location", unpack_dir, path],
verbose: verbose
end
end

View File

@ -18,7 +18,7 @@ module UnpackStrategy
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ? [] : ["-q"]
system_command! "bunzip2",
args: [*quiet_flags, unpack_dir/basename],
args: [*quiet_flags, unpack_dir/basename],
verbose: verbose
end
end

View File

@ -14,8 +14,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "cabextract",
args: ["-d", unpack_dir, "--", path],
env: { "PATH" => PATH.new(Formula["cabextract"].opt_bin, ENV["PATH"]) },
args: ["-d", unpack_dir, "--", path],
env: { "PATH" => PATH.new(Formula["cabextract"].opt_bin, ENV["PATH"]) },
verbose: verbose
end

View File

@ -17,7 +17,7 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
path.children.each do |child|
system_command! "cp",
args: ["-pR", child.directory? ? "#{child}/." : child, unpack_dir/child.basename],
args: ["-pR", child.directory? ? "#{child}/." : child, unpack_dir/child.basename],
verbose: verbose
end
end

View File

@ -58,14 +58,14 @@ module UnpackStrategy
if tries > 1
system_command! "diskutil",
args: ["eject", path],
args: ["eject", path],
print_stderr: false,
verbose: verbose
verbose: verbose
else
system_command! "diskutil",
args: ["unmount", "force", path],
args: ["unmount", "force", path],
print_stderr: false,
verbose: verbose
verbose: verbose
end
rescue ErrorDuringExecution => e
raise e if (tries -= 1).zero?
@ -85,12 +85,12 @@ module UnpackStrategy
filelist.close
system_command! "mkbom",
args: ["-s", "-i", filelist.path, "--", bomfile.path],
args: ["-s", "-i", filelist.path, "--", bomfile.path],
verbose: verbose
end
system_command! "ditto",
args: ["--bom", bomfile.path, "--", path, unpack_dir],
args: ["--bom", bomfile.path, "--", path, unpack_dir],
verbose: verbose
FileUtils.chmod "u+w", Pathname.glob(unpack_dir/"**/*", File::FNM_DOTMATCH).reject(&:symlink?)
@ -105,7 +105,7 @@ module UnpackStrategy
def self.can_extract?(path)
imageinfo = system_command("hdiutil",
args: ["imageinfo", path],
args: ["imageinfo", path],
print_stderr: false).stdout
!imageinfo.empty?
@ -129,13 +129,13 @@ module UnpackStrategy
without_eula = system_command(
"hdiutil",
args: [
args: [
"attach", "-plist", "-nobrowse", "-readonly", "-noidme",
"-mountrandom", mount_dir, path
],
input: "qn\n",
input: "qn\n",
print_stderr: false,
verbose: verbose,
verbose: verbose,
)
# If mounting without agreeing to EULA succeeded, there is none.
@ -148,7 +148,7 @@ module UnpackStrategy
system_command!(
"hdiutil",
args: [
args: [
"convert", *quiet_flag, "-format", "UDTO", "-o", cdr_path, path
],
verbose: verbose,
@ -156,7 +156,7 @@ module UnpackStrategy
with_eula = system_command!(
"hdiutil",
args: [
args: [
"attach", "-plist", "-nobrowse", "-readonly", "-noidme",
"-mountrandom", mount_dir, cdr_path
],

View File

@ -26,9 +26,9 @@ module UnpackStrategy
end
system_command! "fossil",
args: ["open", path, *args],
chdir: unpack_dir,
env: { "PATH" => PATH.new(Formula["fossil"].opt_bin, ENV["PATH"]) },
args: ["open", path, *args],
chdir: unpack_dir,
env: { "PATH" => PATH.new(Formula["fossil"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -20,11 +20,11 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "unar",
args: [
args: [
"-force-overwrite", "-quiet", "-no-directory",
"-output-directory", unpack_dir, "--", path
],
env: { "PATH" => PATH.new(Formula["unar"].opt_bin, ENV["PATH"]) },
env: { "PATH" => PATH.new(Formula["unar"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -18,7 +18,7 @@ module UnpackStrategy
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ? [] : ["-q"]
system_command! "gunzip",
args: [*quiet_flags, "-N", "--", unpack_dir/basename],
args: [*quiet_flags, "-N", "--", unpack_dir/basename],
verbose: verbose
end
end

View File

@ -20,8 +20,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "lha",
args: ["xq2w=#{unpack_dir}", path],
env: { "PATH" => PATH.new(Formula["lha"].opt_bin, ENV["PATH"]) },
args: ["xq2w=#{unpack_dir}", path],
env: { "PATH" => PATH.new(Formula["lha"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -22,8 +22,8 @@ module UnpackStrategy
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ? [] : ["-q"]
system_command! "lzip",
args: ["-d", *quiet_flags, unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["lzip"].opt_bin, ENV["PATH"]) },
args: ["-d", *quiet_flags, unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["lzip"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -16,8 +16,8 @@ module UnpackStrategy
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ? [] : ["-q"]
system_command! "unlzma",
args: [*quiet_flags, "--", unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) },
args: [*quiet_flags, "--", unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) },
verbose: verbose
end

View File

@ -12,8 +12,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "hg",
args: ["--cwd", path, "archive", "--subrepos", "-y", "-t", "files", unpack_dir],
env: { "PATH" => PATH.new(Formula["mercurial"].opt_bin, ENV["PATH"]) },
args: ["--cwd", path, "archive", "--subrepos", "-y", "-t", "files", unpack_dir],
env: { "PATH" => PATH.new(Formula["mercurial"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -20,8 +20,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "7zr",
args: ["x", "-y", "-bd", "-bso0", path, "-o#{unpack_dir}"],
env: { "PATH" => PATH.new(Formula["p7zip"].opt_bin, ENV["PATH"]) },
args: ["x", "-y", "-bd", "-bso0", path, "-o#{unpack_dir}"],
env: { "PATH" => PATH.new(Formula["p7zip"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -16,8 +16,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "pax",
args: ["-rf", path],
chdir: unpack_dir,
args: ["-rf", path],
chdir: unpack_dir,
verbose: verbose
end
end

View File

@ -20,8 +20,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "unrar",
args: ["x", "-inul", path, unpack_dir],
env: { "PATH" => PATH.new(Formula["unrar"].opt_bin, ENV["PATH"]) },
args: ["x", "-inul", path, unpack_dir],
env: { "PATH" => PATH.new(Formula["unrar"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -12,8 +12,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "svn",
args: ["export", "--force", ".", unpack_dir],
chdir: path.to_s,
args: ["export", "--force", ".", unpack_dir],
chdir: path.to_s,
verbose: verbose
end
end

View File

@ -40,7 +40,7 @@ module UnpackStrategy
end
system_command! "tar",
args: ["xf", tar_path, "-C", unpack_dir],
args: ["xf", tar_path, "-C", unpack_dir],
verbose: verbose
end
end

View File

@ -16,7 +16,7 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "xar",
args: ["-x", "-f", path, "-C", unpack_dir],
args: ["-x", "-f", path, "-C", unpack_dir],
verbose: verbose
end
end

View File

@ -22,8 +22,8 @@ module UnpackStrategy
FileUtils.cp path, unpack_dir/basename, preserve: true
quiet_flags = verbose ? [] : ["-q"]
system_command! "unxz",
args: [*quiet_flags, "-T0", "--", unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) },
args: [*quiet_flags, "-T0", "--", unpack_dir/basename],
env: { "PATH" => PATH.new(Formula["xz"].opt_bin, ENV["PATH"]) },
verbose: verbose
end
end

View File

@ -17,8 +17,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:)
quiet_flags = verbose ? [] : ["-qq"]
result = system_command! "unzip",
args: [*quiet_flags, path, "-d", unpack_dir],
verbose: verbose,
args: [*quiet_flags, path, "-d", unpack_dir],
verbose: verbose,
print_stderr: false
FileUtils.rm_rf unpack_dir/"__MACOSX"

View File

@ -42,9 +42,9 @@ def curl(*args)
# SSL_CERT_FILE can be incorrectly set by users or portable-ruby and screw
# with SSL downloads so unset it here.
system_command! curl_executable,
args: curl_args(*args),
args: curl_args(*args),
print_stdout: true,
env: { "SSL_CERT_FILE" => nil }
env: { "SSL_CERT_FILE" => nil }
end
def curl_download(*args, to: nil, **options)
@ -65,7 +65,7 @@ end
def curl_output(*args, **options)
system_command(curl_executable,
args: curl_args(*args, show_output: true, **options),
args: curl_args(*args, show_output: true, **options),
print_stderr: false)
end
@ -155,10 +155,10 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
output_hash = Digest::SHA256.digest(output) if hash_needed
{
status: status_code,
etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2],
status: status_code,
etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2],
content_length: headers[/Content-Length: (\d+)/, 1],
file_hash: output_hash,
file: output,
file_hash: output_hash,
file: output,
}
end

View File

@ -64,15 +64,15 @@ module Utils
SHELL_PROFILE_MAP = {
bash: "~/.bash_profile",
csh: "~/.cshrc",
csh: "~/.cshrc",
fish: "~/.config/fish/config.fish",
ksh: "~/.kshrc",
sh: "~/.bash_profile",
ksh: "~/.kshrc",
sh: "~/.bash_profile",
tcsh: "~/.tcshrc",
zsh: "~/.zshrc",
zsh: "~/.zshrc",
}.freeze
UNSAFE_SHELL_CHAR = %r{([^A-Za-z0-9_\-.,:/@~\n])}
UNSAFE_SHELL_CHAR = %r{([^A-Za-z0-9_\-.,:/@~\n])}.freeze
def csh_quote(str)
# ruby's implementation of shell_escape

View File

@ -19,22 +19,22 @@ module Tty
end
COLOR_CODES = {
red: 31,
green: 32,
yellow: 33,
blue: 34,
red: 31,
green: 32,
yellow: 33,
blue: 34,
magenta: 35,
cyan: 36,
cyan: 36,
default: 39,
}.freeze
STYLE_CODES = {
reset: 0,
bold: 1,
italic: 3,
underline: 4,
reset: 0,
bold: 1,
italic: 3,
underline: 4,
strikethrough: 9,
no_underline: 24,
no_underline: 24,
}.freeze
CODES = COLOR_CODES.merge(STYLE_CODES).freeze

View File

@ -55,7 +55,7 @@ class Version
NULL_TOKEN = NullToken.new
class StringToken < Token
PATTERN = /[a-z]+[0-9]*/i
PATTERN = /[a-z]+[0-9]*/i.freeze
def initialize(value)
@value = value.to_s
@ -72,7 +72,7 @@ class Version
end
class NumericToken < Token
PATTERN = /[0-9]+/i
PATTERN = /[0-9]+/i.freeze
def initialize(value)
@value = value.to_i
@ -101,7 +101,7 @@ class Version
end
class AlphaToken < CompositeToken
PATTERN = /alpha[0-9]*|a[0-9]+/i
PATTERN = /alpha[0-9]*|a[0-9]+/i.freeze
def <=>(other)
case other
@ -116,7 +116,7 @@ class Version
end
class BetaToken < CompositeToken
PATTERN = /beta[0-9]*|b[0-9]+/i
PATTERN = /beta[0-9]*|b[0-9]+/i.freeze
def <=>(other)
case other
@ -133,7 +133,7 @@ class Version
end
class PreToken < CompositeToken
PATTERN = /pre[0-9]*/i
PATTERN = /pre[0-9]*/i.freeze
def <=>(other)
case other
@ -150,7 +150,7 @@ class Version
end
class RCToken < CompositeToken
PATTERN = /rc[0-9]*/i
PATTERN = /rc[0-9]*/i.freeze
def <=>(other)
case other
@ -167,7 +167,7 @@ class Version
end
class PatchToken < CompositeToken
PATTERN = /p[0-9]*/i
PATTERN = /p[0-9]*/i.freeze
def <=>(other)
case other