rubocop --auto-correct all hash-rocket usage.
This commit is contained in:
parent
6693915399
commit
3982950e61
@ -1,14 +1,9 @@
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.0
|
||||
Exclude:
|
||||
- 'Homebrew/vendor/**/*'
|
||||
- 'Homebrew/test/vendor/**/*'
|
||||
|
||||
# Whilst we now can handle the newer hash syntax of 1.9+ the
|
||||
# hash rockets are everywhere & it'd be good to change this more
|
||||
# consistently than piecemeal.
|
||||
Style/HashSyntax:
|
||||
EnforcedStyle: hash_rockets
|
||||
|
||||
# ruby style guide favorite
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
@ -83,7 +83,7 @@ begin
|
||||
# arguments themselves.
|
||||
if empty_argv || help_flag
|
||||
require "cmd/help"
|
||||
Homebrew.help cmd, :empty_argv => empty_argv
|
||||
Homebrew.help cmd, empty_argv: empty_argv
|
||||
# `Homebrew.help` never returns, except for external/unknown commands.
|
||||
end
|
||||
|
||||
@ -125,7 +125,7 @@ begin
|
||||
|
||||
rescue UsageError => e
|
||||
require "cmd/help"
|
||||
Homebrew.help cmd, :usage_error => e.message
|
||||
Homebrew.help cmd, usage_error: e.message
|
||||
rescue SystemExit => e
|
||||
onoe "Kernel.exit" if ARGV.verbose? && !e.success?
|
||||
$stderr.puts e.backtrace if ARGV.debug?
|
||||
|
||||
@ -157,7 +157,7 @@ class Build
|
||||
# The stdlib recorded in the install receipt is used during dependency
|
||||
# compatibility checks, so we only care about the stdlib that libraries
|
||||
# link against.
|
||||
keg.detect_cxx_stdlibs(:skip_executables => true)
|
||||
keg.detect_cxx_stdlibs(skip_executables: true)
|
||||
end
|
||||
|
||||
def fixopt(f)
|
||||
|
||||
@ -33,7 +33,7 @@ module Homebrew
|
||||
def self.cleanup_logs
|
||||
return unless HOMEBREW_LOGS.directory?
|
||||
HOMEBREW_LOGS.subdirs.each do |dir|
|
||||
cleanup_path(dir) { dir.rmtree } if prune?(dir, :days_default => 14)
|
||||
cleanup_path(dir) { dir.rmtree } if prune?(dir, days_default: 14)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -44,11 +44,11 @@ require "ostruct"
|
||||
module Homebrew
|
||||
def deps
|
||||
mode = OpenStruct.new(
|
||||
:installed? => ARGV.include?("--installed"),
|
||||
:tree? => ARGV.include?("--tree"),
|
||||
:all? => ARGV.include?("--all"),
|
||||
:topo_order? => ARGV.include?("-n"),
|
||||
:union? => ARGV.include?("--union")
|
||||
installed?: ARGV.include?("--installed"),
|
||||
tree?: ARGV.include?("--tree"),
|
||||
all?: ARGV.include?("--all"),
|
||||
topo_order?: ARGV.include?("-n"),
|
||||
union?: ARGV.include?("--union")
|
||||
)
|
||||
|
||||
if mode.installed? && mode.tree?
|
||||
|
||||
@ -40,7 +40,7 @@ module Homebrew
|
||||
|
||||
puts "Fetching: #{bucket * ", "}" if bucket.size > 1
|
||||
bucket.each do |f|
|
||||
f.print_tap_action :verb => "Fetching"
|
||||
f.print_tap_action verb: "Fetching"
|
||||
|
||||
fetched_bottle = false
|
||||
if fetch_bottle?(f)
|
||||
|
||||
@ -23,16 +23,16 @@ module Homebrew
|
||||
s = StringIO.new
|
||||
SystemConfig.dump_verbose_config s
|
||||
# Dummy summary file, asciibetically first, to control display title of gist
|
||||
files["# #{f.name} - #{timestamp}.txt"] = { :content => brief_build_info(f) }
|
||||
files["00.config.out"] = { :content => s.string }
|
||||
files["00.doctor.out"] = { :content => `brew doctor 2>&1` }
|
||||
files["# #{f.name} - #{timestamp}.txt"] = { content: brief_build_info(f) }
|
||||
files["00.config.out"] = { content: s.string }
|
||||
files["00.doctor.out"] = { content: `brew doctor 2>&1` }
|
||||
unless f.core_formula?
|
||||
tap = <<-EOS.undent
|
||||
Formula: #{f.name}
|
||||
Tap: #{f.tap}
|
||||
Path: #{f.path}
|
||||
EOS
|
||||
files["00.tap.out"] = { :content => tap }
|
||||
files["00.tap.out"] = { content: tap }
|
||||
end
|
||||
|
||||
# Description formatted to work well as page title when viewing gist
|
||||
@ -93,8 +93,8 @@ module Homebrew
|
||||
contents = file.size? ? file.read : "empty log"
|
||||
# small enough to avoid GitHub "unicorn" page-load-timeout errors
|
||||
max_file_size = 1_000_000
|
||||
contents = truncate_text_to_approximate_size(contents, max_file_size, :front_weight => 0.2)
|
||||
logs[file.basename.to_s] = { :content => contents }
|
||||
contents = truncate_text_to_approximate_size(contents, max_file_size, front_weight: 0.2)
|
||||
logs[file.basename.to_s] = { content: contents }
|
||||
end if dir.exist?
|
||||
raise "No logs." if logs.empty?
|
||||
logs
|
||||
|
||||
@ -12,7 +12,7 @@ require "formula"
|
||||
|
||||
module Homebrew
|
||||
def linkapps
|
||||
target_dir = linkapps_target(:local => ARGV.include?("--local"))
|
||||
target_dir = linkapps_target(local: ARGV.include?("--local"))
|
||||
|
||||
unless target_dir.directory?
|
||||
opoo "#{target_dir} does not exist, stopping."
|
||||
|
||||
@ -39,11 +39,11 @@ module Homebrew
|
||||
verbose = ($stdout.tty? || ARGV.verbose?) && !ARGV.flag?("--quiet")
|
||||
fetch_head = ARGV.fetch_head?
|
||||
|
||||
outdated_formulae = formulae.select { |f| f.outdated?(:fetch_head => fetch_head) }
|
||||
outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) }
|
||||
|
||||
outdated_formulae.each do |f|
|
||||
if verbose
|
||||
outdated_versions = f.outdated_versions(:fetch_head => fetch_head)
|
||||
outdated_versions = f.outdated_versions(fetch_head: fetch_head)
|
||||
current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s }
|
||||
"latest HEAD"
|
||||
else
|
||||
@ -59,19 +59,19 @@ module Homebrew
|
||||
def print_outdated_json(formulae)
|
||||
json = []
|
||||
fetch_head = ARGV.fetch_head?
|
||||
outdated_formulae = formulae.select { |f| f.outdated?(:fetch_head => fetch_head) }
|
||||
outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) }
|
||||
|
||||
outdated = outdated_formulae.each do |f|
|
||||
outdated_versions = f.outdated_versions(:fetch_head => fetch_head)
|
||||
outdated_versions = f.outdated_versions(fetch_head: fetch_head)
|
||||
current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s }
|
||||
"HEAD"
|
||||
else
|
||||
f.pkg_version.to_s
|
||||
end
|
||||
|
||||
json << { :name => f.full_name,
|
||||
:installed_versions => outdated_versions.collect(&:to_s),
|
||||
:current_version => current_version }
|
||||
json << { name: f.full_name,
|
||||
installed_versions: outdated_versions.collect(&:to_s),
|
||||
current_version: current_version }
|
||||
end
|
||||
puts Utils::JSON.dump(json)
|
||||
|
||||
|
||||
@ -58,6 +58,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
unlinkapps_prune(:dry_run => ARGV.dry_run?, :quiet => true)
|
||||
unlinkapps_prune(dry_run: ARGV.dry_run?, quiet: true)
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,7 +25,7 @@ module Homebrew
|
||||
Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files)
|
||||
end
|
||||
|
||||
options = { :aliases => ARGV.include?("--aliases") }
|
||||
options = { aliases: ARGV.include?("--aliases") }
|
||||
taps = if ARGV.named.empty?
|
||||
Tap
|
||||
else
|
||||
|
||||
@ -30,7 +30,7 @@ module Homebrew
|
||||
ARGV.formulae.map(&:path)
|
||||
end
|
||||
|
||||
Homebrew.failed = check_style_and_print(target, :fix => ARGV.flag?("--fix"))
|
||||
Homebrew.failed = check_style_and_print(target, fix: ARGV.flag?("--fix"))
|
||||
end
|
||||
|
||||
# Checks style for a list of files, printing simple RuboCop output.
|
||||
|
||||
@ -47,9 +47,9 @@ module Homebrew
|
||||
else
|
||||
tap = Tap.fetch(ARGV.named[0])
|
||||
begin
|
||||
tap.install :clone_target => ARGV.named[1],
|
||||
:full_clone => full_clone?,
|
||||
:quiet => ARGV.quieter?
|
||||
tap.install clone_target: ARGV.named[1],
|
||||
full_clone: full_clone?,
|
||||
quiet: ARGV.quieter?
|
||||
rescue TapRemoteMismatchError => e
|
||||
odie e
|
||||
rescue TapAlreadyTappedError, TapAlreadyUnshallowError
|
||||
@ -67,7 +67,7 @@ module Homebrew
|
||||
opoo "Homebrew.install_tap is deprecated, use Tap#install."
|
||||
tap = Tap.fetch(user, repo)
|
||||
begin
|
||||
tap.install(:clone_target => clone_target, :full_clone => full_clone?)
|
||||
tap.install(clone_target: clone_target, full_clone: full_clone?)
|
||||
rescue TapAlreadyTappedError
|
||||
false
|
||||
else
|
||||
|
||||
@ -13,17 +13,17 @@ require "cmd/linkapps"
|
||||
|
||||
module Homebrew
|
||||
def unlinkapps
|
||||
target_dir = linkapps_target(:local => ARGV.include?("--local"))
|
||||
target_dir = linkapps_target(local: ARGV.include?("--local"))
|
||||
|
||||
unlinkapps_from_dir(target_dir, :dry_run => ARGV.dry_run?)
|
||||
unlinkapps_from_dir(target_dir, dry_run: ARGV.dry_run?)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unlinkapps_prune(opts = {})
|
||||
opts = opts.merge(:prune => true)
|
||||
unlinkapps_from_dir(linkapps_target(:local => false), opts)
|
||||
unlinkapps_from_dir(linkapps_target(:local => true), opts)
|
||||
opts = opts.merge(prune: true)
|
||||
unlinkapps_from_dir(linkapps_target(local: false), opts)
|
||||
unlinkapps_from_dir(linkapps_target(local: true), opts)
|
||||
end
|
||||
|
||||
def unlinkapps_from_dir(target_dir, opts = {})
|
||||
|
||||
@ -39,7 +39,7 @@ module Homebrew
|
||||
ENV["VERBOSE"] = "1" # show messages about tar
|
||||
f.brew do
|
||||
f.patch if ARGV.flag?("--patch")
|
||||
cp_r getwd, stage_dir, :preserve => true
|
||||
cp_r getwd, stage_dir, preserve: true
|
||||
end
|
||||
ENV["VERBOSE"] = nil
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ module Homebrew
|
||||
def install_core_tap_if_necessary
|
||||
core_tap = CoreTap.instance
|
||||
return if core_tap.installed?
|
||||
CoreTap.ensure_installed! :quiet => false
|
||||
CoreTap.ensure_installed! quiet: false
|
||||
revision = core_tap.git_head
|
||||
ENV["HOMEBREW_UPDATE_BEFORE_HOMEBREW_HOMEBREW_CORE"] = revision
|
||||
ENV["HOMEBREW_UPDATE_AFTER_HOMEBREW_HOMEBREW_CORE"] = revision
|
||||
@ -175,7 +175,7 @@ module Homebrew
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"etc/bash_completion.d",
|
||||
HOMEBREW_PREFIX/"etc/bash_completion.d", command)
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/doc/homebrew",
|
||||
HOMEBREW_PREFIX/"share/doc/homebrew", command, :link_dir => true)
|
||||
HOMEBREW_PREFIX/"share/doc/homebrew", command, link_dir: true)
|
||||
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/zsh/site-functions",
|
||||
HOMEBREW_PREFIX/"share/zsh/site-functions", command)
|
||||
link_path_manpages(HOMEBREW_REPOSITORY/"share", command)
|
||||
|
||||
@ -25,13 +25,13 @@ module Homebrew
|
||||
|
||||
if ARGV.named.empty?
|
||||
outdated = Formula.installed.select do |f|
|
||||
f.outdated?(:fetch_head => ARGV.fetch_head?)
|
||||
f.outdated?(fetch_head: ARGV.fetch_head?)
|
||||
end
|
||||
|
||||
exit 0 if outdated.empty?
|
||||
else
|
||||
outdated = ARGV.resolved_formulae.select do |f|
|
||||
f.outdated?(:fetch_head => ARGV.fetch_head?)
|
||||
f.outdated?(fetch_head: ARGV.fetch_head?)
|
||||
end
|
||||
|
||||
(ARGV.resolved_formulae - outdated).each do |f|
|
||||
|
||||
@ -58,16 +58,16 @@ class CompilerFailure
|
||||
end
|
||||
|
||||
COLLECTIONS = {
|
||||
:cxx11 => [
|
||||
cxx11: [
|
||||
create(:gcc_4_0),
|
||||
create(:gcc),
|
||||
create(:clang) { build 425 },
|
||||
create(:gcc => "4.3"),
|
||||
create(:gcc => "4.4"),
|
||||
create(:gcc => "4.5"),
|
||||
create(:gcc => "4.6"),
|
||||
create(gcc: "4.3"),
|
||||
create(gcc: "4.4"),
|
||||
create(gcc: "4.5"),
|
||||
create(gcc: "4.6"),
|
||||
],
|
||||
:openmp => [
|
||||
openmp: [
|
||||
create(:clang),
|
||||
],
|
||||
}.freeze
|
||||
@ -79,9 +79,9 @@ class CompilerSelector
|
||||
Compiler = Struct.new(:name, :version)
|
||||
|
||||
COMPILER_PRIORITY = {
|
||||
:clang => [:clang, :gcc, :gnu, :gcc_4_0],
|
||||
:gcc => [:gcc, :gnu, :clang, :gcc_4_0],
|
||||
:gcc_4_0 => [:gcc_4_0, :gcc, :gnu, :clang],
|
||||
clang: [:clang, :gcc, :gnu, :gcc_4_0],
|
||||
gcc: [:gcc, :gnu, :clang, :gcc_4_0],
|
||||
gcc_4_0: [:gcc_4_0, :gcc, :gnu, :clang],
|
||||
}.freeze
|
||||
|
||||
def self.select_for(formula, compilers = self.compilers)
|
||||
|
||||
@ -66,7 +66,7 @@ class Descriptions
|
||||
renamings = report.select_formula(:R)
|
||||
alterations = report.select_formula(:A) + report.select_formula(:M) +
|
||||
renamings.map(&:last)
|
||||
cache_formulae(alterations, :save => false)
|
||||
cache_formulae(alterations, save: false)
|
||||
uncache_formulae(report.select_formula(:D) +
|
||||
renamings.map(&:first))
|
||||
end
|
||||
@ -75,7 +75,7 @@ class Descriptions
|
||||
|
||||
# Given an array of formula names, add them and their descriptions to the
|
||||
# cache. Save the updated cache to disk, unless explicitly told not to.
|
||||
def self.cache_formulae(formula_names, options = { :save => true })
|
||||
def self.cache_formulae(formula_names, options = { save: true })
|
||||
if cache
|
||||
formula_names.each do |name|
|
||||
begin
|
||||
@ -90,7 +90,7 @@ class Descriptions
|
||||
|
||||
# Given an array of formula names, remove them and their descriptions from
|
||||
# the cache. Save the updated cache to disk, unless explicitly told not to.
|
||||
def self.uncache_formulae(formula_names, options = { :save => true })
|
||||
def self.uncache_formulae(formula_names, options = { save: true })
|
||||
if cache
|
||||
formula_names.each { |name| @cache.delete(name) }
|
||||
save_cache if options[:save]
|
||||
|
||||
@ -62,11 +62,11 @@ module Homebrew
|
||||
|
||||
if strict
|
||||
# Check style in a single batch run up front for performance
|
||||
style_results = check_style_json(files, :realpath => true)
|
||||
style_results = check_style_json(files, realpath: true)
|
||||
end
|
||||
|
||||
ff.each do |f|
|
||||
options = { :new_formula => new_formula, :strict => strict, :online => online }
|
||||
options = { new_formula: new_formula, strict: strict, online: online }
|
||||
options[:style_offenses] = style_results.file_offenses(f.path) if strict
|
||||
fa = FormulaAuditor.new(f, options)
|
||||
fa.audit
|
||||
@ -172,7 +172,7 @@ class FormulaAuditor
|
||||
return unless @style_offenses
|
||||
display_cop_names = ARGV.include?("--display-cop-names")
|
||||
@style_offenses.each do |offense|
|
||||
problem offense.to_s(:display_cop_name => display_cop_names)
|
||||
problem offense.to_s(display_cop_name: display_cop_names)
|
||||
end
|
||||
end
|
||||
|
||||
@ -655,7 +655,7 @@ class FormulaAuditor
|
||||
return unless formula.tap # skip formula not from core or any taps
|
||||
return unless formula.tap.git? # git log is required
|
||||
|
||||
fv = FormulaVersions.new(formula, :max_depth => 10)
|
||||
fv = FormulaVersions.new(formula, max_depth: 10)
|
||||
attributes = [:revision, :version_scheme]
|
||||
attributes_map = fv.version_attributes_map(attributes, "origin/master")
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
published = []
|
||||
bintray_creds = { :user => ENV["BINTRAY_USER"], :key => ENV["BINTRAY_KEY"] }
|
||||
bintray_creds = { user: ENV["BINTRAY_USER"], key: ENV["BINTRAY_KEY"] }
|
||||
if bintray_creds[:user] && bintray_creds[:key]
|
||||
changed_formulae_names.each do |name|
|
||||
f = Formula[name]
|
||||
@ -338,7 +338,7 @@ module Homebrew
|
||||
others << file
|
||||
end
|
||||
end
|
||||
{ :files => files, :formulae => formulae, :others => others }
|
||||
{ files: files, formulae: formulae, others: others }
|
||||
end
|
||||
|
||||
# Get current formula versions without loading formula definition in this process
|
||||
|
||||
@ -102,7 +102,7 @@ module Homebrew
|
||||
# Assume we are starting from a "mostly" UTF-8 string
|
||||
str.force_encoding(Encoding::UTF_8)
|
||||
return str if str.valid_encoding?
|
||||
str.encode!(Encoding::UTF_16, :invalid => :replace)
|
||||
str.encode!(Encoding::UTF_16, invalid: :replace)
|
||||
str.encode!(Encoding::UTF_8)
|
||||
end
|
||||
|
||||
@ -652,7 +652,7 @@ module Homebrew
|
||||
bottle_merge_args << "--keep-old" if ARGV.include? "--keep-old"
|
||||
test "brew", "bottle", *bottle_merge_args
|
||||
test "brew", "uninstall", "--force", formula_name
|
||||
FileUtils.ln bottle_filename, HOMEBREW_CACHE/bottle_filename, :force => true
|
||||
FileUtils.ln bottle_filename, HOMEBREW_CACHE/bottle_filename, force: true
|
||||
@formulae.delete(formula_name)
|
||||
unless unchanged_build_dependencies.empty?
|
||||
test "brew", "uninstall", "--force", *unchanged_build_dependencies
|
||||
@ -908,7 +908,7 @@ module Homebrew
|
||||
bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"]
|
||||
return if bottles.empty?
|
||||
|
||||
FileUtils.cp bottles, Dir.pwd, :verbose => true
|
||||
FileUtils.cp bottles, Dir.pwd, verbose: true
|
||||
end
|
||||
|
||||
json_files = Dir.glob("*.bottle.json")
|
||||
@ -1077,14 +1077,14 @@ module Homebrew
|
||||
skip_homebrew = ARGV.include?("--skip-homebrew")
|
||||
if ARGV.named.empty?
|
||||
# With no arguments just build the most recent commit.
|
||||
current_test = Test.new("HEAD", :tap => tap, :skip_homebrew => skip_homebrew)
|
||||
current_test = Test.new("HEAD", tap: tap, skip_homebrew: skip_homebrew)
|
||||
any_errors = !current_test.run
|
||||
tests << current_test
|
||||
else
|
||||
ARGV.named.each do |argument|
|
||||
test_error = false
|
||||
begin
|
||||
current_test = Test.new(argument, :tap => tap, :skip_homebrew => skip_homebrew)
|
||||
current_test = Test.new(argument, tap: tap, skip_homebrew: skip_homebrew)
|
||||
skip_homebrew = true
|
||||
rescue ArgumentError => e
|
||||
test_error = true
|
||||
@ -1153,7 +1153,7 @@ module Homebrew
|
||||
|
||||
# Truncate to 1MB to avoid hitting CI limits
|
||||
if output.bytesize > MAX_STEP_OUTPUT_SIZE
|
||||
output = truncate_text_to_approximate_size(output, MAX_STEP_OUTPUT_SIZE, :front_weight => 0.0)
|
||||
output = truncate_text_to_approximate_size(output, MAX_STEP_OUTPUT_SIZE, front_weight: 0.0)
|
||||
output = "truncated output to 1MB:\n" + output
|
||||
end
|
||||
end
|
||||
|
||||
@ -225,7 +225,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
||||
def stage
|
||||
case cached_location.compression_type
|
||||
when :zip
|
||||
with_system_path { quiet_safe_system "unzip", { :quiet_flag => "-qq" }, cached_location }
|
||||
with_system_path { quiet_safe_system "unzip", { quiet_flag: "-qq" }, cached_location }
|
||||
chdir
|
||||
when :gzip_only
|
||||
with_system_path { buffered_write("gunzip") }
|
||||
@ -254,11 +254,11 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
||||
when :xar
|
||||
safe_system "/usr/bin/xar", "-xf", cached_location
|
||||
when :rar
|
||||
quiet_safe_system "unrar", "x", { :quiet_flag => "-inul" }, cached_location
|
||||
quiet_safe_system "unrar", "x", { quiet_flag: "-inul" }, cached_location
|
||||
when :p7zip
|
||||
safe_system "7zr", "x", cached_location
|
||||
else
|
||||
cp cached_location, basename_without_params, :preserve => true
|
||||
cp cached_location, basename_without_params, preserve: true
|
||||
end
|
||||
end
|
||||
|
||||
@ -467,7 +467,7 @@ end
|
||||
# Useful for installing jars.
|
||||
class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
||||
def stage
|
||||
cp cached_location, basename_without_params, :preserve => true
|
||||
cp cached_location, basename_without_params, preserve: true
|
||||
end
|
||||
end
|
||||
|
||||
@ -628,7 +628,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
||||
|
||||
def stage
|
||||
super
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, :preserve => true
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, preserve: true
|
||||
end
|
||||
|
||||
def source_modified_time
|
||||
@ -860,7 +860,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
|
||||
end
|
||||
|
||||
def stage
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, :preserve => true
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, preserve: true
|
||||
end
|
||||
|
||||
private
|
||||
@ -876,13 +876,13 @@ class CVSDownloadStrategy < VCSDownloadStrategy
|
||||
def clone_repo
|
||||
HOMEBREW_CACHE.cd do
|
||||
# Login is only needed (and allowed) with pserver; skip for anoncvs.
|
||||
quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "-d", @url, "login" if @url.include? "pserver"
|
||||
quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "-d", @url, "checkout", "-d", cache_filename, @module
|
||||
quiet_safe_system cvspath, { quiet_flag: "-Q" }, "-d", @url, "login" if @url.include? "pserver"
|
||||
quiet_safe_system cvspath, { quiet_flag: "-Q" }, "-d", @url, "checkout", "-d", cache_filename, @module
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
cached_location.cd { quiet_safe_system cvspath, { :quiet_flag => "-Q" }, "up" }
|
||||
cached_location.cd { quiet_safe_system cvspath, { quiet_flag: "-Q" }, "up" }
|
||||
end
|
||||
|
||||
def split_url(in_url)
|
||||
@ -949,7 +949,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
|
||||
def stage
|
||||
# The export command doesn't work on checkouts
|
||||
# See https://bugs.launchpad.net/bzr/+bug/897511
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, :preserve => true
|
||||
cp_r File.join(cached_location, "."), Dir.pwd, preserve: true
|
||||
rm_r ".bzr"
|
||||
end
|
||||
|
||||
|
||||
@ -309,7 +309,7 @@ class BuildError < RuntimeError
|
||||
end
|
||||
|
||||
def fetch_issues
|
||||
GitHub.issues_for_formula(formula.name, :tap => formula.tap)
|
||||
GitHub.issues_for_formula(formula.name, tap: formula.tap)
|
||||
rescue GitHub::RateLimitExceededError => e
|
||||
opoo e.message
|
||||
[]
|
||||
|
||||
@ -132,7 +132,7 @@ module Stdenv
|
||||
replace_in_cflags(/-Xarch_#{Hardware::CPU.arch_32_bit} (-march=\S*)/, '\1')
|
||||
# Clang mistakenly enables AES-NI on plain Nehalem
|
||||
map = Hardware::CPU.optimization_flags
|
||||
map = map.merge(:nehalem => "-march=native -Xclang -target-feature -Xclang -aes")
|
||||
map = map.merge(nehalem: "-march=native -Xclang -target-feature -Xclang -aes")
|
||||
set_cpu_cflags "-march=native", map
|
||||
end
|
||||
|
||||
|
||||
@ -4,11 +4,11 @@ module Hardware
|
||||
class CPU
|
||||
class << self
|
||||
PPC_OPTIMIZATION_FLAGS = {
|
||||
:g3 => "-mcpu=750",
|
||||
:g4 => "-mcpu=7400",
|
||||
:g4e => "-mcpu=7450",
|
||||
:g5 => "-mcpu=970",
|
||||
:g5_64 => "-mcpu=970 -arch ppc64",
|
||||
g3: "-mcpu=750",
|
||||
g4: "-mcpu=7400",
|
||||
g4e: "-mcpu=7450",
|
||||
g5: "-mcpu=970",
|
||||
g5_64: "-mcpu=970 -arch ppc64",
|
||||
}.freeze
|
||||
def optimization_flags
|
||||
OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS)
|
||||
|
||||
@ -74,7 +74,7 @@ class FormulaInstaller
|
||||
!!@build_bottle && !formula.bottle_disabled?
|
||||
end
|
||||
|
||||
def pour_bottle?(install_bottle_options = { :warn=>false })
|
||||
def pour_bottle?(install_bottle_options = { warn: false })
|
||||
return true if Homebrew::Hooks::Bottles.formula_has_bottle?(formula)
|
||||
|
||||
return false if @pour_failed
|
||||
@ -229,7 +229,7 @@ class FormulaInstaller
|
||||
|
||||
@@attempted << formula
|
||||
|
||||
pour_bottle = pour_bottle?(:warn => true)
|
||||
pour_bottle = pour_bottle?(warn: true)
|
||||
if pour_bottle
|
||||
begin
|
||||
install_relocation_tools unless formula.bottle_specification.skip_relocation?
|
||||
@ -422,7 +422,7 @@ class FormulaInstaller
|
||||
puts "All dependencies for #{formula.full_name} are satisfied."
|
||||
elsif !deps.empty?
|
||||
oh1 "Installing dependencies for #{formula.full_name}: #{Tty.green}#{deps.map(&:first)*", "}#{Tty.reset}",
|
||||
:truncate => false
|
||||
truncate: false
|
||||
deps.each { |dep, options| install_dependency(dep, options) }
|
||||
end
|
||||
|
||||
@ -675,7 +675,7 @@ class FormulaInstaller
|
||||
puts e
|
||||
puts
|
||||
puts "Possible conflicting files are:"
|
||||
mode = OpenStruct.new(:dry_run => true, :overwrite => true)
|
||||
mode = OpenStruct.new(dry_run: true, overwrite: true)
|
||||
keg.link(mode)
|
||||
@show_summary_heading = true
|
||||
Homebrew.failed = true
|
||||
|
||||
@ -78,7 +78,7 @@ class Formulary
|
||||
|
||||
# Gets the formula instance.
|
||||
def get_formula(spec)
|
||||
klass.new(name, path, spec, :alias_path => alias_path)
|
||||
klass.new(name, path, spec, alias_path: alias_path)
|
||||
end
|
||||
|
||||
def klass
|
||||
|
||||
@ -9,10 +9,10 @@ module Hardware
|
||||
|
||||
class << self
|
||||
OPTIMIZATION_FLAGS = {
|
||||
:penryn => "-march=core2 -msse4.1",
|
||||
:core2 => "-march=core2",
|
||||
:core => "-march=prescott",
|
||||
:dunno => "",
|
||||
penryn: "-march=core2 -msse4.1",
|
||||
core2: "-march=core2",
|
||||
core: "-march=prescott",
|
||||
dunno: "",
|
||||
}.freeze
|
||||
|
||||
def optimization_flags
|
||||
|
||||
@ -35,7 +35,7 @@ class Keg
|
||||
first.open("wb") { |f| f.write(s) }
|
||||
end
|
||||
else
|
||||
rest.each { |file| FileUtils.ln(first, file, :force => true) }
|
||||
rest.each { |file| FileUtils.ln(first, file, force: true) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -6,11 +6,11 @@ module Language
|
||||
end
|
||||
|
||||
def self.java_home_env(version = nil)
|
||||
{ :JAVA_HOME => "$(#{java_home_cmd(version)})" }
|
||||
{ JAVA_HOME: "$(#{java_home_cmd(version)})" }
|
||||
end
|
||||
|
||||
def self.overridable_java_home_env(version = nil)
|
||||
{ :JAVA_HOME => "${JAVA_HOME:-$(#{java_home_cmd(version)})}" }
|
||||
{ JAVA_HOME: "${JAVA_HOME:-$(#{java_home_cmd(version)})}" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -234,7 +234,7 @@ class Migrator
|
||||
puts e
|
||||
puts
|
||||
puts "Possible conflicting files are:"
|
||||
mode = OpenStruct.new(:dry_run => true, :overwrite => true)
|
||||
mode = OpenStruct.new(dry_run: true, overwrite: true)
|
||||
new_keg.link(mode)
|
||||
raise
|
||||
rescue Keg::LinkError => e
|
||||
|
||||
@ -156,50 +156,50 @@ module OS
|
||||
end
|
||||
|
||||
STANDARD_COMPILERS = {
|
||||
"2.0" => { :gcc_40_build => 4061 },
|
||||
"2.5" => { :gcc_40_build => 5370 },
|
||||
"3.1.4" => { :gcc_40_build => 5493, :gcc_42_build => 5577 },
|
||||
"3.2.6" => { :gcc_40_build => 5494, :gcc_42_build => 5666, :clang => "1.7", :clang_build => 77 },
|
||||
"4.0" => { :gcc_40_build => 5494, :gcc_42_build => 5666, :clang => "2.0", :clang_build => 137 },
|
||||
"4.0.1" => { :gcc_40_build => 5494, :gcc_42_build => 5666, :clang => "2.0", :clang_build => 137 },
|
||||
"4.0.2" => { :gcc_40_build => 5494, :gcc_42_build => 5666, :clang => "2.0", :clang_build => 137 },
|
||||
"4.2" => { :clang => "3.0", :clang_build => 211 },
|
||||
"4.3" => { :clang => "3.1", :clang_build => 318 },
|
||||
"4.3.1" => { :clang => "3.1", :clang_build => 318 },
|
||||
"4.3.2" => { :clang => "3.1", :clang_build => 318 },
|
||||
"4.3.3" => { :clang => "3.1", :clang_build => 318 },
|
||||
"4.4" => { :clang => "4.0", :clang_build => 421 },
|
||||
"4.4.1" => { :clang => "4.0", :clang_build => 421 },
|
||||
"4.5" => { :clang => "4.1", :clang_build => 421 },
|
||||
"4.5.1" => { :clang => "4.1", :clang_build => 421 },
|
||||
"4.5.2" => { :clang => "4.1", :clang_build => 421 },
|
||||
"4.6" => { :clang => "4.2", :clang_build => 425 },
|
||||
"4.6.1" => { :clang => "4.2", :clang_build => 425 },
|
||||
"4.6.2" => { :clang => "4.2", :clang_build => 425 },
|
||||
"4.6.3" => { :clang => "4.2", :clang_build => 425 },
|
||||
"5.0" => { :clang => "5.0", :clang_build => 500 },
|
||||
"5.0.1" => { :clang => "5.0", :clang_build => 500 },
|
||||
"5.0.2" => { :clang => "5.0", :clang_build => 500 },
|
||||
"5.1" => { :clang => "5.1", :clang_build => 503 },
|
||||
"5.1.1" => { :clang => "5.1", :clang_build => 503 },
|
||||
"6.0" => { :clang => "6.0", :clang_build => 600 },
|
||||
"6.0.1" => { :clang => "6.0", :clang_build => 600 },
|
||||
"6.1" => { :clang => "6.0", :clang_build => 600 },
|
||||
"6.1.1" => { :clang => "6.0", :clang_build => 600 },
|
||||
"6.2" => { :clang => "6.0", :clang_build => 600 },
|
||||
"6.3" => { :clang => "6.1", :clang_build => 602 },
|
||||
"6.3.1" => { :clang => "6.1", :clang_build => 602 },
|
||||
"6.3.2" => { :clang => "6.1", :clang_build => 602 },
|
||||
"6.4" => { :clang => "6.1", :clang_build => 602 },
|
||||
"7.0" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.0.1" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.1" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.1.1" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.2" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.2.1" => { :clang => "7.0", :clang_build => 700 },
|
||||
"7.3" => { :clang => "7.3", :clang_build => 703 },
|
||||
"7.3.1" => { :clang => "7.3", :clang_build => 703 },
|
||||
"8.0" => { :clang => "8.0", :clang_build => 800 },
|
||||
"2.0" => { gcc_40_build: 4061 },
|
||||
"2.5" => { gcc_40_build: 5370 },
|
||||
"3.1.4" => { gcc_40_build: 5493, gcc_42_build: 5577 },
|
||||
"3.2.6" => { gcc_40_build: 5494, gcc_42_build: 5666, clang: "1.7", clang_build: 77 },
|
||||
"4.0" => { gcc_40_build: 5494, gcc_42_build: 5666, clang: "2.0", clang_build: 137 },
|
||||
"4.0.1" => { gcc_40_build: 5494, gcc_42_build: 5666, clang: "2.0", clang_build: 137 },
|
||||
"4.0.2" => { gcc_40_build: 5494, gcc_42_build: 5666, clang: "2.0", clang_build: 137 },
|
||||
"4.2" => { clang: "3.0", clang_build: 211 },
|
||||
"4.3" => { clang: "3.1", clang_build: 318 },
|
||||
"4.3.1" => { clang: "3.1", clang_build: 318 },
|
||||
"4.3.2" => { clang: "3.1", clang_build: 318 },
|
||||
"4.3.3" => { clang: "3.1", clang_build: 318 },
|
||||
"4.4" => { clang: "4.0", clang_build: 421 },
|
||||
"4.4.1" => { clang: "4.0", clang_build: 421 },
|
||||
"4.5" => { clang: "4.1", clang_build: 421 },
|
||||
"4.5.1" => { clang: "4.1", clang_build: 421 },
|
||||
"4.5.2" => { clang: "4.1", clang_build: 421 },
|
||||
"4.6" => { clang: "4.2", clang_build: 425 },
|
||||
"4.6.1" => { clang: "4.2", clang_build: 425 },
|
||||
"4.6.2" => { clang: "4.2", clang_build: 425 },
|
||||
"4.6.3" => { clang: "4.2", clang_build: 425 },
|
||||
"5.0" => { clang: "5.0", clang_build: 500 },
|
||||
"5.0.1" => { clang: "5.0", clang_build: 500 },
|
||||
"5.0.2" => { clang: "5.0", clang_build: 500 },
|
||||
"5.1" => { clang: "5.1", clang_build: 503 },
|
||||
"5.1.1" => { clang: "5.1", clang_build: 503 },
|
||||
"6.0" => { clang: "6.0", clang_build: 600 },
|
||||
"6.0.1" => { clang: "6.0", clang_build: 600 },
|
||||
"6.1" => { clang: "6.0", clang_build: 600 },
|
||||
"6.1.1" => { clang: "6.0", clang_build: 600 },
|
||||
"6.2" => { clang: "6.0", clang_build: 600 },
|
||||
"6.3" => { clang: "6.1", clang_build: 602 },
|
||||
"6.3.1" => { clang: "6.1", clang_build: 602 },
|
||||
"6.3.2" => { clang: "6.1", clang_build: 602 },
|
||||
"6.4" => { clang: "6.1", clang_build: 602 },
|
||||
"7.0" => { clang: "7.0", clang_build: 700 },
|
||||
"7.0.1" => { clang: "7.0", clang_build: 700 },
|
||||
"7.1" => { clang: "7.0", clang_build: 700 },
|
||||
"7.1.1" => { clang: "7.0", clang_build: 700 },
|
||||
"7.2" => { clang: "7.0", clang_build: 700 },
|
||||
"7.2.1" => { clang: "7.0", clang_build: 700 },
|
||||
"7.3" => { clang: "7.3", clang_build: 703 },
|
||||
"7.3.1" => { clang: "7.3", clang_build: 703 },
|
||||
"8.0" => { clang: "8.0", clang_build: 800 },
|
||||
}.freeze
|
||||
|
||||
def compilers_standard?
|
||||
|
||||
@ -44,7 +44,7 @@ module CctoolsMachO
|
||||
else :dunno
|
||||
end
|
||||
|
||||
mach_data << { :arch => arch, :type => type }
|
||||
mach_data << { arch: arch, type: type }
|
||||
end
|
||||
mach_data
|
||||
rescue
|
||||
|
||||
@ -4,7 +4,7 @@ module RubyKeg
|
||||
def change_dylib_id(id, file)
|
||||
@require_install_name_tool = true
|
||||
puts "Changing dylib ID of #{file}\n from #{file.dylib_id}\n to #{id}" if ARGV.debug?
|
||||
MachO::Tools.change_dylib_id(file, id, :strict => false)
|
||||
MachO::Tools.change_dylib_id(file, id, strict: false)
|
||||
rescue MachO::MachOError
|
||||
onoe <<-EOS.undent
|
||||
Failed changing dylib ID of #{file}
|
||||
@ -17,7 +17,7 @@ module RubyKeg
|
||||
def change_install_name(old, new, file)
|
||||
@require_install_name_tool = true
|
||||
puts "Changing install name in #{file}\n from #{old}\n to #{new}" if ARGV.debug?
|
||||
MachO::Tools.change_install_name(file, old, new, :strict => false)
|
||||
MachO::Tools.change_install_name(file, old, new, strict: false)
|
||||
rescue MachO::MachOError
|
||||
onoe <<-EOS.undent
|
||||
Failed changing install name in #{file}
|
||||
|
||||
@ -33,7 +33,7 @@ module RubyMachO
|
||||
else :dunno
|
||||
end
|
||||
|
||||
mach_data << { :arch => arch, :type => type }
|
||||
mach_data << { arch: arch, type: type }
|
||||
end
|
||||
|
||||
mach_data
|
||||
|
||||
@ -4,15 +4,15 @@ module OS
|
||||
module Mac
|
||||
class Version < ::Version
|
||||
SYMBOLS = {
|
||||
: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 => "10.5",
|
||||
:tiger => "10.4",
|
||||
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: "10.5",
|
||||
tiger: "10.4",
|
||||
}.freeze
|
||||
|
||||
def self.from_symbol(sym)
|
||||
|
||||
@ -29,7 +29,7 @@ module Patch
|
||||
when Hash
|
||||
list
|
||||
when Array, String, :DATA
|
||||
{ :p1 => list }
|
||||
{ p1: list }
|
||||
else
|
||||
{}
|
||||
end.each_pair do |strip, urls|
|
||||
|
||||
@ -165,7 +165,7 @@ class Requirement
|
||||
def initialize(options, &block)
|
||||
case options
|
||||
when Hash
|
||||
@options = { :build_env => true }
|
||||
@options = { build_env: true }
|
||||
@options.merge!(options)
|
||||
else
|
||||
@satisfied = options
|
||||
|
||||
@ -19,7 +19,7 @@ require "requirements/emacs_requirement"
|
||||
class XcodeRequirement < Requirement
|
||||
fatal true
|
||||
|
||||
satisfy(:build_env => false) { xcode_installed_version }
|
||||
satisfy(build_env: false) { xcode_installed_version }
|
||||
|
||||
def initialize(tags)
|
||||
@version = tags.find { |t| tags.delete(t) if /(\d\.)+\d/ === t }
|
||||
@ -102,7 +102,7 @@ class ArchRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy(:build_env => false) do
|
||||
satisfy(build_env: false) do
|
||||
case @arch
|
||||
when :x86_64 then MacOS.prefer_64_bit?
|
||||
when :intel, :ppc then Hardware::CPU.type == @arch
|
||||
|
||||
@ -5,7 +5,7 @@ class AprRequirement < Requirement
|
||||
default_formula "apr-util"
|
||||
|
||||
# APR shipped in Tiger is too old, but Leopard+ is usable
|
||||
satisfy(:build_env => false) { MacOS.version > :leopard && MacOS::CLT.installed? }
|
||||
satisfy(build_env: false) { MacOS.version > :leopard && MacOS::CLT.installed? }
|
||||
|
||||
env do
|
||||
unless MacOS::CLT.installed?
|
||||
|
||||
@ -7,7 +7,7 @@ class CctoolsRequirement < Requirement
|
||||
fatal true
|
||||
default_formula "cctools"
|
||||
|
||||
satisfy(:build_env => false) do
|
||||
satisfy(build_env: false) do
|
||||
MacOS::Xcode.installed? || MacOS::CLT.installed? || Formula["cctools"].installed?
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,7 +7,7 @@ class EmacsRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
next false unless which "emacs"
|
||||
next true unless @version
|
||||
emacs_version = Utils.popen_read("emacs", "--batch", "--eval", "(princ emacs-version)")
|
||||
|
||||
@ -7,7 +7,7 @@ class FortranRequirement < Requirement
|
||||
|
||||
env { ENV.fortran }
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
which(ENV["FC"] || "gfortran")
|
||||
end
|
||||
end
|
||||
|
||||
@ -8,5 +8,5 @@ class GPG2Requirement < Requirement
|
||||
# MacGPG2/GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink
|
||||
# pointing to `gpg2`, as do we. Ensure we're actually using a 2.0 `gpg`.
|
||||
# Temporarily, only support 2.0.x rather than the 2.1.x "modern" series.
|
||||
satisfy(:build_env => false) { Gpg.gpg2 || Gpg.gpg }
|
||||
satisfy(build_env: false) { Gpg.gpg2 || Gpg.gpg }
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@ class JavaRequirement < Requirement
|
||||
cask "java"
|
||||
download "http://www.oracle.com/technetwork/java/javase/downloads/index.html"
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
next false unless File.executable? "/usr/libexec/java_home"
|
||||
|
||||
args = %w[--failfast]
|
||||
|
||||
@ -10,7 +10,7 @@ class LanguageModuleRequirement < Requirement
|
||||
super([language, module_name, import_name])
|
||||
end
|
||||
|
||||
satisfy(:build_env => false) { quiet_system(*the_test) }
|
||||
satisfy(build_env: false) { quiet_system(*the_test) }
|
||||
|
||||
def message
|
||||
s = <<-EOS.undent
|
||||
|
||||
@ -8,7 +8,7 @@ class MaximumMacOSRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy(:build_env => false) { MacOS.version <= @version }
|
||||
satisfy(build_env: false) { MacOS.version <= @version }
|
||||
|
||||
def message
|
||||
<<-EOS.undent
|
||||
|
||||
@ -8,7 +8,7 @@ class MinimumMacOSRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy(:build_env => false) { MacOS.version >= @version }
|
||||
satisfy(build_env: false) { MacOS.version >= @version }
|
||||
|
||||
def message
|
||||
"OS X #{@version.pretty_name} or newer is required."
|
||||
|
||||
@ -5,7 +5,7 @@ class OsxfuseRequirement < Requirement
|
||||
cask "osxfuse"
|
||||
download "https://osxfuse.github.io/"
|
||||
|
||||
satisfy(:build_env => false) { self.class.binary_osxfuse_installed? }
|
||||
satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
|
||||
|
||||
def self.binary_osxfuse_installed?
|
||||
File.exist?("/usr/local/include/osxfuse/fuse.h") &&
|
||||
@ -19,7 +19,7 @@ end
|
||||
|
||||
class NonBinaryOsxfuseRequirement < Requirement
|
||||
fatal true
|
||||
satisfy(:build_env => false) { HOMEBREW_PREFIX.to_s != "/usr/local" || !OsxfuseRequirement.binary_osxfuse_installed? }
|
||||
satisfy(build_env: false) { HOMEBREW_PREFIX.to_s != "/usr/local" || !OsxfuseRequirement.binary_osxfuse_installed? }
|
||||
|
||||
def message
|
||||
<<-EOS.undent
|
||||
|
||||
@ -8,7 +8,7 @@ class PerlRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy(:build_env => false) do
|
||||
satisfy(build_env: false) do
|
||||
which_all("perl").detect do |perl|
|
||||
perl_version = Utils.popen_read(perl, "--version")[/\(v(\d+\.\d+)(?:\.\d+)?\)/, 1]
|
||||
next unless perl_version
|
||||
|
||||
@ -5,7 +5,7 @@ class PythonRequirement < Requirement
|
||||
default_formula "python"
|
||||
cask "python"
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
python = which_python
|
||||
next unless python
|
||||
version = python_short_version
|
||||
@ -58,7 +58,7 @@ class Python3Requirement < PythonRequirement
|
||||
default_formula "python3"
|
||||
cask "python3"
|
||||
|
||||
satisfy(:build_env => false) { which_python }
|
||||
satisfy(build_env: false) { which_python }
|
||||
|
||||
def python_binary
|
||||
"python3"
|
||||
|
||||
@ -8,7 +8,7 @@ class RubyRequirement < Requirement
|
||||
super
|
||||
end
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
which_all("ruby").detect do |ruby|
|
||||
version = /\d\.\d/.match Utils.popen_read(ruby, "--version")
|
||||
next unless version
|
||||
|
||||
@ -3,7 +3,7 @@ require "requirement"
|
||||
class TuntapRequirement < Requirement
|
||||
fatal true
|
||||
cask "tuntap"
|
||||
satisfy(:build_env => false) { self.class.binary_tuntap_installed? }
|
||||
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
|
||||
|
||||
def self.binary_tuntap_installed?
|
||||
%w[
|
||||
|
||||
@ -3,7 +3,7 @@ require "requirement"
|
||||
class UnsignedKextRequirement < Requirement
|
||||
fatal true
|
||||
|
||||
satisfy(:build_env => false) { MacOS.version < :yosemite }
|
||||
satisfy(build_env: false) { MacOS.version < :yosemite }
|
||||
|
||||
def message
|
||||
s = <<-EOS.undent
|
||||
|
||||
@ -22,7 +22,7 @@ class X11Requirement < Requirement
|
||||
super(tags)
|
||||
end
|
||||
|
||||
satisfy :build_env => false do
|
||||
satisfy build_env: false do
|
||||
MacOS::XQuartz.installed? && min_version <= Version.create(MacOS::XQuartz.version)
|
||||
end
|
||||
|
||||
|
||||
@ -42,25 +42,25 @@ class Sandbox
|
||||
end
|
||||
|
||||
def allow_write(path, options = {})
|
||||
add_rule :allow => true, :operation => "file-write*", :filter => path_filter(path, options[:type])
|
||||
add_rule allow: true, operation: "file-write*", filter: path_filter(path, options[:type])
|
||||
end
|
||||
|
||||
def deny_write(path, options = {})
|
||||
add_rule :allow => false, :operation => "file-write*", :filter => path_filter(path, options[:type])
|
||||
add_rule allow: false, operation: "file-write*", filter: path_filter(path, options[:type])
|
||||
end
|
||||
|
||||
def allow_write_path(path)
|
||||
allow_write path, :type => :subpath
|
||||
allow_write path, type: :subpath
|
||||
end
|
||||
|
||||
def deny_write_path(path)
|
||||
deny_write path, :type => :subpath
|
||||
deny_write path, type: :subpath
|
||||
end
|
||||
|
||||
def allow_write_temp_and_cache
|
||||
allow_write_path "/private/tmp"
|
||||
allow_write_path "/private/var/tmp"
|
||||
allow_write "^/private/var/folders/[^/]+/[^/]+/[C,T]/", :type => :regex
|
||||
allow_write "^/private/var/folders/[^/]+/[^/]+/[C,T]/", type: :regex
|
||||
allow_write_path HOMEBREW_TEMP
|
||||
allow_write_path HOMEBREW_CACHE
|
||||
end
|
||||
|
||||
@ -215,7 +215,7 @@ class Tap
|
||||
|
||||
begin
|
||||
safe_system "git", *args
|
||||
unless Readall.valid_tap?(self, :aliases => true)
|
||||
unless Readall.valid_tap?(self, aliases: true)
|
||||
unless ARGV.homebrew_developer?
|
||||
raise "Cannot tap #{name}: invalid syntax in tap!"
|
||||
end
|
||||
|
||||
@ -10,8 +10,8 @@ group :coverage do
|
||||
# back to stable as soon as v0.12.1 or v0.13.0 is released. See pull request
|
||||
# <https://github.com/Homebrew/legacy-homebrew/pull/48250> for full details.
|
||||
gem "simplecov", "0.12.0",
|
||||
:git => "https://github.com/colszowka/simplecov.git",
|
||||
:branch => "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1
|
||||
:require => false
|
||||
git: "https://github.com/colszowka/simplecov.git",
|
||||
branch: "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1
|
||||
require: false
|
||||
gem "codecov", require: false
|
||||
end
|
||||
|
||||
@ -11,7 +11,7 @@ TEST_FILES = Dir["#{TEST_DIRECTORY}/test_*.rb"].reject do |f|
|
||||
f.include?("/test_os_mac_") && !mac?
|
||||
end
|
||||
|
||||
task :default => :test
|
||||
task default: :test
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << TEST_DIRECTORY
|
||||
|
||||
@ -50,7 +50,7 @@ class FormulaTextTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_has_end
|
||||
ft = formula_text "end", "", :patch => "__END__\na patch here"
|
||||
ft = formula_text "end", "", patch: "__END__\na patch here"
|
||||
assert ft.end?, "The formula must have __END__"
|
||||
assert_equal "class End < Formula\n \nend", ft.without_patch
|
||||
end
|
||||
@ -138,7 +138,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_ordering_issue
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
homepage "http://example.com"
|
||||
@ -150,7 +150,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_resource_placement
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "https://example.com/foo-1.0.tgz"
|
||||
|
||||
@ -167,7 +167,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_plist_placement
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "https://example.com/foo-1.0.tgz"
|
||||
|
||||
@ -185,7 +185,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_url_outside_of_stable_block
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
stable do
|
||||
@ -198,7 +198,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_head_and_head_do
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
head "http://example.com/foo.git"
|
||||
head do
|
||||
@ -211,7 +211,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_file_strict_bottle_and_bottle_do
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
bottle do
|
||||
@ -234,7 +234,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
fa.audit_class
|
||||
assert_equal [], fa.problems
|
||||
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
end
|
||||
@ -291,7 +291,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_line_pkgshare
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true
|
||||
class Foo < Formula
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
end
|
||||
@ -320,7 +320,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
# Formulae with "++" in their name would break various audit regexps:
|
||||
# Error: nested *?+ in regexp: /^libxml++3\s/
|
||||
def test_audit_plus_plus_name
|
||||
fa = formula_auditor "foolibc++", <<-EOS.undent, :strict => true
|
||||
fa = formula_auditor "foolibc++", <<-EOS.undent, strict: true
|
||||
class Foolibcxx < Formula
|
||||
desc "foolibc++ is a test"
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
@ -358,7 +358,7 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_audit_github_repository_no_api
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :strict => true, :online => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, strict: true, online: true
|
||||
class Foo < Formula
|
||||
homepage "https://github.com/example/example"
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
@ -393,14 +393,14 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
|
||||
def test_audit_desc
|
||||
formula_descriptions = [
|
||||
{ :name => "foo", :desc => nil,
|
||||
:problem => "Formula should have a desc" },
|
||||
{ :name => "bar", :desc => "bar" * 30,
|
||||
:problem => "Description is too long" },
|
||||
{ :name => "baz", :desc => "Baz commandline tool",
|
||||
:problem => "Description should use \"command-line\"" },
|
||||
{ :name => "qux", :desc => "A tool called Qux",
|
||||
:problem => "Description shouldn't start with an indefinite article" },
|
||||
{ name: "foo", desc: nil,
|
||||
problem: "Formula should have a desc" },
|
||||
{ name: "bar", desc: "bar" * 30,
|
||||
problem: "Description is too long" },
|
||||
{ name: "baz", desc: "Baz commandline tool",
|
||||
problem: "Description should use \"command-line\"" },
|
||||
{ name: "qux", desc: "A tool called Qux",
|
||||
problem: "Description shouldn't start with an indefinite article" },
|
||||
]
|
||||
|
||||
formula_descriptions.each do |formula|
|
||||
@ -411,14 +411,14 @@ class FormulaAuditorTests < Homebrew::TestCase
|
||||
end
|
||||
EOS
|
||||
|
||||
fa = formula_auditor formula[:name], content, :strict => true
|
||||
fa = formula_auditor formula[:name], content, strict: true
|
||||
fa.audit_desc
|
||||
assert_match formula[:problem], fa.problems.first
|
||||
end
|
||||
end
|
||||
|
||||
def test_audit_homepage
|
||||
fa = formula_auditor "foo", <<-EOS.undent, :online => true
|
||||
fa = formula_auditor "foo", <<-EOS.undent, online: true
|
||||
class Foo < Formula
|
||||
homepage "ftp://example.com/foo"
|
||||
url "http://example.com/foo-1.0.tgz"
|
||||
|
||||
@ -52,8 +52,8 @@ class TestbotStepTests < Homebrew::TestCase
|
||||
|
||||
def stub_test_instance
|
||||
stub(
|
||||
:category => "stub",
|
||||
:log_root => Pathname.pwd
|
||||
category: "stub",
|
||||
log_root: Pathname.pwd
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@ -37,14 +37,14 @@ class CompilerFailureTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_create_with_hash
|
||||
failure = create(:gcc => "4.8")
|
||||
failure = create(gcc: "4.8")
|
||||
assert_fails_with compiler("gcc-4.8", "4.8"), failure
|
||||
assert_fails_with compiler("gcc-4.8", "4.8.1"), failure
|
||||
refute_fails_with compiler("gcc-4.7", "4.7"), failure
|
||||
end
|
||||
|
||||
def test_create_with_hash_and_version
|
||||
failure = create(:gcc => "4.8") { version "4.8.1" }
|
||||
failure = create(gcc: "4.8") { version "4.8.1" }
|
||||
assert_fails_with compiler("gcc-4.8", "4.8"), failure
|
||||
assert_fails_with compiler("gcc-4.8", "4.8.1"), failure
|
||||
refute_fails_with compiler("gcc-4.8", "4.8.2"), failure
|
||||
|
||||
@ -42,7 +42,7 @@ class CompilerSelectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_all_compiler_failures
|
||||
@f << :clang << :llvm << :gcc << { :gcc => "4.8" } << { :gcc => "4.7" }
|
||||
@f << :clang << :llvm << :gcc << { gcc: "4.8" } << { gcc: "4.7" }
|
||||
assert_raises(CompilerSelectionError) { actual_cc }
|
||||
end
|
||||
|
||||
@ -66,7 +66,7 @@ class CompilerSelectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_fails_with_non_apple_gcc
|
||||
@f << { :gcc => "4.8" }
|
||||
@f << { gcc: "4.8" }
|
||||
assert_equal :clang, actual_cc
|
||||
end
|
||||
|
||||
@ -86,12 +86,12 @@ class CompilerSelectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_mixed_failures_4
|
||||
@f << :clang << { :gcc => "4.8" }
|
||||
@f << :clang << { gcc: "4.8" }
|
||||
assert_equal :gcc, actual_cc
|
||||
end
|
||||
|
||||
def test_mixed_failures_5
|
||||
@f << :clang << :gcc << :llvm << { :gcc => "4.8" }
|
||||
@f << :clang << :gcc << :llvm << { gcc: "4.8" }
|
||||
assert_equal "gcc-4.7", actual_cc
|
||||
end
|
||||
|
||||
@ -102,13 +102,13 @@ class CompilerSelectorTests < Homebrew::TestCase
|
||||
|
||||
def test_missing_gcc
|
||||
@versions.gcc_build_version = nil
|
||||
@f << :clang << :llvm << { :gcc => "4.8" } << { :gcc => "4.7" }
|
||||
@f << :clang << :llvm << { gcc: "4.8" } << { gcc: "4.7" }
|
||||
assert_raises(CompilerSelectionError) { actual_cc }
|
||||
end
|
||||
|
||||
def test_missing_llvm_and_gcc
|
||||
@versions.gcc_build_version = nil
|
||||
@f << :clang << { :gcc => "4.8" } << { :gcc => "4.7" }
|
||||
@f << :clang << { gcc: "4.8" } << { gcc: "4.7" }
|
||||
assert_raises(CompilerSelectionError) { actual_cc }
|
||||
end
|
||||
end
|
||||
|
||||
@ -48,8 +48,8 @@ class DependencyCollectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_requirement_tags
|
||||
@d.add :x11 => "2.5.1"
|
||||
@d.add :xcode => :build
|
||||
@d.add x11: "2.5.1"
|
||||
@d.add xcode: :build
|
||||
assert_empty find_requirement(X11Requirement).tags
|
||||
assert_predicate find_requirement(XcodeRequirement), :build?
|
||||
end
|
||||
@ -60,17 +60,17 @@ class DependencyCollectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_x11_min_version
|
||||
@d.add :x11 => "2.5.1"
|
||||
@d.add x11: "2.5.1"
|
||||
assert_equal "2.5.1", find_requirement(X11Requirement).min_version.to_s
|
||||
end
|
||||
|
||||
def test_x11_tag
|
||||
@d.add :x11 => :optional
|
||||
@d.add x11: :optional
|
||||
assert_predicate find_requirement(X11Requirement), :optional?
|
||||
end
|
||||
|
||||
def test_x11_min_version_and_tag
|
||||
@d.add :x11 => ["2.5.1", :optional]
|
||||
@d.add x11: ["2.5.1", :optional]
|
||||
dep = find_requirement(X11Requirement)
|
||||
assert_equal "2.5.1", dep.min_version.to_s
|
||||
assert_predicate dep, :optional?
|
||||
|
||||
@ -4,7 +4,7 @@ require "dependency"
|
||||
class DependencyExpansionTests < Homebrew::TestCase
|
||||
def build_dep(name, tags = [], deps = [])
|
||||
dep = Dependency.new(name.to_s, tags)
|
||||
dep.stubs(:to_formula).returns(stub(:deps => deps, :name => name))
|
||||
dep.stubs(:to_formula).returns(stub(deps: deps, name: name))
|
||||
dep
|
||||
end
|
||||
|
||||
@ -14,7 +14,7 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
@baz = build_dep(:baz)
|
||||
@qux = build_dep(:qux)
|
||||
@deps = [@foo, @bar, @baz, @qux]
|
||||
@f = stub(:deps => @deps, :name => "f")
|
||||
@f = stub(deps: @deps, name: "f")
|
||||
end
|
||||
|
||||
def test_expand_yields_dependent_and_dep_pairs
|
||||
@ -43,19 +43,19 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_expand_preserves_dependency_order
|
||||
@foo.stubs(:to_formula).returns(stub(:name => "f", :deps => [@qux, @baz]))
|
||||
@foo.stubs(:to_formula).returns(stub(name: "f", deps: [@qux, @baz]))
|
||||
assert_equal [@qux, @baz, @foo, @bar], Dependency.expand(@f)
|
||||
end
|
||||
|
||||
def test_expand_skips_optionals_by_default
|
||||
deps = [build_dep(:foo, [:optional]), @bar, @baz, @qux]
|
||||
f = stub(:deps => deps, :build => stub(:with? => false), :name => "f")
|
||||
f = stub(deps: deps, build: stub(with?: false), name: "f")
|
||||
assert_equal [@bar, @baz, @qux], Dependency.expand(f)
|
||||
end
|
||||
|
||||
def test_expand_keeps_recommendeds_by_default
|
||||
deps = [build_dep(:foo, [:recommended]), @bar, @baz, @qux]
|
||||
f = stub(:deps => deps, :build => stub(:with? => true), :name => "f")
|
||||
f = stub(deps: deps, build: stub(with?: true), name: "f")
|
||||
assert_equal deps, Dependency.expand(f)
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
def test_merger_preserves_env_proc
|
||||
env_proc = stub
|
||||
dep = Dependency.new("foo", [], env_proc)
|
||||
dep.stubs(:to_formula).returns(stub(:deps => [], :name => "foo"))
|
||||
dep.stubs(:to_formula).returns(stub(deps: [], name: "foo"))
|
||||
@deps.replace [dep]
|
||||
assert_equal env_proc, Dependency.expand(@f).first.env_proc
|
||||
end
|
||||
@ -88,8 +88,8 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
|
||||
def test_skip_skips_parent_but_yields_children
|
||||
f = stub(
|
||||
:name => "f",
|
||||
:deps => [
|
||||
name: "f",
|
||||
deps: [
|
||||
build_dep(:foo, [], [@bar, @baz]),
|
||||
build_dep(:foo, [], [@baz]),
|
||||
]
|
||||
@ -105,7 +105,7 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
def test_keep_dep_but_prune_recursive_deps
|
||||
foo = build_dep(:foo, [:build], @bar)
|
||||
baz = build_dep(:baz, [:build])
|
||||
f = stub(:name => "f", :deps => [foo, baz])
|
||||
f = stub(name: "f", deps: [foo, baz])
|
||||
|
||||
deps = Dependency.expand(f) do |_dependent, dep|
|
||||
Dependency.keep_but_prune_recursive_deps if dep.build?
|
||||
@ -122,15 +122,15 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
def test_cyclic_dependency
|
||||
foo = build_dep(:foo)
|
||||
bar = build_dep(:bar, [], [foo])
|
||||
foo.stubs(:to_formula).returns(stub(:deps => [bar], :name => "foo"))
|
||||
f = stub(:name => "f", :deps => [foo, bar])
|
||||
foo.stubs(:to_formula).returns(stub(deps: [bar], name: "foo"))
|
||||
f = stub(name: "f", deps: [foo, bar])
|
||||
assert_nothing_raised { Dependency.expand(f) }
|
||||
end
|
||||
|
||||
def test_clean_expand_stack
|
||||
foo = build_dep(:foo)
|
||||
foo.stubs(:to_formula).raises(FormulaUnavailableError, "foo")
|
||||
f = stub(:name => "f", :deps => [foo])
|
||||
f = stub(name: "f", deps: [foo])
|
||||
assert_raises(FormulaUnavailableError) { Dependency.expand(f) }
|
||||
assert_empty Dependency.instance_variable_get(:@expand_stack)
|
||||
end
|
||||
|
||||
@ -21,7 +21,7 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_expand_safe_system_args_with_explicit_quiet_flag
|
||||
@args << { :quiet_flag => "--flag" }
|
||||
@args << { quiet_flag: "--flag" }
|
||||
expanded_args = @strategy.expand_safe_system_args(@args)
|
||||
assert_equal %w[foo bar baz --flag], expanded_args
|
||||
end
|
||||
@ -39,8 +39,8 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
|
||||
|
||||
def test_source_modified_time
|
||||
mktemp "mtime" do
|
||||
touch "foo", :mtime => Time.now - 10
|
||||
touch "bar", :mtime => Time.now - 100
|
||||
touch "foo", mtime: Time.now - 10
|
||||
touch "bar", mtime: Time.now - 100
|
||||
ln_s "not-exist", "baz"
|
||||
assert_equal File.mtime("foo"), @strategy.source_modified_time
|
||||
end
|
||||
|
||||
@ -32,7 +32,7 @@ class ExceptionsTest < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_tap_formula_unavailable_error
|
||||
t = stub(:user => "u", :repo => "r", :to_s => "u/r", :installed? => false)
|
||||
t = stub(user: "u", repo: "r", to_s: "u/r", installed?: false)
|
||||
assert_match "Please tap it and then try again: brew tap u/r",
|
||||
TapFormulaUnavailableError.new(t, "foo").to_s
|
||||
end
|
||||
@ -73,7 +73,7 @@ class ExceptionsTest < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_build_error
|
||||
f = stub(:name => "foo")
|
||||
f = stub(name: "foo")
|
||||
assert_equal "Failed executing: badprg arg1 arg2",
|
||||
BuildError.new(f, "badprg", %w[arg1 arg2], {}).to_s
|
||||
end
|
||||
@ -84,20 +84,20 @@ class ExceptionsTest < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_formula_installation_already_attempted_error
|
||||
f = stub(:full_name => "foo/bar")
|
||||
f = stub(full_name: "foo/bar")
|
||||
assert_equal "Formula installation already attempted: foo/bar",
|
||||
FormulaInstallationAlreadyAttemptedError.new(f).to_s
|
||||
end
|
||||
|
||||
def test_formula_conflict_error
|
||||
f = stub(:full_name => "foo/qux")
|
||||
c = stub(:name => "bar", :reason => "I decided to")
|
||||
f = stub(full_name: "foo/qux")
|
||||
c = stub(name: "bar", reason: "I decided to")
|
||||
assert_match "Please `brew unlink bar` before continuing.",
|
||||
FormulaConflictError.new(f, [c]).to_s
|
||||
end
|
||||
|
||||
def test_compiler_selection_error
|
||||
f = stub(:full_name => "foo")
|
||||
f = stub(full_name: "foo")
|
||||
assert_match "foo cannot be built with any available compilers.",
|
||||
CompilerSelectionError.new(f).to_s
|
||||
end
|
||||
@ -115,27 +115,27 @@ class ExceptionsTest < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_checksum_mismatch_error
|
||||
h1 = stub(:hash_type => "sha256", :to_s => "deadbeef")
|
||||
h2 = stub(:hash_type => "sha256", :to_s => "deadcafe")
|
||||
h1 = stub(hash_type: "sha256", to_s: "deadbeef")
|
||||
h2 = stub(hash_type: "sha256", to_s: "deadcafe")
|
||||
assert_match "SHA256 mismatch",
|
||||
ChecksumMismatchError.new("/file.tar.gz", h1, h2).to_s
|
||||
end
|
||||
|
||||
def test_resource_missing_error
|
||||
f = stub(:full_name => "bar")
|
||||
r = stub(:inspect => "<resource foo>")
|
||||
f = stub(full_name: "bar")
|
||||
r = stub(inspect: "<resource foo>")
|
||||
assert_match "bar does not define resource <resource foo>",
|
||||
ResourceMissingError.new(f, r).to_s
|
||||
end
|
||||
|
||||
def test_duplicate_resource_error
|
||||
r = stub(:inspect => "<resource foo>")
|
||||
r = stub(inspect: "<resource foo>")
|
||||
assert_equal "Resource <resource foo> is defined more than once",
|
||||
DuplicateResourceError.new(r).to_s
|
||||
end
|
||||
|
||||
def test_bottle_version_mismatch_error
|
||||
f = stub(:full_name => "foo")
|
||||
f = stub(full_name: "foo")
|
||||
assert_match "Bottle version mismatch",
|
||||
BottleVersionMismatchError.new("/foo.bottle.tar.gz", "1.0", f, "1.1").to_s
|
||||
end
|
||||
|
||||
@ -10,7 +10,7 @@ class FormulaTests < Homebrew::TestCase
|
||||
spec = :stable
|
||||
alias_path = CoreTap.instance.alias_dir/"formula_alias"
|
||||
|
||||
f = klass.new(name, path, spec, :alias_path => alias_path)
|
||||
f = klass.new(name, path, spec, alias_path: alias_path)
|
||||
assert_equal name, f.name
|
||||
assert_equal path, f.path
|
||||
assert_equal alias_path, f.alias_path
|
||||
@ -72,16 +72,16 @@ class FormulaTests < Homebrew::TestCase
|
||||
|
||||
def test_installed?
|
||||
f = Testball.new
|
||||
f.stubs(:installed_prefix).returns(stub(:directory? => false))
|
||||
f.stubs(:installed_prefix).returns(stub(directory?: false))
|
||||
refute_predicate f, :installed?
|
||||
|
||||
f.stubs(:installed_prefix).returns(
|
||||
stub(:directory? => true, :children => [])
|
||||
stub(directory?: true, children: [])
|
||||
)
|
||||
refute_predicate f, :installed?
|
||||
|
||||
f.stubs(:installed_prefix).returns(
|
||||
stub(:directory? => true, :children => [stub])
|
||||
stub(directory?: true, children: [stub])
|
||||
)
|
||||
assert_predicate f, :installed?
|
||||
end
|
||||
@ -255,7 +255,7 @@ class FormulaTests < Homebrew::TestCase
|
||||
mirror "http://example.org/test-0.1.tbz"
|
||||
sha256 TEST_SHA256
|
||||
|
||||
head "http://example.com/test.git", :tag => "foo"
|
||||
head "http://example.com/test.git", tag: "foo"
|
||||
|
||||
devel do
|
||||
url "http://example.com/test-0.2.tbz"
|
||||
@ -352,7 +352,7 @@ class FormulaTests < Homebrew::TestCase
|
||||
initial_env = ENV.to_hash
|
||||
|
||||
f = formula do
|
||||
head "foo", :using => :git
|
||||
head "foo", using: :git
|
||||
end
|
||||
|
||||
cached_location = f.head.downloader.cached_location
|
||||
@ -616,47 +616,47 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_greater_different_tap_installed
|
||||
setup_tab_for_prefix(greater_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(greater_prefix, tap: "user/repo")
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_greater_same_tap_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(greater_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_outdated_different_tap_installed
|
||||
setup_tab_for_prefix(outdated_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_outdated_same_tap_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(outdated_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_same_head_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(head_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(head_prefix, tap: "homebrew/core")
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_different_head_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(head_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(head_prefix, tap: "user/repo")
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_mixed_taps_greater_version_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(outdated_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(greater_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core")
|
||||
setup_tab_for_prefix(greater_prefix, tap: "user/repo")
|
||||
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
|
||||
setup_tab_for_prefix(greater_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(greater_prefix, tap: "homebrew/core")
|
||||
reset_outdated_versions
|
||||
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
@ -668,12 +668,12 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
extra_outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.0"
|
||||
|
||||
setup_tab_for_prefix(outdated_prefix)
|
||||
setup_tab_for_prefix(extra_outdated_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(extra_outdated_prefix, tap: "homebrew/core")
|
||||
reset_outdated_versions
|
||||
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
|
||||
setup_tab_for_prefix(outdated_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(outdated_prefix, tap: "user/repo")
|
||||
reset_outdated_versions
|
||||
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
@ -681,18 +681,18 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
|
||||
def test_same_version_tap_installed
|
||||
f.instance_variable_set(:@tap, CoreTap.instance)
|
||||
setup_tab_for_prefix(same_prefix, :tap => "homebrew/core")
|
||||
setup_tab_for_prefix(same_prefix, tap: "homebrew/core")
|
||||
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
|
||||
setup_tab_for_prefix(same_prefix, :tap => "user/repo")
|
||||
setup_tab_for_prefix(same_prefix, tap: "user/repo")
|
||||
reset_outdated_versions
|
||||
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
end
|
||||
|
||||
def test_outdated_installed_head_less_than_stable
|
||||
tab = setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0" })
|
||||
tab = setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0" })
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
|
||||
# Tab.for_keg(head_prefix) will be fetched from CACHE but we write it anyway
|
||||
@ -710,7 +710,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
head_prefix_c = HOMEBREW_CELLAR.join("testball/HEAD-5658946")
|
||||
|
||||
setup_tab_for_prefix(outdated_stable_prefix)
|
||||
tab_a = setup_tab_for_prefix(head_prefix_a, :versions => { "stable" => "1.0" })
|
||||
tab_a = setup_tab_for_prefix(head_prefix_a, versions: { "stable" => "1.0" })
|
||||
setup_tab_for_prefix(head_prefix_b)
|
||||
|
||||
initial_env = ENV.to_hash
|
||||
@ -720,7 +720,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
@f = formula("testball") do
|
||||
url "foo"
|
||||
version "2.10"
|
||||
head "file://#{testball_repo}", :using => :git
|
||||
head "file://#{testball_repo}", using: :git
|
||||
end
|
||||
|
||||
%w[AUTHOR COMMITTER].each do |role|
|
||||
@ -738,20 +738,20 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
refute_predicate f.outdated_versions(:fetch_head => true), :empty?
|
||||
refute_predicate f.outdated_versions(fetch_head: true), :empty?
|
||||
|
||||
tab_a.source["versions"] = { "stable" => f.version.to_s }
|
||||
tab_a.write
|
||||
reset_outdated_versions
|
||||
refute_predicate f.outdated_versions(:fetch_head => true), :empty?
|
||||
refute_predicate f.outdated_versions(fetch_head: true), :empty?
|
||||
|
||||
head_prefix_a.rmtree
|
||||
reset_outdated_versions
|
||||
refute_predicate f.outdated_versions(:fetch_head => true), :empty?
|
||||
refute_predicate f.outdated_versions(fetch_head: true), :empty?
|
||||
|
||||
setup_tab_for_prefix(head_prefix_c, :source_modified_time => 1)
|
||||
setup_tab_for_prefix(head_prefix_c, source_modified_time: 1)
|
||||
reset_outdated_versions
|
||||
assert_predicate f.outdated_versions(:fetch_head => true), :empty?
|
||||
assert_predicate f.outdated_versions(fetch_head: true), :empty?
|
||||
ensure
|
||||
ENV.replace(initial_env)
|
||||
testball_repo.rmtree if testball_repo.exist?
|
||||
@ -770,7 +770,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
prefix = HOMEBREW_CELLAR.join("testball/0.1")
|
||||
setup_tab_for_prefix(prefix, :versions => { "stable" => "0.1" })
|
||||
setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" })
|
||||
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
ensure
|
||||
@ -785,22 +785,22 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
prefix_a = HOMEBREW_CELLAR.join("testball/20141009")
|
||||
setup_tab_for_prefix(prefix_a, :versions => { "stable" => "20141009", "version_scheme" => 1 })
|
||||
setup_tab_for_prefix(prefix_a, versions: { "stable" => "20141009", "version_scheme" => 1 })
|
||||
|
||||
prefix_b = HOMEBREW_CELLAR.join("testball/2.14")
|
||||
setup_tab_for_prefix(prefix_b, :versions => { "stable" => "2.14", "version_scheme" => 2 })
|
||||
setup_tab_for_prefix(prefix_b, versions: { "stable" => "2.14", "version_scheme" => 2 })
|
||||
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
reset_outdated_versions
|
||||
|
||||
prefix_c = HOMEBREW_CELLAR.join("testball/20141009")
|
||||
setup_tab_for_prefix(prefix_c, :versions => { "stable" => "20141009", "version_scheme" => 3 })
|
||||
setup_tab_for_prefix(prefix_c, versions: { "stable" => "20141009", "version_scheme" => 3 })
|
||||
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
reset_outdated_versions
|
||||
|
||||
prefix_d = HOMEBREW_CELLAR.join("testball/20141011")
|
||||
setup_tab_for_prefix(prefix_d, :versions => { "stable" => "20141009", "version_scheme" => 3 })
|
||||
setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 })
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
ensure
|
||||
f.rack.rmtree
|
||||
@ -815,13 +815,13 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
|
||||
head_prefix = HOMEBREW_CELLAR.join("testball/HEAD")
|
||||
|
||||
setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0", "version_scheme" => 1 })
|
||||
setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 1 })
|
||||
refute_predicate f.outdated_versions, :empty?
|
||||
|
||||
reset_outdated_versions
|
||||
head_prefix.rmtree
|
||||
|
||||
setup_tab_for_prefix(head_prefix, :versions => { "stable" => "1.0", "version_scheme" => 2 })
|
||||
setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 })
|
||||
assert_predicate f.outdated_versions, :empty?
|
||||
ensure
|
||||
head_prefix.rmtree
|
||||
|
||||
@ -160,7 +160,7 @@ class IntegrationCommandTests < Homebrew::TestCase
|
||||
|
||||
def setup_remote_tap(name)
|
||||
tap = Tap.fetch name
|
||||
tap.install(:full_clone => false, :quiet => true) unless tap.installed?
|
||||
tap.install(full_clone: false, quiet: true) unless tap.installed?
|
||||
tap
|
||||
end
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ require "resource"
|
||||
class LanguagePythonTests < Homebrew::TestCase
|
||||
def setup
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
resource = stub("resource", :stage => true)
|
||||
resource = stub("resource", stage: true)
|
||||
formula_bin = @dir/"formula_bin"
|
||||
@formula = mock("formula") do
|
||||
stubs(:resource).returns(resource)
|
||||
@ -20,7 +20,7 @@ class LanguagePythonTests < Homebrew::TestCase
|
||||
|
||||
def test_virtualenv_creation
|
||||
@formula.expects(:resource).with("homebrew-virtualenv").returns(
|
||||
mock("resource", :stage => true)
|
||||
mock("resource", stage: true)
|
||||
)
|
||||
@venv.create
|
||||
end
|
||||
@ -28,7 +28,7 @@ class LanguagePythonTests < Homebrew::TestCase
|
||||
# or at least doesn't crash the second time
|
||||
def test_virtualenv_creation_is_idempotent
|
||||
@formula.expects(:resource).with("homebrew-virtualenv").returns(
|
||||
mock("resource", :stage => true)
|
||||
mock("resource", stage: true)
|
||||
)
|
||||
@venv.create
|
||||
FileUtils.mkdir_p @dir/"bin"
|
||||
|
||||
@ -58,7 +58,7 @@ class LegacyPatchTests < Homebrew::TestCase
|
||||
|
||||
def test_p0_hash_to_string
|
||||
patches = Patch.normalize_legacy_patches(
|
||||
:p0 => "http://example.com/patch.diff"
|
||||
p0: "http://example.com/patch.diff"
|
||||
)
|
||||
|
||||
assert_equal 1, patches.length
|
||||
@ -67,7 +67,7 @@ class LegacyPatchTests < Homebrew::TestCase
|
||||
|
||||
def test_p1_hash_to_string
|
||||
patches = Patch.normalize_legacy_patches(
|
||||
:p1 => "http://example.com/patch.diff"
|
||||
p1: "http://example.com/patch.diff"
|
||||
)
|
||||
|
||||
assert_equal 1, patches.length
|
||||
@ -76,8 +76,8 @@ class LegacyPatchTests < Homebrew::TestCase
|
||||
|
||||
def test_mixed_hash_to_strings
|
||||
patches = Patch.normalize_legacy_patches(
|
||||
:p1 => "http://example.com/patch1.diff",
|
||||
:p0 => "http://example.com/patch0.diff"
|
||||
p1: "http://example.com/patch1.diff",
|
||||
p0: "http://example.com/patch0.diff"
|
||||
)
|
||||
assert_equal 2, patches.length
|
||||
assert_equal 1, patches.count { |p| p.strip == :p0 }
|
||||
@ -86,10 +86,10 @@ class LegacyPatchTests < Homebrew::TestCase
|
||||
|
||||
def test_mixed_hash_to_arrays
|
||||
patches = Patch.normalize_legacy_patches(
|
||||
:p1 => ["http://example.com/patch10.diff",
|
||||
"http://example.com/patch11.diff"],
|
||||
:p0 => ["http://example.com/patch00.diff",
|
||||
"http://example.com/patch01.diff"]
|
||||
p1: ["http://example.com/patch10.diff",
|
||||
"http://example.com/patch11.diff"],
|
||||
p0: ["http://example.com/patch00.diff",
|
||||
"http://example.com/patch01.diff"]
|
||||
)
|
||||
|
||||
assert_equal 4, patches.length
|
||||
|
||||
@ -163,7 +163,7 @@ class PatchingTests < Homebrew::TestCase
|
||||
def test_patch_p0
|
||||
assert_patched formula {
|
||||
def patches
|
||||
{ :p0 => PATCH_URL_B }
|
||||
{ p0: PATCH_URL_B }
|
||||
end
|
||||
}
|
||||
end
|
||||
@ -179,7 +179,7 @@ class PatchingTests < Homebrew::TestCase
|
||||
def test_patch_hash
|
||||
assert_patched formula {
|
||||
def patches
|
||||
{ :p1 => PATCH_URL_A }
|
||||
{ p1: PATCH_URL_A }
|
||||
end
|
||||
}
|
||||
end
|
||||
@ -187,7 +187,7 @@ class PatchingTests < Homebrew::TestCase
|
||||
def test_patch_hash_array
|
||||
assert_patched formula {
|
||||
def patches
|
||||
{ :p1 => [PATCH_URL_A] }
|
||||
{ p1: [PATCH_URL_A] }
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@ -36,14 +36,14 @@ class RequirementTests < Homebrew::TestCase
|
||||
|
||||
def test_satisfy_true
|
||||
req = Class.new(Requirement) do
|
||||
satisfy(:build_env => false) { true }
|
||||
satisfy(build_env: false) { true }
|
||||
end.new
|
||||
assert_predicate req, :satisfied?
|
||||
end
|
||||
|
||||
def test_satisfy_false
|
||||
req = Class.new(Requirement) do
|
||||
satisfy(:build_env => false) { false }
|
||||
satisfy(build_env: false) { false }
|
||||
end.new
|
||||
refute_predicate req, :satisfied?
|
||||
end
|
||||
@ -67,7 +67,7 @@ class RequirementTests < Homebrew::TestCase
|
||||
|
||||
def test_satisfy_build_env_can_be_disabled
|
||||
req = Class.new(Requirement) do
|
||||
satisfy(:build_env => false) { true }
|
||||
satisfy(build_env: false) { true }
|
||||
end.new
|
||||
|
||||
ENV.expects(:with_build_environment).never
|
||||
|
||||
@ -12,42 +12,42 @@ class ResourceTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_url_with_specs
|
||||
@resource.url("foo", :branch => "master")
|
||||
@resource.url("foo", branch: "master")
|
||||
assert_equal "foo", @resource.url
|
||||
assert_equal({ :branch => "master" }, @resource.specs)
|
||||
assert_equal({ branch: "master" }, @resource.specs)
|
||||
end
|
||||
|
||||
def test_url_with_custom_download_strategy_class
|
||||
strategy = Class.new(AbstractDownloadStrategy)
|
||||
@resource.url("foo", :using => strategy)
|
||||
@resource.url("foo", using: strategy)
|
||||
assert_equal "foo", @resource.url
|
||||
assert_equal strategy, @resource.download_strategy
|
||||
end
|
||||
|
||||
def test_url_with_specs_and_download_strategy
|
||||
strategy = Class.new(AbstractDownloadStrategy)
|
||||
@resource.url("foo", :using => strategy, :branch => "master")
|
||||
@resource.url("foo", using: strategy, branch: "master")
|
||||
assert_equal "foo", @resource.url
|
||||
assert_equal({ :branch => "master" }, @resource.specs)
|
||||
assert_equal({ branch: "master" }, @resource.specs)
|
||||
assert_equal strategy, @resource.download_strategy
|
||||
end
|
||||
|
||||
def test_url_with_custom_download_strategy_symbol
|
||||
@resource.url("foo", :using => :git)
|
||||
@resource.url("foo", using: :git)
|
||||
assert_equal "foo", @resource.url
|
||||
assert_equal GitDownloadStrategy, @resource.download_strategy
|
||||
end
|
||||
|
||||
def test_raises_for_unknown_download_strategy_class
|
||||
assert_raises(TypeError) { @resource.url("foo", :using => Class.new) }
|
||||
assert_raises(TypeError) { @resource.url("foo", using: Class.new) }
|
||||
end
|
||||
|
||||
def test_does_not_mutate_specs_hash
|
||||
specs = { :using => :git, :branch => "master" }
|
||||
specs = { using: :git, branch: "master" }
|
||||
@resource.url("foo", specs)
|
||||
assert_equal({ :branch => "master" }, @resource.specs)
|
||||
assert_equal({ branch: "master" }, @resource.specs)
|
||||
assert_equal(:git, @resource.using)
|
||||
assert_equal({ :using => :git, :branch => "master" }, specs)
|
||||
assert_equal({ using: :git, branch: "master" }, specs)
|
||||
end
|
||||
|
||||
def test_version
|
||||
@ -70,7 +70,7 @@ class ResourceTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_version_from_tag
|
||||
@resource.url("http://example.com/foo-1.0.tar.gz", :tag => "v1.0.2")
|
||||
@resource.url("http://example.com/foo-1.0.tar.gz", tag: "v1.0.2")
|
||||
assert_version_equal "1.0.2", @resource.version
|
||||
assert_predicate @resource.version, :detected_from_url?
|
||||
end
|
||||
@ -109,7 +109,7 @@ class ResourceTests < Homebrew::TestCase
|
||||
def test_verify_download_integrity_missing
|
||||
fn = Pathname.new("test")
|
||||
|
||||
fn.stubs(:file? => true)
|
||||
fn.stubs(file?: true)
|
||||
fn.expects(:verify_checksum).raises(ChecksumMissingError)
|
||||
fn.expects(:sha256)
|
||||
|
||||
@ -117,7 +117,7 @@ class ResourceTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_verify_download_integrity_mismatch
|
||||
fn = stub(:file? => true)
|
||||
fn = stub(file?: true)
|
||||
checksum = @resource.sha256(TEST_SHA256)
|
||||
|
||||
fn.expects(:verify_checksum).with(checksum)
|
||||
|
||||
@ -49,8 +49,8 @@ class SandboxTest < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_complains_on_failure
|
||||
Utils.expects(:popen_read => "foo")
|
||||
ARGV.stubs(:verbose? => true)
|
||||
Utils.expects(popen_read: "foo")
|
||||
ARGV.stubs(verbose?: true)
|
||||
out, _err = capture_io do
|
||||
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
|
||||
end
|
||||
@ -63,8 +63,8 @@ class SandboxTest < Homebrew::TestCase
|
||||
Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc
|
||||
bar
|
||||
EOS
|
||||
Utils.expects(:popen_read => with_bogus_error)
|
||||
ARGV.stubs(:verbose? => true)
|
||||
Utils.expects(popen_read: with_bogus_error)
|
||||
ARGV.stubs(verbose?: true)
|
||||
out, _err = capture_io do
|
||||
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
|
||||
end
|
||||
|
||||
@ -36,18 +36,18 @@ class SoftwareSpecTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_set_owner
|
||||
owner = stub :name => "some_name",
|
||||
:full_name => "some_name",
|
||||
:tap => "homebrew/core"
|
||||
owner = stub name: "some_name",
|
||||
full_name: "some_name",
|
||||
tap: "homebrew/core"
|
||||
@spec.owner = owner
|
||||
assert_equal owner, @spec.owner
|
||||
end
|
||||
|
||||
def test_resource_owner
|
||||
@spec.resource("foo") { url "foo-1.0" }
|
||||
@spec.owner = stub :name => "some_name",
|
||||
:full_name => "some_name",
|
||||
:tap => "homebrew/core"
|
||||
@spec.owner = stub name: "some_name",
|
||||
full_name: "some_name",
|
||||
tap: "homebrew/core"
|
||||
assert_equal "some_name", @spec.name
|
||||
@spec.resources.each_value { |r| assert_equal @spec, r.owner }
|
||||
end
|
||||
@ -55,9 +55,9 @@ class SoftwareSpecTests < Homebrew::TestCase
|
||||
def test_resource_without_version_receives_owners_version
|
||||
@spec.url("foo-42")
|
||||
@spec.resource("bar") { url "bar" }
|
||||
@spec.owner = stub :name => "some_name",
|
||||
:full_name => "some_name",
|
||||
:tap => "homebrew/core"
|
||||
@spec.owner = stub name: "some_name",
|
||||
full_name: "some_name",
|
||||
tap: "homebrew/core"
|
||||
assert_version_equal "42", @spec.resource("bar").version
|
||||
end
|
||||
|
||||
@ -155,10 +155,10 @@ class BottleSpecificationTests < Homebrew::TestCase
|
||||
|
||||
def test_checksum_setters
|
||||
checksums = {
|
||||
:snow_leopard_32 => "deadbeef"*8,
|
||||
:snow_leopard => "faceb00c"*8,
|
||||
:lion => "baadf00d"*8,
|
||||
:mountain_lion => "8badf00d"*8,
|
||||
snow_leopard_32: "deadbeef"*8,
|
||||
snow_leopard: "faceb00c"*8,
|
||||
lion: "baadf00d"*8,
|
||||
mountain_lion: "8badf00d"*8,
|
||||
}
|
||||
|
||||
checksums.each_pair do |cat, digest|
|
||||
|
||||
@ -61,7 +61,7 @@ class TabTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def test_universal?
|
||||
tab = Tab.new(:used_options => %w[--universal])
|
||||
tab = Tab.new(used_options: %w[--universal])
|
||||
assert_predicate tab, :universal?
|
||||
end
|
||||
|
||||
@ -132,7 +132,7 @@ class TabTests < Homebrew::TestCase
|
||||
|
||||
def test_create_from_alias
|
||||
alias_path = CoreTap.instance.alias_dir/"bar"
|
||||
f = formula(:alias_path => alias_path) { url "foo-1.0" }
|
||||
f = formula(alias_path: alias_path) { url "foo-1.0" }
|
||||
compiler = DevelopmentTools.default_compiler
|
||||
stdlib = :libcxx
|
||||
tab = Tab.create(f, compiler, stdlib)
|
||||
@ -149,7 +149,7 @@ class TabTests < Homebrew::TestCase
|
||||
|
||||
def test_for_formula_from_alias
|
||||
alias_path = CoreTap.instance.alias_dir/"bar"
|
||||
f = formula(:alias_path => alias_path) { url "foo-1.0" }
|
||||
f = formula(alias_path: alias_path) { url "foo-1.0" }
|
||||
tab = Tab.for_formula(f)
|
||||
|
||||
assert_equal alias_path.to_s, tab.source["path"]
|
||||
|
||||
@ -182,7 +182,7 @@ class TapTest < Homebrew::TestCase
|
||||
already_tapped_tap = Tap.new("Homebrew", "foo")
|
||||
assert_equal true, already_tapped_tap.installed?
|
||||
right_remote = @tap.remote
|
||||
assert_raises(TapAlreadyTappedError) { already_tapped_tap.install :clone_target => right_remote }
|
||||
assert_raises(TapAlreadyTappedError) { already_tapped_tap.install clone_target: right_remote }
|
||||
end
|
||||
|
||||
def test_install_tap_remote_mismatch_error
|
||||
@ -191,13 +191,13 @@ class TapTest < Homebrew::TestCase
|
||||
touch @tap.path/".git/shallow"
|
||||
assert_equal true, already_tapped_tap.installed?
|
||||
wrong_remote = "#{@tap.remote}-oops"
|
||||
assert_raises(TapRemoteMismatchError) { already_tapped_tap.install :clone_target => wrong_remote, :full_clone => true }
|
||||
assert_raises(TapRemoteMismatchError) { already_tapped_tap.install clone_target: wrong_remote, full_clone: true }
|
||||
end
|
||||
|
||||
def test_install_tap_already_unshallow_error
|
||||
setup_git_repo
|
||||
already_tapped_tap = Tap.new("Homebrew", "foo")
|
||||
assert_raises(TapAlreadyUnshallowError) { already_tapped_tap.install :full_clone => true }
|
||||
assert_raises(TapAlreadyUnshallowError) { already_tapped_tap.install full_clone: true }
|
||||
end
|
||||
|
||||
def test_uninstall_tap_unavailable_error
|
||||
@ -208,7 +208,7 @@ class TapTest < Homebrew::TestCase
|
||||
def test_install_git_error
|
||||
tap = Tap.new("user", "repo")
|
||||
assert_raises(ErrorDuringExecution) do
|
||||
shutup { tap.install :clone_target => "file:///not/existed/remote/url" }
|
||||
shutup { tap.install clone_target: "file:///not/existed/remote/url" }
|
||||
end
|
||||
refute_predicate tap, :installed?
|
||||
refute_predicate Tap::TAP_DIRECTORY/"user", :exist?
|
||||
@ -219,7 +219,7 @@ class TapTest < Homebrew::TestCase
|
||||
setup_git_repo
|
||||
|
||||
tap = Tap.new("Homebrew", "bar")
|
||||
shutup { tap.install :clone_target => @tap.path/".git" }
|
||||
shutup { tap.install clone_target: @tap.path/".git" }
|
||||
assert_predicate tap, :installed?
|
||||
assert_predicate HOMEBREW_PREFIX/"share/man/man1/brew-tap-cmd.1", :file?
|
||||
shutup { tap.uninstall }
|
||||
|
||||
@ -30,8 +30,8 @@ class ReportTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def perform_update(fixture_name = "")
|
||||
Formulary.stubs(:factory).returns(stub(:pkg_version => "1.0"))
|
||||
FormulaVersions.stubs(:new).returns(stub(:formula_at_revision => "2.0"))
|
||||
Formulary.stubs(:factory).returns(stub(pkg_version: "1.0"))
|
||||
FormulaVersions.stubs(:new).returns(stub(formula_at_revision: "2.0"))
|
||||
@reporter.diff = fixture(fixture_name)
|
||||
@hub.add(@reporter) if @reporter.updated?
|
||||
end
|
||||
|
||||
@ -227,9 +227,9 @@ class UtilTests < Homebrew::TestCase
|
||||
s = truncate_text_to_approximate_size(long_s, n)
|
||||
assert_equal n, s.length
|
||||
assert_match(/^x+#{Regexp.escape(glue)}x+$/, s)
|
||||
s = truncate_text_to_approximate_size(long_s, n, :front_weight => 0.0)
|
||||
s = truncate_text_to_approximate_size(long_s, n, front_weight: 0.0)
|
||||
assert_equal glue + ("x" * (n - glue.length)), s
|
||||
s = truncate_text_to_approximate_size(long_s, n, :front_weight => 1.0)
|
||||
s = truncate_text_to_approximate_size(long_s, n, front_weight: 1.0)
|
||||
assert_equal(("x" * (n - glue.length)) + glue, s)
|
||||
end
|
||||
|
||||
@ -237,8 +237,8 @@ class UtilTests < Homebrew::TestCase
|
||||
ARGV.stubs(:homebrew_developer?).returns false
|
||||
e = assert_raises(FormulaMethodDeprecatedError) do
|
||||
odeprecated("method", "replacement",
|
||||
:caller => ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
|
||||
:die => true)
|
||||
caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
|
||||
die: true)
|
||||
end
|
||||
assert_match "method", e.message
|
||||
assert_match "replacement", e.message
|
||||
|
||||
@ -3,7 +3,7 @@ require "version"
|
||||
|
||||
class VersionTests < Homebrew::TestCase
|
||||
def test_accepts_objects_responding_to_to_str
|
||||
value = stub(:to_str => "0.1")
|
||||
value = stub(to_str: "0.1")
|
||||
assert_equal "0.1", Version.create(value).to_s
|
||||
end
|
||||
|
||||
@ -452,7 +452,7 @@ class VersionParsingTests < Homebrew::TestCase
|
||||
|
||||
def test_from_url
|
||||
assert_version_detected "1.2.3",
|
||||
"http://github.com/foo/bar.git", :tag => "v1.2.3"
|
||||
"http://github.com/foo/bar.git", tag: "v1.2.3"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ module Homebrew
|
||||
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
|
||||
|
||||
def formula(name = "formula_name", path = Formulary.core_path(name), spec = :stable, alias_path: nil, &block)
|
||||
@_f = Class.new(Formula, &block).new(name, path, spec, :alias_path => alias_path)
|
||||
@_f = Class.new(Formula, &block).new(name, path, spec, alias_path: alias_path)
|
||||
end
|
||||
|
||||
def mktmpdir(prefix_suffix = nil, &block)
|
||||
|
||||
@ -163,7 +163,7 @@ def odeprecated(method, replacement = nil, options = {})
|
||||
end
|
||||
|
||||
def odisabled(method, replacement = nil, options = {})
|
||||
options = { :die => true, :caller => caller }.merge(options)
|
||||
options = { die: true, caller: caller }.merge(options)
|
||||
odeprecated(method, replacement, options)
|
||||
end
|
||||
|
||||
@ -587,7 +587,7 @@ def truncate_text_to_approximate_size(s, max_bytes, options = {})
|
||||
end
|
||||
out = front + glue_bytes + back
|
||||
out.force_encoding("UTF-8")
|
||||
out.encode!("UTF-16", :invalid => :replace)
|
||||
out.encode!("UTF-16", invalid: :replace)
|
||||
out.encode!("UTF-8")
|
||||
out
|
||||
end
|
||||
|
||||
@ -55,10 +55,10 @@ module Utils
|
||||
|
||||
def report_event(category, action, label = os_prefix_ci, value = nil)
|
||||
report(:event,
|
||||
:ec => category,
|
||||
:ea => action,
|
||||
:el => label,
|
||||
:ev => value)
|
||||
ec: category,
|
||||
ea: action,
|
||||
el: label,
|
||||
ev: value)
|
||||
end
|
||||
|
||||
def report_exception(exception, options = {})
|
||||
@ -69,12 +69,12 @@ module Utils
|
||||
|
||||
fatal = options.fetch(:fatal, true) ? "1" : "0"
|
||||
report(:exception,
|
||||
:exd => exception.class.name,
|
||||
:exf => fatal)
|
||||
exd: exception.class.name,
|
||||
exf: fatal)
|
||||
end
|
||||
|
||||
def report_screenview(screen_name)
|
||||
report(:screenview, :cd => screen_name)
|
||||
report(:screenview, cd: screen_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -235,8 +235,8 @@ module GitHub
|
||||
|
||||
def build_search_qualifier_string(qualifiers)
|
||||
{
|
||||
:repo => "Homebrew/homebrew-core",
|
||||
:in => "title",
|
||||
repo: "Homebrew/homebrew-core",
|
||||
in: "title",
|
||||
}.update(qualifiers).map do |qualifier, value|
|
||||
"#{qualifier}:#{value}"
|
||||
end.join("+")
|
||||
@ -253,14 +253,14 @@ module GitHub
|
||||
|
||||
def issues_for_formula(name, options = {})
|
||||
tap = options[:tap] || CoreTap.instance
|
||||
issues_matching(name, :state => "open", :repo => "#{tap.user}/homebrew-#{tap.repo}")
|
||||
issues_matching(name, state: "open", repo: "#{tap.user}/homebrew-#{tap.repo}")
|
||||
end
|
||||
|
||||
def print_pull_requests_matching(query)
|
||||
return [] if ENV["HOMEBREW_NO_GITHUB_API"]
|
||||
ohai "Searching pull requests..."
|
||||
|
||||
open_or_closed_prs = issues_matching(query, :type => "pr")
|
||||
open_or_closed_prs = issues_matching(query, type: "pr")
|
||||
|
||||
open_prs = open_or_closed_prs.select { |i| i["state"] == "open" }
|
||||
if !open_prs.empty?
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
module Utils
|
||||
SHELL_PROFILE_MAP = {
|
||||
:bash => "~/.bash_profile",
|
||||
:csh => "~/.cshrc",
|
||||
:fish => "~/.config/fish/config.fish",
|
||||
:ksh => "~/.kshrc",
|
||||
:sh => "~/.bash_profile",
|
||||
:tcsh => "~/.tcshrc",
|
||||
:zsh => "~/.zshrc",
|
||||
bash: "~/.bash_profile",
|
||||
csh: "~/.cshrc",
|
||||
fish: "~/.config/fish/config.fish",
|
||||
ksh: "~/.kshrc",
|
||||
sh: "~/.bash_profile",
|
||||
tcsh: "~/.tcshrc",
|
||||
zsh: "~/.zshrc",
|
||||
}.freeze
|
||||
|
||||
module Shell
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user