Merge pull request #5240 from MikeMcQuaid/rubocop-bump

RuboCop 0.60.0
This commit is contained in:
Mike McQuaid 2018-11-04 11:48:51 +00:00 committed by GitHub
commit bada451a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
328 changed files with 11438 additions and 604 deletions

4
.gitignore vendored
View File

@ -36,10 +36,8 @@
**/vendor/bundle-standalone/ruby/*/gems/activesupport-*/lib **/vendor/bundle-standalone/ruby/*/gems/activesupport-*/lib
**/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib **/vendor/bundle-standalone/ruby/*/gems/concurrent-ruby-*/lib
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib **/vendor/bundle-standalone/ruby/*/gems/backports-*/lib
**/vendor/bundle-standalone/ruby/*/gems/i18n-*/lib
**/vendor/bundle-standalone/ruby/*/gems/minitest-*/lib **/vendor/bundle-standalone/ruby/*/gems/minitest-*/lib
**/vendor/bundle-standalone/ruby/*/gems/thread_safe-*/lib **/vendor/bundle-standalone/ruby/*/gems/thread_safe-*/lib
**/vendor/bundle-standalone/ruby/*/gems/tzinfo-*/lib
# Ignore rubocop dependencies we don't wish to vendor # Ignore rubocop dependencies we don't wish to vendor
**/vendor/bundle-standalone/ruby/*/gems/ast-*/ **/vendor/bundle-standalone/ruby/*/gems/ast-*/
@ -48,7 +46,7 @@
**/vendor/bundle-standalone/ruby/*/gems/parser-*/ **/vendor/bundle-standalone/ruby/*/gems/parser-*/
**/vendor/bundle-standalone/ruby/*/gems/powerpack-*/ **/vendor/bundle-standalone/ruby/*/gems/powerpack-*/
**/vendor/bundle-standalone/ruby/*/gems/rainbow-*/ **/vendor/bundle-standalone/ruby/*/gems/rainbow-*/
**/vendor/bundle-standalone/ruby/*/gems/rubocop-*/ **/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/
**/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/ **/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/
**/vendor/bundle-standalone/ruby/*/gems/unicode-display_width-*/ **/vendor/bundle-standalone/ruby/*/gems/unicode-display_width-*/

View File

@ -19,6 +19,11 @@ FormulaAuditStrict:
NewFormulaAudit: NewFormulaAudit:
Enabled: false Enabled: false
# make our hashes consistent
Layout/AlignHash:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
# `system` is a special case and aligns on second argument # `system` is a special case and aligns on second argument
Layout/AlignParameters: Layout/AlignParameters:
Enabled: false Enabled: false

View File

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

View File

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

View File

@ -52,8 +52,8 @@ module Cask
with_choices_file do |choices_path| with_choices_file do |choices_path|
args << "-applyChoiceChangesXML" << choices_path if choices_path args << "-applyChoiceChangesXML" << choices_path if choices_path
env = { env = {
"LOGNAME" => User.current, "LOGNAME" => User.current,
"USER" => User.current, "USER" => User.current,
"USERNAME" => User.current, "USERNAME" => User.current,
} }
command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true, env: env) 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?) download = audit_download? && Download.new(cask, quarantine: quarantine?)
audit = Audit.new(cask, download: download, audit = Audit.new(cask, download: download,
check_token_conflicts: check_token_conflicts?, check_token_conflicts: check_token_conflicts?,
commit_range: commit_range) commit_range: commit_range)
audit.run! audit.run!
puts audit.summary puts audit.summary
audit.success? audit.success?

View File

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

View File

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

View File

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

View File

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

View File

@ -8,9 +8,9 @@ module Cask
"/" => :slashes, "/" => :slashes,
}.freeze }.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 class << self
private private

View File

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

View File

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

View File

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

View File

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

View File

