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