@ -13,10 +13,10 @@ module Homebrew
def self.global_options 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."], verbose: [["-v", "--verbose"], :verbose, "Make some output more verbose."],
debug: [["-d", "--debug"], :debug, "Display any debugging information."], debug: [["-d", "--debug"], :debug, "Display any debugging information."],
force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."], force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."],
} }
end end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
# @private # @private
module CompilerConstants 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_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 = { COMPILER_SYMBOL_MAP = {
"gcc" => :gcc, "gcc" => :gcc,
"gcc-4.0" => :gcc_4_0, "gcc-4.0" => :gcc_4_0,
@ -67,7 +67,7 @@ class CompilerFailure
end end
COLLECTIONS = { COLLECTIONS = {
cxx11: [ cxx11: [
create(:gcc_4_0), create(:gcc_4_0),
create(:gcc_4_2), create(:gcc_4_2),
create(:clang) { build 425 }, create(:clang) { build 425 },
@ -75,7 +75,7 @@ class CompilerFailure
create(gcc: "4.5"), create(gcc: "4.5"),
create(gcc: "4.6"), create(gcc: "4.6"),
], ],
cxx14: [ cxx14: [
create(:clang) { build 600 }, create(:clang) { build 600 },
create(:gcc_4_0), create(:gcc_4_0),
create(:gcc_4_2), create(:gcc_4_2),
@ -97,10 +97,10 @@ class CompilerSelector
Compiler = Struct.new(:name, :version) Compiler = Struct.new(:name, :version)
COMPILER_PRIORITY = { 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_2: [:gcc_4_2, :gnu, :clang, :gcc_4_0],
gcc_4_0: [:gcc_4_0, :gcc_4_2, :gnu, :clang], 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 }.freeze
def self.select_for(formula, compilers = self.compilers) def self.select_for(formula, compilers = self.compilers)

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
# RuboCop version used for `brew style` and `brew cask style` # RuboCop version used for `brew style` and `brew cask style`
HOMEBREW_RUBOCOP_VERSION = "0.59.1" HOMEBREW_RUBOCOP_VERSION = "0.60.0"
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.22.0" # has to be updated when RuboCop version changes HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.23.0" # has to be updated when RuboCop version changes

View File

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

View File

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

View File

@ -71,7 +71,7 @@ module Homebrew
switch "-n", "--dry-run", switch "-n", "--dry-run",
description: "Print what would be done rather than doing it." description: "Print what would be done rather than doing it."
switch "--write", 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 "\ 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." "file modifications but not taking any Git actions."
switch "--no-audit", 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> "\ 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." "checksum of the new download should also be specified."
flag "--sha256=", flag "--sha256=",
depends_on: "--url=", depends_on: "--url=",
description: "Specify the <SHA-256> checksum of the new download." description: "Specify the <SHA-256> checksum of the new download."
flag "--tag=", flag "--tag=",
description: "Specify the new git commit <tag> for the formula." description: "Specify the new git commit <tag> for the formula."
flag "--revision=", flag "--revision=",
required_for: "--tag=", 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 :force
switch :quiet switch :quiet

View File

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

View File

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

View File

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

View File

@ -111,7 +111,7 @@ class Keg
# Matches framework references like `XXX.framework/Versions/YYY/XXX` and # Matches framework references like `XXX.framework/Versions/YYY/XXX` and
# `XXX.framework/XXX`, both with or without a slash-delimited prefix. # `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) def find_dylib_suffix_from(bad_name)
if (framework = bad_name.match(FRAMEWORK_RX)) if (framework = bad_name.match(FRAMEWORK_RX))

View File

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

View File

@ -70,7 +70,7 @@ class Pathname
include DiskUsageExtension include DiskUsageExtension
# @private # @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. # Moves a file from the original location to the {Pathname}'s.
def install(*sources) def install(*sources)

View File

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

View File

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

View File

@ -104,8 +104,10 @@ module Homebrew
end end
end end
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)} HOMEBREW_PULL_API_REGEX =
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})] %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 "forwardable"
require "PATH" require "PATH"
@ -120,22 +122,22 @@ ORIGINAL_PATHS = PATH.new(ENV["HOMEBREW_PATH"]).map do |p|
end.compact.freeze end.compact.freeze
HOMEBREW_INTERNAL_COMMAND_ALIASES = { HOMEBREW_INTERNAL_COMMAND_ALIASES = {
"ls" => "list", "ls" => "list",
"homepage" => "home", "homepage" => "home",
"-S" => "search", "-S" => "search",
"up" => "update", "up" => "update",
"ln" => "link", "ln" => "link",
"instal" => "install", # gem does the same "instal" => "install", # gem does the same
"uninstal" => "uninstall", "uninstal" => "uninstall",
"rm" => "uninstall", "rm" => "uninstall",
"remove" => "uninstall", "remove" => "uninstall",
"configure" => "diy", "configure" => "diy",
"abv" => "info", "abv" => "info",
"dr" => "doctor", "dr" => "doctor",
"--repo" => "--repository", "--repo" => "--repository",
"environment" => "--env", "environment" => "--env",
"--config" => "config", "--config" => "config",
"-v" => "--version", "-v" => "--version",
}.freeze }.freeze
require "set" require "set"

View File

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

View File

@ -63,8 +63,8 @@ class Keg
end end
# locale-specific directories have the form language[_territory][.codeset][@modifier] # 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]+(@.+)?)?} 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)$} INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}.freeze
KEG_LINK_DIRECTORIES = %w[ KEG_LINK_DIRECTORIES = %w[
bin etc include lib sbin share var bin etc include lib sbin share var
].freeze ].freeze

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
# match taps' formulae, e.g. someuser/sometap/someformula # 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 # 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 # 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 # 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)
# 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+-.]+)$} 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( expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/installer", "/usr/sbin/installer",
args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/"], args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/"],
sudo: true, sudo: true,
print_stdout: true, print_stdout: true,
env: { env: {
"LOGNAME" => ENV["USER"], "LOGNAME" => ENV["USER"],
"USER" => ENV["USER"], "USER" => ENV["USER"],
"USERNAME" => ENV["USER"], "USERNAME" => ENV["USER"],
}, },
) )
@ -57,16 +57,16 @@ describe Cask::Artifact::Pkg, :cask do
expect(fake_system_command).to receive(:run!).with( expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/installer", "/usr/sbin/installer",
args: [ args: [
"-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"),
"-target", "/", "-applyChoiceChangesXML", "-target", "/", "-applyChoiceChangesXML",
cask.staged_path.join("/tmp/choices.xml") cask.staged_path.join("/tmp/choices.xml")
], ],
sudo: true, sudo: true,
print_stdout: true, print_stdout: true,
env: { env: {
"LOGNAME" => ENV["USER"], "LOGNAME" => ENV["USER"],
"USER" => ENV["USER"], "USER" => ENV["USER"],
"USERNAME" => 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( expect(fake_system_command).to receive(:run).with(
cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"), cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool"),
args: ["--please"], args: ["--please"],
must_succeed: true, must_succeed: true,
print_stdout: true, print_stdout: true,
sudo: false, sudo: false,
) )
InstallHelper.install_without_artifacts(cask) InstallHelper.install_without_artifacts(cask)

View File

@ -49,11 +49,11 @@ describe "brew outdated", :integration_test do
expected_json = [ expected_json = [
{ {
name: "testball", name: "testball",
installed_versions: ["0.0.1"], installed_versions: ["0.0.1"],
current_version: "0.1", current_version: "0.1",
pinned: true, pinned: true,
pinned_version: "0.0.1", pinned_version: "0.0.1",
}, },
].to_json ].to_json
@ -69,11 +69,11 @@ describe "brew outdated", :integration_test do
expected_json = [ expected_json = [
{ {
name: "testball", name: "testball",
installed_versions: ["0.0.1"], installed_versions: ["0.0.1"],
current_version: "0.1", current_version: "0.1",
pinned: false, pinned: false,
pinned_version: nil, pinned_version: nil,
}, },
].to_json ].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", "macports" => "https://www.macports.org/ports.php?by=name&substr=testball",
"fink" => "http://pdb.finkproject.org/pdb/browse.php?summary=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", "debian" => "https://packages.debian.org/search?keywords=testball&searchon=names&suite=all&section=all",
"opensuse" => "https://software.opensuse.org/search?q=testball", "opensuse" => "https://software.opensuse.org/search?q=testball",
"fedora" => "https://apps.fedoraproject.org/packages/s/testball", "fedora" => "https://apps.fedoraproject.org/packages/s/testball",
"ubuntu" => "https://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all&section=all", "ubuntu" => "https://packages.ubuntu.com/search?keywords=testball&searchon=names&suite=all&section=all",
}.each do |flag, url| }.each do |flag, url|
specify "--#{flag}" do specify "--#{flag}" do
expect { brew "search", "--#{flag}", "testball", "HOMEBREW_BROWSER" => "echo" } expect { brew "search", "--#{flag}", "testball", "HOMEBREW_BROWSER" => "echo" }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:) def extract_to_dir(unpack_dir, basename:, verbose:)
path.children.each do |child| path.children.each do |child|
system_command! "cp", 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 verbose: verbose
end end
end end

View File

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

View File

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

View File

@ -20,11 +20,11 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:) def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "unar", system_command! "unar",
args: [ args: [
"-force-overwrite", "-quiet", "-no-directory", "-force-overwrite", "-quiet", "-no-directory",
"-output-directory", unpack_dir, "--", path "-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 verbose: verbose
end end
end end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,8 +17,8 @@ module UnpackStrategy
def extract_to_dir(unpack_dir, basename:, verbose:) def extract_to_dir(unpack_dir, basename:, verbose:)
quiet_flags = verbose ? [] : ["-qq"] quiet_flags = verbose ? [] : ["-qq"]
result = system_command! "unzip", result = system_command! "unzip",
args: [*quiet_flags, path, "-d", unpack_dir], args: [*quiet_flags, path, "-d", unpack_dir],
verbose: verbose, verbose: verbose,
print_stderr: false print_stderr: false
FileUtils.rm_rf unpack_dir/"__MACOSX" 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 # SSL_CERT_FILE can be incorrectly set by users or portable-ruby and screw
# with SSL downloads so unset it here. # with SSL downloads so unset it here.
system_command! curl_executable, system_command! curl_executable,
args: curl_args(*args), args: curl_args(*args),
print_stdout: true, print_stdout: true,
env: { "SSL_CERT_FILE" => nil } env: { "SSL_CERT_FILE" => nil }
end end
def curl_download(*args, to: nil, **options) def curl_download(*args, to: nil, **options)
@ -65,7 +65,7 @@ end
def curl_output(*args, **options) def curl_output(*args, **options)
system_command(curl_executable, system_command(curl_executable,
args: curl_args(*args, show_output: true, **options), args: curl_args(*args, show_output: true, **options),
print_stderr: false) print_stderr: false)
end 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 output_hash = Digest::SHA256.digest(output) if hash_needed
{ {
status: status_code, status: status_code,
etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2], etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2],
content_length: headers[/Content-Length: (\d+)/, 1], content_length: headers[/Content-Length: (\d+)/, 1],
file_hash: output_hash, file_hash: output_hash,
file: output, file: output,
} }
end end

View File

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

View File

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

View File

@ -9,7 +9,7 @@ GEM
ast (2.4.0) ast (2.4.0)
backports (3.11.4) backports (3.11.4)
concurrent-ruby (1.0.5) concurrent-ruby (1.0.5)
i18n (1.1.0) i18n (1.1.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1) jaro_winkler (1.5.1)
minitest (5.11.3) minitest (5.11.3)
@ -44,7 +44,7 @@ DEPENDENCIES
backports backports
concurrent-ruby concurrent-ruby
plist plist
rubocop (= 0.59.1) rubocop (= 0.60.0)
rubocop-rspec rubocop-rspec
ruby-macho ruby-macho

View File

@ -4,7 +4,7 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
ruby_version = RbConfig::CONFIG["ruby_version"] ruby_version = RbConfig::CONFIG["ruby_version"]
path = File.expand_path('..', __FILE__) path = File.expand_path('..', __FILE__)
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.0.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.0.5/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.11.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib"
@ -15,12 +15,12 @@ $:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.1" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.1"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.12.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.12.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.5.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.5.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.59.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.60.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.30.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.30.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib"

View File

@ -1,8 +0,0 @@
module Kernel
def suppress_warnings
original_verbosity, $VERBOSE = $VERBOSE, nil
yield
ensure
$VERBOSE = original_verbosity
end
end

View File

@ -2,7 +2,6 @@
require 'yaml' require 'yaml'
require 'i18n/core_ext/hash' require 'i18n/core_ext/hash'
require 'i18n/core_ext/kernel/suppress_warnings'
module I18n module I18n
module Backend module Backend

Some files were not shown because too many files have changed in this diff Show More