commit
246bb1a3b1
@ -4,6 +4,8 @@ inherit_from:
|
|||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.0
|
TargetRubyVersion: 2.0
|
||||||
|
Include:
|
||||||
|
- '**/.simplecov'
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/cask/**/*'
|
- 'Homebrew/cask/**/*'
|
||||||
- 'Homebrew/vendor/**/*'
|
- 'Homebrew/vendor/**/*'
|
||||||
|
|||||||
@ -7,6 +7,14 @@ Style/StringLiterals:
|
|||||||
Style/StringLiteralsInInterpolation:
|
Style/StringLiteralsInInterpolation:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
|
|
||||||
|
# only for numbers >= 1_000_000
|
||||||
|
Style/NumericLiterals:
|
||||||
|
MinDigits: 7
|
||||||
|
|
||||||
|
# zero-prefixed octal literals are just too widely used (and mostly understood)
|
||||||
|
Style/NumericLiteralPrefix:
|
||||||
|
EnforcedOctalStyle: zero_only
|
||||||
|
|
||||||
# percent-x is allowed for multiline
|
# percent-x is allowed for multiline
|
||||||
Style/CommandLiteral:
|
Style/CommandLiteral:
|
||||||
EnforcedStyle: mixed
|
EnforcedStyle: mixed
|
||||||
@ -58,14 +66,6 @@ Lint/ParenthesesAsGroupedExpression:
|
|||||||
Style/EmptyLineBetweenDefs:
|
Style/EmptyLineBetweenDefs:
|
||||||
AllowAdjacentOneLineDefs: true
|
AllowAdjacentOneLineDefs: true
|
||||||
|
|
||||||
# port numbers and such tech stuff
|
|
||||||
Style/NumericLiterals:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# zero-prefixed octal literals are just too widely used (and mostly understood)
|
|
||||||
Style/NumericLiteralPrefix:
|
|
||||||
EnforcedOctalStyle: zero_only
|
|
||||||
|
|
||||||
# consistency and readability when faced with string interpolation
|
# consistency and readability when faced with string interpolation
|
||||||
Style/PercentLiteralDelimiters:
|
Style/PercentLiteralDelimiters:
|
||||||
PreferredDelimiters:
|
PreferredDelimiters:
|
||||||
@ -93,15 +93,31 @@ Style/AlignParameters:
|
|||||||
|
|
||||||
# counterproductive in formulas, notably within the install method
|
# counterproductive in formulas, notably within the install method
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'Taps/**/*'
|
||||||
Style/IfUnlessModifier:
|
Style/IfUnlessModifier:
|
||||||
|
Exclude:
|
||||||
|
- 'Taps/**/*'
|
||||||
|
|
||||||
|
# TODO: enforce when rubocop has fixed this
|
||||||
|
# https://github.com/bbatsov/rubocop/issues/3516
|
||||||
|
Style/VariableNumber:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# TODO: enforce when rubocop has shipped this
|
||||||
|
# https://github.com/bbatsov/rubocop/pull/3513
|
||||||
|
Style/TernaryParentheses:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# dashes in filenames are typical
|
# dashes in filenames are typical
|
||||||
# TODO: enforce when rubocop has fixed this
|
|
||||||
# https://github.com/bbatsov/rubocop/issues/1545
|
|
||||||
Style/FileName:
|
Style/FileName:
|
||||||
Enabled: false
|
# matches:
|
||||||
|
# file_name.rb (default)
|
||||||
|
# file-name.rb, --filename.rb (command names)
|
||||||
|
# FILENAME.rb (ARGV and ENV)
|
||||||
|
# does not match:
|
||||||
|
# dashes-and_underscores.rb
|
||||||
|
Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/
|
||||||
|
|
||||||
# no percent word array, being friendly to non-ruby users
|
# no percent word array, being friendly to non-ruby users
|
||||||
# TODO: enforce when rubocop has fixed this
|
# TODO: enforce when rubocop has fixed this
|
||||||
@ -134,6 +150,7 @@ Style/MethodName:
|
|||||||
Style/PredicateName:
|
Style/PredicateName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/compat/**/*'
|
- 'Homebrew/compat/**/*'
|
||||||
|
NameWhitelist: is_32_bit?, is_64_bit?
|
||||||
|
|
||||||
# `formula do` uses nested method definitions
|
# `formula do` uses nested method definitions
|
||||||
Lint/NestedMethodDefinition:
|
Lint/NestedMethodDefinition:
|
||||||
|
|||||||
@ -1,21 +1,11 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config --exclude-limit 30`
|
# `rubocop --auto-gen-config --exclude-limit 100`
|
||||||
# on 2016-09-18 15:15:22 +0100 using RuboCop version 0.41.2.
|
# on 2016-09-22 20:07:41 +0200 using RuboCop version 0.43.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
|
|
||||||
# SupportedStyles: keyword, variable, start_of_line
|
|
||||||
Lint/EndAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/download_strategy.rb'
|
|
||||||
- 'Homebrew/keg.rb'
|
|
||||||
- 'Homebrew/os/mac/cctools_mach.rb'
|
|
||||||
|
|
||||||
# Offense count: 18
|
# Offense count: 18
|
||||||
Lint/HandleExceptions:
|
Lint/HandleExceptions:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -52,11 +42,6 @@ Lint/NestedMethodDefinition:
|
|||||||
- 'Homebrew/dev-cmd/bottle.rb'
|
- 'Homebrew/dev-cmd/bottle.rb'
|
||||||
- 'Homebrew/dev-cmd/test-bot.rb'
|
- 'Homebrew/dev-cmd/test-bot.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Lint/NonLocalExitFromIterator:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/extend/pathname.rb'
|
|
||||||
|
|
||||||
# Offense count: 28
|
# Offense count: 28
|
||||||
Lint/RescueException:
|
Lint/RescueException:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -80,12 +65,7 @@ Lint/RescueException:
|
|||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Lint/ShadowedException:
|
Lint/ShadowedException:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/brew.rb'
|
- 'Homebrew/utils/fork.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Lint/UselessAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/requirements.rb'
|
|
||||||
|
|
||||||
# Offense count: 18
|
# Offense count: 18
|
||||||
Metrics/BlockNesting:
|
Metrics/BlockNesting:
|
||||||
@ -94,19 +74,13 @@ Metrics/BlockNesting:
|
|||||||
# Offense count: 20
|
# Offense count: 20
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Max: 400
|
Max: 370
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 2
|
||||||
# Configuration parameters: CountKeywordArgs.
|
# Configuration parameters: CountKeywordArgs.
|
||||||
Metrics/ParameterLists:
|
Metrics/ParameterLists:
|
||||||
Max: 6
|
Max: 6
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Performance/FixedSize:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/dev-cmd/audit.rb'
|
|
||||||
- 'Homebrew/dev-cmd/bottle.rb'
|
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 8
|
||||||
Style/AccessorMethodName:
|
Style/AccessorMethodName:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -125,33 +99,10 @@ Style/Alias:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/blacklist.rb'
|
- 'Homebrew/blacklist.rb'
|
||||||
|
|
||||||
# Offense count: 26
|
# Offense count: 1
|
||||||
Style/CaseEquality:
|
Style/CaseEquality:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/cleanup.rb'
|
|
||||||
- 'Homebrew/cmd/search.rb'
|
|
||||||
- 'Homebrew/compilers.rb'
|
- 'Homebrew/compilers.rb'
|
||||||
- 'Homebrew/cxxstdlib.rb'
|
|
||||||
- 'Homebrew/debrew.rb'
|
|
||||||
- 'Homebrew/dependencies.rb'
|
|
||||||
- 'Homebrew/dependency_collector.rb'
|
|
||||||
- 'Homebrew/download_strategy.rb'
|
|
||||||
- 'Homebrew/formula.rb'
|
|
||||||
- 'Homebrew/options.rb'
|
|
||||||
- 'Homebrew/patch.rb'
|
|
||||||
- 'Homebrew/pkg_version.rb'
|
|
||||||
- 'Homebrew/requirement.rb'
|
|
||||||
- 'Homebrew/requirements.rb'
|
|
||||||
- 'Homebrew/software_spec.rb'
|
|
||||||
- 'Homebrew/version.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
|
|
||||||
# SupportedStyles: case, end
|
|
||||||
Style/CaseIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/keg.rb'
|
|
||||||
|
|
||||||
# Offense count: 11
|
# Offense count: 11
|
||||||
Style/ClassVars:
|
Style/ClassVars:
|
||||||
@ -168,17 +119,6 @@ Style/ConstantName:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/os/mac.rb'
|
- 'Homebrew/os/mac.rb'
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
Style/DoubleNegation:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/extend/ARGV.rb'
|
|
||||||
- 'Homebrew/formula_installer.rb'
|
|
||||||
- 'Homebrew/os/mac/cctools_keg.rb'
|
|
||||||
- 'Homebrew/os/mac/ruby_keg.rb'
|
|
||||||
- 'Homebrew/os/mac/xcode.rb'
|
|
||||||
- 'Homebrew/requirement.rb'
|
|
||||||
- 'Homebrew/software_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
# SupportedStyles: format, sprintf, percent
|
# SupportedStyles: format, sprintf, percent
|
||||||
@ -193,22 +133,57 @@ Style/GlobalVars:
|
|||||||
- 'Homebrew/diagnostic.rb'
|
- 'Homebrew/diagnostic.rb'
|
||||||
- 'Homebrew/utils.rb'
|
- 'Homebrew/utils.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 70
|
||||||
Style/IdenticalConditionalBranches:
|
# Configuration parameters: MinBodyLength.
|
||||||
|
Style/GuardClause:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Homebrew/formula_lock.rb'
|
- 'Taps/**/*'
|
||||||
|
- 'Homebrew/cmd/update-report.rb'
|
||||||
# Offense count: 5
|
- 'Homebrew/dependency_collector.rb'
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
- 'Homebrew/dev-cmd/audit.rb'
|
||||||
# SupportedStyles: snake_case, camelCase
|
- 'Homebrew/dev-cmd/pull.rb'
|
||||||
Style/MethodName:
|
- 'Homebrew/dev-cmd/test-bot.rb'
|
||||||
Exclude:
|
- 'Homebrew/download_strategy.rb'
|
||||||
- 'Homebrew/compat/**/*'
|
- 'Homebrew/extend/ARGV.rb'
|
||||||
- 'Homebrew/cleanup.rb'
|
- 'Homebrew/extend/ENV/shared.rb'
|
||||||
- 'Homebrew/diagnostic.rb'
|
- 'Homebrew/extend/ENV/std.rb'
|
||||||
- 'Homebrew/formula_cellar_checks.rb'
|
- 'Homebrew/extend/ENV/super.rb'
|
||||||
|
- 'Homebrew/extend/fileutils.rb'
|
||||||
|
- 'Homebrew/extend/os/mac/extend/ENV/std.rb'
|
||||||
|
- 'Homebrew/extend/os/mac/formula_cellar_checks.rb'
|
||||||
|
- 'Homebrew/extend/os/mac/utils/bottles.rb'
|
||||||
|
- 'Homebrew/extend/string.rb'
|
||||||
|
- 'Homebrew/formula.rb'
|
||||||
- 'Homebrew/formula_installer.rb'
|
- 'Homebrew/formula_installer.rb'
|
||||||
- 'Homebrew/os/mac/cctools_mach.rb'
|
- 'Homebrew/formula_lock.rb'
|
||||||
|
- 'Homebrew/formulary.rb'
|
||||||
|
- 'Homebrew/keg.rb'
|
||||||
|
- 'Homebrew/migrator.rb'
|
||||||
|
- 'Homebrew/os/mac/xcode.rb'
|
||||||
|
- 'Homebrew/patch.rb'
|
||||||
|
- 'Homebrew/requirement.rb'
|
||||||
|
- 'Homebrew/tap.rb'
|
||||||
|
- 'Homebrew/test/test_cmd_testbot.rb'
|
||||||
|
- 'Homebrew/test/test_integration_cmds.rb'
|
||||||
|
- 'Homebrew/test/testing_env.rb'
|
||||||
|
- 'Homebrew/utils.rb'
|
||||||
|
- 'Homebrew/utils/popen.rb'
|
||||||
|
- 'Homebrew/version.rb'
|
||||||
|
|
||||||
|
# Offense count: 51
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: MaxLineLength.
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Exclude:
|
||||||
|
- 'Taps/**/*'
|
||||||
|
- 'Homebrew/dev-cmd/audit.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: SupportedStyles, IndentationWidth.
|
||||||
|
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
||||||
|
Style/IndentArray:
|
||||||
|
EnforcedStyle: special_inside_parentheses
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 7
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
@ -241,14 +216,6 @@ Style/MutableConstant:
|
|||||||
- 'Homebrew/tab.rb'
|
- 'Homebrew/tab.rb'
|
||||||
- 'Homebrew/tap.rb'
|
- 'Homebrew/tap.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
|
||||||
# SupportedStyles: skip_modifier_ifs, always
|
|
||||||
Style/Next:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/dev-cmd/test-bot.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 9
|
||||||
Style/OpMethod:
|
Style/OpMethod:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -257,37 +224,9 @@ Style/OpMethod:
|
|||||||
- 'Homebrew/install_renamed.rb'
|
- 'Homebrew/install_renamed.rb'
|
||||||
- 'Homebrew/options.rb'
|
- 'Homebrew/options.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 2
|
||||||
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
|
||||||
# NamePrefix: is_, has_, have_
|
|
||||||
# NamePrefixBlacklist: is_, has_, have_
|
|
||||||
# NameWhitelist: is_a?
|
|
||||||
Style/PredicateName:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/compat/**/*'
|
|
||||||
- 'Homebrew/download_strategy.rb'
|
|
||||||
- 'Homebrew/hardware.rb'
|
|
||||||
|
|
||||||
# Offense count: 7
|
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
|
# Configuration parameters: SupportedStyles.
|
||||||
# SupportedStyles: slashes, percent_r, mixed
|
# SupportedStyles: use_perl_names, use_english_names
|
||||||
Style/RegexpLiteral:
|
Style/SpecialGlobalVars:
|
||||||
Exclude:
|
EnforcedStyle: use_perl_names
|
||||||
- 'Homebrew/diagnostic.rb'
|
|
||||||
- 'Homebrew/keg.rb'
|
|
||||||
- 'Homebrew/version.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowAsExpressionSeparator.
|
|
||||||
Style/Semicolon:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/descriptions.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: Methods.
|
|
||||||
# Methods: {"reduce"=>["a", "e"]}, {"inject"=>["a", "e"]}
|
|
||||||
Style/SingleLineBlockParams:
|
|
||||||
Exclude:
|
|
||||||
- 'Homebrew/diagnostic.rb'
|
|
||||||
|
|||||||
@ -37,9 +37,9 @@ begin
|
|||||||
cmd = nil
|
cmd = nil
|
||||||
|
|
||||||
ARGV.dup.each_with_index do |arg, i|
|
ARGV.dup.each_with_index do |arg, i|
|
||||||
if help_flag && cmd
|
break if help_flag && cmd
|
||||||
break
|
|
||||||
elsif help_flag_list.include?(arg)
|
if help_flag_list.include?(arg)
|
||||||
# Option-style help: Both `--help <cmd>` and `<cmd> --help` are fine.
|
# Option-style help: Both `--help <cmd>` and `<cmd> --help` are fine.
|
||||||
help_flag = true
|
help_flag = true
|
||||||
elsif arg == "help" && !cmd
|
elsif arg == "help" && !cmd
|
||||||
|
|||||||
@ -31,9 +31,8 @@ class Build
|
|||||||
def post_superenv_hacks
|
def post_superenv_hacks
|
||||||
# Only allow Homebrew-approved directories into the PATH, unless
|
# Only allow Homebrew-approved directories into the PATH, unless
|
||||||
# a formula opts-in to allowing the user's path.
|
# a formula opts-in to allowing the user's path.
|
||||||
if formula.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
|
return unless formula.env.userpaths? || reqs.any? { |rq| rq.env.userpaths? }
|
||||||
ENV.userpaths!
|
ENV.userpaths!
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def effective_build_options_for(dependent)
|
def effective_build_options_for(dependent)
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
require: 'rubocop-cask'
|
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.0
|
TargetRubyVersion: 2.0
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- '**/.simplecov'
|
||||||
- '**/Casks/**/*'
|
- '**/Casks/**/*'
|
||||||
- 'developer/**/*'
|
|
||||||
- '**/vendor/**/*'
|
- '**/vendor/**/*'
|
||||||
|
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
@ -16,10 +14,10 @@ Metrics/ClassLength:
|
|||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Metrics/MethodLength:
|
Metrics/LineLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/MethodLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
@ -29,6 +27,16 @@ Metrics/ModuleLength:
|
|||||||
- 'lib/hbc/macos.rb'
|
- 'lib/hbc/macos.rb'
|
||||||
- 'lib/hbc/utils.rb'
|
- 'lib/hbc/utils.rb'
|
||||||
|
|
||||||
|
Metrics/PerceivedComplexity:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AlignHash:
|
||||||
|
EnforcedHashRocketStyle: table
|
||||||
|
EnforcedColonStyle: table
|
||||||
|
|
||||||
|
Style/BarePercentLiterals:
|
||||||
|
EnforcedStyle: percent_q
|
||||||
|
|
||||||
Style/BlockDelimiters:
|
Style/BlockDelimiters:
|
||||||
EnforcedStyle: semantic
|
EnforcedStyle: semantic
|
||||||
FunctionalMethods:
|
FunctionalMethods:
|
||||||
@ -59,6 +67,8 @@ Style/BlockDelimiters:
|
|||||||
- chdir
|
- chdir
|
||||||
- context
|
- context
|
||||||
- create
|
- create
|
||||||
|
- define_method
|
||||||
|
- define_singleton_method
|
||||||
- each_with_object
|
- each_with_object
|
||||||
- fork
|
- fork
|
||||||
- measure
|
- measure
|
||||||
@ -75,15 +85,47 @@ Style/BlockDelimiters:
|
|||||||
- lambda
|
- lambda
|
||||||
- proc
|
- proc
|
||||||
|
|
||||||
|
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
EnforcedStyle: compact
|
EnforcedStyle: compact
|
||||||
|
|
||||||
Style/PredicateName:
|
Style/Documentation:
|
||||||
NameWhitelist: is_32_bit?, is_64_bit?
|
Enabled: false
|
||||||
|
|
||||||
|
Style/FileName:
|
||||||
|
Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/
|
||||||
|
|
||||||
|
Style/HashSyntax:
|
||||||
|
EnforcedStyle: ruby19_no_mixed_keys
|
||||||
|
|
||||||
|
Style/IndentArray:
|
||||||
|
EnforcedStyle: align_brackets
|
||||||
|
|
||||||
|
Style/IndentHash:
|
||||||
|
EnforcedStyle: align_braces
|
||||||
|
|
||||||
|
Style/PercentLiteralDelimiters:
|
||||||
|
PreferredDelimiters:
|
||||||
|
'%': '{}'
|
||||||
|
'%i': '{}'
|
||||||
|
'%q': '{}'
|
||||||
|
'%Q': '{}'
|
||||||
|
'%r': '{}'
|
||||||
|
'%s': '()'
|
||||||
|
'%w': '[]'
|
||||||
|
'%W': '[]'
|
||||||
|
'%x': '()'
|
||||||
|
|
||||||
Style/RaiseArgs:
|
Style/RaiseArgs:
|
||||||
EnforcedStyle: exploded
|
EnforcedStyle: exploded
|
||||||
|
|
||||||
|
Style/RegexpLiteral:
|
||||||
|
EnforcedStyle: percent_r
|
||||||
|
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
|
|
||||||
|
Style/StringLiteralsInInterpolation:
|
||||||
|
EnforcedStyle: double_quotes
|
||||||
|
|
||||||
|
Style/TrailingCommaInLiteral:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
|||||||
@ -7,10 +7,6 @@ group :debug do
|
|||||||
gem "pry-byebug", platforms: :mri
|
gem "pry-byebug", platforms: :mri
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
|
||||||
gem "rubocop-cask", "~> 0.8.3"
|
|
||||||
end
|
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
# This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve
|
# This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve
|
||||||
# all issues with parallel tests, uncovered files, and tracked files. Switch
|
# all issues with parallel tests, uncovered files, and tracked files. Switch
|
||||||
|
|||||||
@ -12,7 +12,6 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ansi (1.5.0)
|
ansi (1.5.0)
|
||||||
ast (2.3.0)
|
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (9.0.5)
|
byebug (9.0.5)
|
||||||
codecov (0.1.5)
|
codecov (0.1.5)
|
||||||
@ -36,9 +35,6 @@ GEM
|
|||||||
parallel (1.9.0)
|
parallel (1.9.0)
|
||||||
parallel_tests (2.9.0)
|
parallel_tests (2.9.0)
|
||||||
parallel
|
parallel
|
||||||
parser (2.3.1.2)
|
|
||||||
ast (~> 2.2)
|
|
||||||
powerpack (0.1.1)
|
|
||||||
pry (0.10.4)
|
pry (0.10.4)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
@ -46,8 +42,6 @@ GEM
|
|||||||
pry-byebug (3.4.0)
|
pry-byebug (3.4.0)
|
||||||
byebug (~> 9.0)
|
byebug (~> 9.0)
|
||||||
pry (~> 0.10)
|
pry (~> 0.10)
|
||||||
public_suffix (2.0.2)
|
|
||||||
rainbow (2.1.0)
|
|
||||||
rake (10.4.2)
|
rake (10.4.2)
|
||||||
rspec (3.0.0)
|
rspec (3.0.0)
|
||||||
rspec-core (~> 3.0.0)
|
rspec-core (~> 3.0.0)
|
||||||
@ -66,19 +60,9 @@ GEM
|
|||||||
rspec-support (3.0.4)
|
rspec-support (3.0.4)
|
||||||
rspec-wait (0.0.9)
|
rspec-wait (0.0.9)
|
||||||
rspec (>= 3, < 4)
|
rspec (>= 3, < 4)
|
||||||
rubocop (0.41.2)
|
|
||||||
parser (>= 2.3.1.1, < 3.0)
|
|
||||||
powerpack (~> 0.1)
|
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
|
||||||
ruby-progressbar (~> 1.7)
|
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
||||||
rubocop-cask (0.8.3)
|
|
||||||
public_suffix (~> 2.0)
|
|
||||||
rubocop (~> 0.41.1)
|
|
||||||
ruby-progressbar (1.8.1)
|
ruby-progressbar (1.8.1)
|
||||||
simplecov-html (0.10.0)
|
simplecov-html (0.10.0)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
unicode-display_width (1.1.0)
|
|
||||||
url (0.3.2)
|
url (0.3.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
@ -96,7 +80,6 @@ DEPENDENCIES
|
|||||||
rspec (~> 3.0.0)
|
rspec (~> 3.0.0)
|
||||||
rspec-its
|
rspec-its
|
||||||
rspec-wait
|
rspec-wait
|
||||||
rubocop-cask (~> 0.8.3)
|
|
||||||
simplecov (= 0.12.0)!
|
simplecov (= 0.12.0)!
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
require "rake/testtask"
|
require "rake/testtask"
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "rubocop/rake_task"
|
|
||||||
|
|
||||||
homebrew_repo = `brew --repository`.chomp
|
homebrew_repo = `brew --repository`.chomp
|
||||||
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
|
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew"))
|
||||||
@ -18,12 +17,6 @@ namespace :test do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
||||||
t.options = ["--force-exclusion"]
|
|
||||||
end
|
|
||||||
|
|
||||||
task default: [:rubocop]
|
|
||||||
|
|
||||||
desc "Open a REPL for debugging and experimentation"
|
desc "Open a REPL for debugging and experimentation"
|
||||||
task :console do
|
task :console do
|
||||||
require "pry"
|
require "pry"
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class Hbc::Artifact::AbstractFlightBlock < Hbc::Artifact::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.class_for_dsl_key(dsl_key)
|
def self.class_for_dsl_key(dsl_key)
|
||||||
Object.const_get("Hbc::DSL::#{dsl_key.to_s.split('_').collect(&:capitalize).join}")
|
Object.const_get("Hbc::DSL::#{dsl_key.to_s.split("_").collect(&:capitalize).join}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.me?(cask)
|
def self.me?(cask)
|
||||||
|
|||||||
@ -64,9 +64,9 @@ class Hbc::Artifact::Moved < Hbc::Artifact::Relocated
|
|||||||
|
|
||||||
def delete
|
def delete
|
||||||
ohai "Removing #{self.class.artifact_english_name}: '#{target}'"
|
ohai "Removing #{self.class.artifact_english_name}: '#{target}'"
|
||||||
if MacOS.undeletable?(target)
|
raise Hbc::CaskError, "Cannot remove undeletable #{self.class.artifact_english_name}" if MacOS.undeletable?(target)
|
||||||
raise Hbc::CaskError, "Cannot remove undeletable #{self.class.artifact_english_name}"
|
|
||||||
elsif force
|
if force
|
||||||
Hbc::Utils.gain_permissions_remove(target, command: @command)
|
Hbc::Utils.gain_permissions_remove(target, command: @command)
|
||||||
else
|
else
|
||||||
target.rmtree
|
target.rmtree
|
||||||
|
|||||||
@ -3,32 +3,32 @@ module Hbc::Cache
|
|||||||
|
|
||||||
def ensure_cache_exists
|
def ensure_cache_exists
|
||||||
return if Hbc.cache.exist?
|
return if Hbc.cache.exist?
|
||||||
|
|
||||||
odebug "Creating Cache at #{Hbc.cache}"
|
odebug "Creating Cache at #{Hbc.cache}"
|
||||||
Hbc.cache.mkpath
|
Hbc.cache.mkpath
|
||||||
end
|
end
|
||||||
|
|
||||||
def migrate_legacy_cache
|
def migrate_legacy_cache
|
||||||
if Hbc.legacy_cache.exist?
|
return unless Hbc.legacy_cache.exist?
|
||||||
ohai "Migrating cached files to #{Hbc.cache}..."
|
|
||||||
|
|
||||||
Hbc.legacy_cache.children.select(&:symlink?).each do |symlink|
|
ohai "Migrating cached files to #{Hbc.cache}..."
|
||||||
file = symlink.readlink
|
Hbc.legacy_cache.children.select(&:symlink?).each do |symlink|
|
||||||
|
file = symlink.readlink
|
||||||
|
|
||||||
new_name = file.basename
|
new_name = file.basename
|
||||||
.sub(%r{\-((?:(\d|#{Hbc::DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$}x,
|
.sub(%r{\-((?:(\d|#{Hbc::DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$}x,
|
||||||
'--\1')
|
'--\1')
|
||||||
|
|
||||||
renamed_file = Hbc.cache.join(new_name)
|
renamed_file = Hbc.cache.join(new_name)
|
||||||
|
|
||||||
if file.exist?
|
if file.exist?
|
||||||
puts "#{file} -> #{renamed_file}"
|
puts "#{file} -> #{renamed_file}"
|
||||||
FileUtils.mv(file, renamed_file)
|
FileUtils.mv(file, renamed_file)
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.rm(symlink)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.remove_entry_secure(Hbc.legacy_cache)
|
FileUtils.rm(symlink)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
FileUtils.remove_entry_secure(Hbc.legacy_cache)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -87,28 +87,29 @@ class Hbc::Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dumpcask
|
def dumpcask
|
||||||
if Hbc.respond_to?(:debug) && Hbc.debug
|
return unless Hbc.respond_to?(:debug)
|
||||||
odebug "Cask instance dumps in YAML:"
|
return unless Hbc.debug
|
||||||
odebug "Cask instance toplevel:", to_yaml
|
|
||||||
[
|
odebug "Cask instance dumps in YAML:"
|
||||||
:name,
|
odebug "Cask instance toplevel:", to_yaml
|
||||||
:homepage,
|
[
|
||||||
:url,
|
:name,
|
||||||
:appcast,
|
:homepage,
|
||||||
:version,
|
:url,
|
||||||
:license,
|
:appcast,
|
||||||
:sha256,
|
:version,
|
||||||
:artifacts,
|
:license,
|
||||||
:caveats,
|
:sha256,
|
||||||
:depends_on,
|
:artifacts,
|
||||||
:conflicts_with,
|
:caveats,
|
||||||
:container,
|
:depends_on,
|
||||||
:gpg,
|
:conflicts_with,
|
||||||
:accessibility_access,
|
:container,
|
||||||
:auto_updates,
|
:gpg,
|
||||||
].each do |method|
|
:accessibility_access,
|
||||||
odebug "Cask instance method '#{method}':", send(method).to_yaml
|
:auto_updates,
|
||||||
end
|
].each do |method|
|
||||||
|
odebug "Cask instance method '#{method}':", send(method).to_yaml
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,39 +3,39 @@ module Hbc::Caskroom
|
|||||||
|
|
||||||
def migrate_caskroom_from_repo_to_prefix
|
def migrate_caskroom_from_repo_to_prefix
|
||||||
repo_caskroom = Hbc.homebrew_repository.join("Caskroom")
|
repo_caskroom = Hbc.homebrew_repository.join("Caskroom")
|
||||||
if !Hbc.caskroom.exist? && repo_caskroom.directory?
|
return if Hbc.caskroom.exist?
|
||||||
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
|
return unless repo_caskroom.directory?
|
||||||
|
|
||||||
if Hbc.caskroom.parent.writable?
|
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
|
||||||
FileUtils.mv repo_caskroom, Hbc.caskroom
|
|
||||||
else
|
if Hbc.caskroom.parent.writable?
|
||||||
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
FileUtils.mv repo_caskroom, Hbc.caskroom
|
||||||
system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s
|
else
|
||||||
end
|
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
||||||
|
system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_caskroom_exists
|
def ensure_caskroom_exists
|
||||||
unless Hbc.caskroom.exist?
|
return if Hbc.caskroom.exist?
|
||||||
ohai "Creating Caskroom at #{Hbc.caskroom}"
|
|
||||||
|
|
||||||
if Hbc.caskroom.parent.writable?
|
ohai "Creating Caskroom at #{Hbc.caskroom}"
|
||||||
Hbc.caskroom.mkpath
|
if Hbc.caskroom.parent.writable?
|
||||||
else
|
Hbc.caskroom.mkpath
|
||||||
ohai "We'll set permissions properly so we won't need sudo in the future"
|
else
|
||||||
toplevel_dir = Hbc.caskroom
|
ohai "We'll set permissions properly so we won't need sudo in the future"
|
||||||
toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root?
|
toplevel_dir = Hbc.caskroom
|
||||||
unless toplevel_dir.directory?
|
toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root?
|
||||||
# If a toplevel dir such as '/opt' must be created, enforce standard permissions.
|
unless toplevel_dir.directory?
|
||||||
# sudo in system is rude.
|
# If a toplevel dir such as '/opt' must be created, enforce standard permissions.
|
||||||
system "/usr/bin/sudo", "--", "/bin/mkdir", "--", toplevel_dir
|
|
||||||
system "/usr/bin/sudo", "--", "/bin/chmod", "--", "0775", toplevel_dir
|
|
||||||
end
|
|
||||||
# sudo in system is rude.
|
# sudo in system is rude.
|
||||||
system "/usr/bin/sudo", "--", "/bin/mkdir", "-p", "--", Hbc.caskroom
|
system "/usr/bin/sudo", "--", "/bin/mkdir", "--", toplevel_dir
|
||||||
unless Hbc.caskroom.parent == toplevel_dir
|
system "/usr/bin/sudo", "--", "/bin/chmod", "--", "0775", toplevel_dir
|
||||||
system "/usr/bin/sudo", "--", "/usr/sbin/chown", "-R", "--", "#{Hbc::Utils.current_user}:staff", Hbc.caskroom.parent.to_s
|
end
|
||||||
end
|
# sudo in system is rude.
|
||||||
|
system "/usr/bin/sudo", "--", "/bin/mkdir", "-p", "--", Hbc.caskroom
|
||||||
|
unless Hbc.caskroom.parent == toplevel_dir
|
||||||
|
system "/usr/bin/sudo", "--", "/usr/sbin/chown", "-R", "--", "#{Hbc::Utils.current_user}:staff", Hbc.caskroom.parent.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -117,11 +117,11 @@ class Hbc::CLI
|
|||||||
rescue NameError
|
rescue NameError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if klass.respond_to?(:run)
|
if klass.respond_to?(:run)
|
||||||
# invoke "run" on a Ruby library which follows our coding conventions
|
# invoke "run" on a Ruby library which follows our coding conventions
|
||||||
klass.run(*rest)
|
|
||||||
else
|
|
||||||
# other Ruby libraries must do everything via "require"
|
# other Ruby libraries must do everything via "require"
|
||||||
|
klass.run(*rest)
|
||||||
end
|
end
|
||||||
elsif Hbc::Utils.which "brewcask-#{command}"
|
elsif Hbc::Utils.which "brewcask-#{command}"
|
||||||
# arbitrary external executable on PATH, Homebrew-style
|
# arbitrary external executable on PATH, Homebrew-style
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class Hbc::CLI::Audit < Hbc::CLI::Base
|
|||||||
def self.run(*args)
|
def self.run(*args)
|
||||||
failed_casks = new(args, Hbc::Auditor).run
|
failed_casks = new(args, Hbc::Auditor).run
|
||||||
return if failed_casks.empty?
|
return if failed_casks.empty?
|
||||||
raise Hbc::CaskError, "audit failed for casks: #{failed_casks.join(' ')}"
|
raise Hbc::CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(args, auditor)
|
def initialize(args, auditor)
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class Hbc::CLI::Cleanup < Hbc::CLI::Base
|
|||||||
|
|
||||||
def remove_cache_files(*tokens)
|
def remove_cache_files(*tokens)
|
||||||
message = "Removing cached downloads"
|
message = "Removing cached downloads"
|
||||||
message.concat " for #{tokens.join(', ')}" unless tokens.empty?
|
message.concat " for #{tokens.join(", ")}" unless tokens.empty?
|
||||||
message.concat " older than #{OUTDATED_DAYS} days old" if outdated_only
|
message.concat " older than #{OUTDATED_DAYS} days old" if outdated_only
|
||||||
ohai message
|
ohai message
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class Hbc::CLI::Doctor < Hbc::CLI::Base
|
|||||||
if homebrew_origin !~ %r{\S}
|
if homebrew_origin !~ %r{\S}
|
||||||
homebrew_origin = "#{none_string} #{error_string}"
|
homebrew_origin = "#{none_string} #{error_string}"
|
||||||
elsif homebrew_origin !~ %r{(mxcl|Homebrew)/(home)?brew(\.git)?\Z}
|
elsif homebrew_origin !~ %r{(mxcl|Homebrew)/(home)?brew(\.git)?\Z}
|
||||||
homebrew_origin.concat " #{error_string 'warning: nonstandard origin'}"
|
homebrew_origin.concat " #{error_string "warning: nonstandard origin"}"
|
||||||
end
|
end
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
homebrew_origin = error_string "Not Found - Error running git"
|
homebrew_origin = error_string "Not Found - Error running git"
|
||||||
@ -106,7 +106,7 @@ class Hbc::CLI::Doctor < Hbc::CLI::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.privileged_uid
|
def self.privileged_uid
|
||||||
Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : "No"
|
Process.euid.zero? ? "Yes #{error_string "warning: not recommended"}" : "No"
|
||||||
rescue StandardError
|
rescue StandardError
|
||||||
notfound_string
|
notfound_string
|
||||||
end
|
end
|
||||||
@ -143,7 +143,7 @@ class Hbc::CLI::Doctor < Hbc::CLI::Base
|
|||||||
if dir.nil? || dir.to_s.empty?
|
if dir.nil? || dir.to_s.empty?
|
||||||
none_string
|
none_string
|
||||||
elsif dir.to_s.match(legacy_tap_pattern)
|
elsif dir.to_s.match(legacy_tap_pattern)
|
||||||
dir.to_s.concat(" #{error_string 'Warning: legacy tap path'}")
|
dir.to_s.concat(" #{error_string "Warning: legacy tap path"}")
|
||||||
else
|
else
|
||||||
dir.to_s
|
dir.to_s
|
||||||
end
|
end
|
||||||
@ -175,9 +175,9 @@ class Hbc::CLI::Doctor < Hbc::CLI::Base
|
|||||||
def self.render_staging_location(path)
|
def self.render_staging_location(path)
|
||||||
path = Pathname.new(path)
|
path = Pathname.new(path)
|
||||||
if !path.exist?
|
if !path.exist?
|
||||||
"#{path} #{error_string 'error: path does not exist'}}"
|
"#{path} #{error_string "error: path does not exist"}}"
|
||||||
elsif !path.writable?
|
elsif !path.writable?
|
||||||
"#{path} #{error_string 'error: not writable by current user'}"
|
"#{path} #{error_string "error: not writable by current user"}"
|
||||||
else
|
else
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class Hbc::CLI::Install < Hbc::CLI::Base
|
|||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
count == 0 ? nil : count == cask_tokens.length
|
count.zero? ? nil : count == cask_tokens.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.warn_unavailable_with_suggestion(cask_token, e)
|
def self.warn_unavailable_with_suggestion(cask_token, e)
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class Hbc::CLI::InternalAuditModifiedCasks < Hbc::CLI::InternalUseBase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def git_root
|
def git_root
|
||||||
@git_root ||= git(*%w[rev-parse --show-toplevel])
|
@git_root ||= git("rev-parse", "--show-toplevel")
|
||||||
end
|
end
|
||||||
|
|
||||||
def modified_cask_files
|
def modified_cask_files
|
||||||
@ -83,8 +83,8 @@ class Hbc::CLI::InternalAuditModifiedCasks < Hbc::CLI::InternalUseBase
|
|||||||
@modified_casks = modified_cask_files.map { |f| Hbc.load(f) }
|
@modified_casks = modified_cask_files.map { |f| Hbc.load(f) }
|
||||||
if @modified_casks.any?
|
if @modified_casks.any?
|
||||||
num_modified = @modified_casks.size
|
num_modified = @modified_casks.size
|
||||||
ohai "#{num_modified} modified #{pluralize('cask', num_modified)}: " \
|
ohai "#{num_modified} modified #{pluralize("cask", num_modified)}: " \
|
||||||
"#{@modified_casks.join(' ')}"
|
"#{@modified_casks.join(" ")}"
|
||||||
end
|
end
|
||||||
@modified_casks
|
@modified_casks
|
||||||
end
|
end
|
||||||
@ -122,7 +122,7 @@ class Hbc::CLI::InternalAuditModifiedCasks < Hbc::CLI::InternalUseBase
|
|||||||
num_failed = failed_casks.size
|
num_failed = failed_casks.size
|
||||||
cask_pluralized = pluralize("cask", num_failed)
|
cask_pluralized = pluralize("cask", num_failed)
|
||||||
odie "audit failed for #{num_failed} #{cask_pluralized}: " \
|
odie "audit failed for #{num_failed} #{cask_pluralized}: " \
|
||||||
"#{failed_casks.join(' ')}"
|
"#{failed_casks.join(" ")}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def pluralize(str, num)
|
def pluralize(str, num)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class Hbc::CLI::InternalDump < Hbc::CLI::InternalUseBase
|
|||||||
opoo "#{cask_token} was not found or would not load: #{e}"
|
opoo "#{cask_token} was not found or would not load: #{e}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
count == 0 ? nil : count == cask_tokens.length
|
count.zero? ? nil : count == cask_tokens.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.help
|
def self.help
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class Hbc::CLI::InternalStanza < Hbc::CLI::InternalUseBase
|
|||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
count == 0 ? nil : count == cask_tokens.length
|
count.zero? ? nil : count == cask_tokens.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.help
|
def self.help
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class Hbc::CLI::List < Hbc::CLI::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
count == 0 ? nil : count == cask_tokens.length
|
count.zero? ? nil : count == cask_tokens.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.list_artifacts(cask)
|
def self.list_artifacts(cask)
|
||||||
|
|||||||
@ -28,8 +28,8 @@ class Hbc::CLI::Uninstall < Hbc::CLI::Base
|
|||||||
single = versions.count == 1
|
single = versions.count == 1
|
||||||
|
|
||||||
puts <<-EOS.undent
|
puts <<-EOS.undent
|
||||||
#{cask_token} #{versions.join(', ')} #{single ? 'is' : 'are'} still installed.
|
#{cask_token} #{versions.join(", ")} #{single ? "is" : "are"} still installed.
|
||||||
Remove #{single ? 'it' : 'them all'} with `brew cask uninstall --force #{cask_token}`.
|
Remove #{single ? "it" : "them all"} with `brew cask uninstall --force #{cask_token}`.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -269,8 +269,16 @@ class Hbc::DSL
|
|||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(method, *)
|
def method_missing(method, *)
|
||||||
Hbc::Utils.method_missing_message(method, token)
|
if method
|
||||||
nil
|
Hbc::Utils.method_missing_message(method, token)
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def respond_to_missing?(*)
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def appdir
|
def appdir
|
||||||
|
|||||||
@ -13,9 +13,17 @@ class Hbc::DSL::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(method, *)
|
def method_missing(method, *)
|
||||||
underscored_class = self.class.name.gsub(%r{([[:lower:]])([[:upper:]][[:lower:]])}, '\1_\2').downcase
|
if method
|
||||||
section = underscored_class.downcase.split("::").last
|
underscored_class = self.class.name.gsub(%r{([[:lower:]])([[:upper:]][[:lower:]])}, '\1_\2').downcase
|
||||||
Hbc::Utils.method_missing_message(method, @cask.to_s, section)
|
section = underscored_class.downcase.split("::").last
|
||||||
nil
|
Hbc::Utils.method_missing_message(method, @cask.to_s, section)
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def respond_to_missing?(*)
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -25,13 +25,21 @@ class Hbc::DSL::StanzaProxy
|
|||||||
coder["resolved"] = @resolver.call
|
coder["resolved"] = @resolver.call
|
||||||
end
|
end
|
||||||
|
|
||||||
def respond_to?(symbol, include_private = false)
|
def method_missing(method, *args)
|
||||||
return true if %i{encode_with proxy? to_s type}.include?(symbol)
|
if method != :to_ary
|
||||||
return false if symbol == :to_ary
|
@resolver.call.send(method, *args)
|
||||||
@resolver.call.respond_to?(symbol, include_private)
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(symbol, *args)
|
def respond_to?(method, include_private = false)
|
||||||
@resolver.call.send(symbol, *args)
|
return true if %i{encode_with proxy? to_s type}.include?(method)
|
||||||
|
return false if method == :to_ary
|
||||||
|
@resolver.call.respond_to?(method, include_private)
|
||||||
|
end
|
||||||
|
|
||||||
|
def respond_to_missing?(*)
|
||||||
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -139,15 +139,15 @@ class Hbc::Installer
|
|||||||
# dependencies should also apply for "brew cask stage"
|
# dependencies should also apply for "brew cask stage"
|
||||||
# override dependencies with --force or perhaps --force-deps
|
# override dependencies with --force or perhaps --force-deps
|
||||||
def satisfy_dependencies
|
def satisfy_dependencies
|
||||||
if @cask.depends_on
|
return unless @cask.depends_on
|
||||||
ohai "Satisfying dependencies"
|
|
||||||
macos_dependencies
|
ohai "Satisfying dependencies"
|
||||||
arch_dependencies
|
macos_dependencies
|
||||||
x11_dependencies
|
arch_dependencies
|
||||||
formula_dependencies
|
x11_dependencies
|
||||||
cask_dependencies unless skip_cask_deps
|
formula_dependencies
|
||||||
puts "complete"
|
cask_dependencies unless skip_cask_deps
|
||||||
end
|
puts "complete"
|
||||||
end
|
end
|
||||||
|
|
||||||
def macos_dependencies
|
def macos_dependencies
|
||||||
@ -159,7 +159,7 @@ class Hbc::Installer
|
|||||||
end
|
end
|
||||||
elsif @cask.depends_on.macos.length > 1
|
elsif @cask.depends_on.macos.length > 1
|
||||||
unless @cask.depends_on.macos.include?(Gem::Version.new(MacOS.version.to_s))
|
unless @cask.depends_on.macos.include?(Gem::Version.new(MacOS.version.to_s))
|
||||||
raise Hbc::CaskError, "Cask #{@cask} depends on macOS release being one of [#{@cask.depends_on.macos.map(&:to_s).join(', ')}], but you are running release #{MacOS.version}."
|
raise Hbc::CaskError, "Cask #{@cask} depends on macOS release being one of [#{@cask.depends_on.macos.map(&:to_s).join(", ")}], but you are running release #{MacOS.version}."
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
unless MacOS.version == @cask.depends_on.macos.first
|
unless MacOS.version == @cask.depends_on.macos.first
|
||||||
@ -175,7 +175,7 @@ class Hbc::Installer
|
|||||||
arch[:type] == @current_arch[:type] &&
|
arch[:type] == @current_arch[:type] &&
|
||||||
Array(arch[:bits]).include?(@current_arch[:bits])
|
Array(arch[:bits]).include?(@current_arch[:bits])
|
||||||
}
|
}
|
||||||
raise Hbc::CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(', ')}], but you are running #{@current_arch}"
|
raise Hbc::CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(", ")}], but you are running #{@current_arch}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def x11_dependencies
|
def x11_dependencies
|
||||||
@ -203,7 +203,7 @@ class Hbc::Installer
|
|||||||
|
|
||||||
def cask_dependencies
|
def cask_dependencies
|
||||||
return unless @cask.depends_on.cask && !@cask.depends_on.cask.empty?
|
return unless @cask.depends_on.cask && !@cask.depends_on.cask.empty?
|
||||||
ohai "Installing Cask dependencies: #{@cask.depends_on.cask.join(', ')}"
|
ohai "Installing Cask dependencies: #{@cask.depends_on.cask.join(", ")}"
|
||||||
deps = Hbc::CaskDependencies.new(@cask)
|
deps = Hbc::CaskDependencies.new(@cask)
|
||||||
deps.sorted.each do |dep_token|
|
deps.sorted.each do |dep_token|
|
||||||
puts "#{dep_token} ..."
|
puts "#{dep_token} ..."
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class Hbc::Source::TappedQualified < Hbc::Source::Tapped
|
|||||||
qualified_token = Hbc::QualifiedToken.parse(query)
|
qualified_token = Hbc::QualifiedToken.parse(query)
|
||||||
return if qualified_token.nil?
|
return if qualified_token.nil?
|
||||||
|
|
||||||
user, repo, token = qualified_token
|
user, repo = qualified_token[0..1]
|
||||||
Tap.fetch(user, repo)
|
Tap.fetch(user, repo)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ class Hbc::SystemCommand::Result
|
|||||||
end
|
end
|
||||||
|
|
||||||
def success?
|
def success?
|
||||||
@exit_status == 0
|
@exit_status.zero?
|
||||||
end
|
end
|
||||||
|
|
||||||
def merged_output
|
def merged_output
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class Hbc::UrlChecker
|
|||||||
def _check_response_status
|
def _check_response_status
|
||||||
ok = OK_RESPONSES[cask.url.scheme]
|
ok = OK_RESPONSES[cask.url.scheme]
|
||||||
return if ok.include?(@response_status)
|
return if ok.include?(@response_status)
|
||||||
add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(' or ')}, got #{@response_status.utf8_inspect}"
|
add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(" or ")}, got #{@response_status.utf8_inspect}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def _get_data_from_request
|
def _get_data_from_request
|
||||||
|
|||||||
@ -32,14 +32,15 @@ end
|
|||||||
# global methods
|
# global methods
|
||||||
|
|
||||||
def odebug(title, *sput)
|
def odebug(title, *sput)
|
||||||
if Hbc.respond_to?(:debug) && Hbc.debug
|
return unless Hbc.respond_to?(:debug)
|
||||||
width = Tty.width * 4 - 6
|
return unless Hbc.debug
|
||||||
if $stdout.tty? && title.to_s.length > width
|
|
||||||
title = title.to_s[0, width - 3] + "..."
|
width = Tty.width * 4 - 6
|
||||||
end
|
if $stdout.tty? && title.to_s.length > width
|
||||||
puts "#{Tty.magenta}==>#{Tty.reset} #{Tty.white}#{title}#{Tty.reset}"
|
title = title.to_s[0, width - 3] + "..."
|
||||||
puts sput unless sput.empty?
|
|
||||||
end
|
end
|
||||||
|
puts "#{Tty.magenta}==>#{Tty.reset} #{Tty.white}#{title}#{Tty.reset}"
|
||||||
|
puts sput unless sput.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
module Hbc::Utils
|
module Hbc::Utils
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe Hbc::CLI::Cleanup do
|
|||||||
|
|
||||||
describe "cleanup" do
|
describe "cleanup" do
|
||||||
it "removes cached downloads of given casks" do
|
it "removes cached downloads of given casks" do
|
||||||
cleaned_up_cached_download = 'caffeine'
|
cleaned_up_cached_download = "caffeine"
|
||||||
|
|
||||||
cached_downloads = [
|
cached_downloads = [
|
||||||
cache_location.join("#{cleaned_up_cached_download}--latest.zip"),
|
cache_location.join("#{cleaned_up_cached_download}--latest.zip"),
|
||||||
|
|||||||
@ -9,7 +9,7 @@ end
|
|||||||
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
||||||
|
|
||||||
# add Homebrew to load path
|
# add Homebrew to load path
|
||||||
$LOAD_PATH.unshift(File.expand_path("#{ENV['HOMEBREW_REPOSITORY']}/Library/Homebrew"))
|
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
|
||||||
|
|
||||||
require "global"
|
require "global"
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,6 @@ describe Hbc::Artifact::App do
|
|||||||
File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true
|
File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
describe "avoids clobbering an existing app" do
|
describe "avoids clobbering an existing app" do
|
||||||
let(:cask) { local_two_apps_caffeine }
|
let(:cask) { local_two_apps_caffeine }
|
||||||
|
|
||||||
@ -70,8 +69,8 @@ describe Hbc::Artifact::App do
|
|||||||
TestHelper.must_output(self, lambda {
|
TestHelper.must_output(self, lambda {
|
||||||
Hbc::Artifact::App.new(cask).install_phase
|
Hbc::Artifact::App.new(cask).install_phase
|
||||||
}, <<-EOS.undent.chomp)
|
}, <<-EOS.undent.chomp)
|
||||||
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Mini.app')}'; not moving.
|
==> It seems there is already an App at '#{Hbc.appdir.join("Caffeine Mini.app")}'; not moving.
|
||||||
==> Moving App 'Caffeine Pro.app' to '#{Hbc.appdir.join('Caffeine Pro.app')}'
|
==> Moving App 'Caffeine Pro.app' to '#{Hbc.appdir.join("Caffeine Pro.app")}'
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
source_path = cask.staged_path.join("Caffeine Mini.app")
|
source_path = cask.staged_path.join("Caffeine Mini.app")
|
||||||
@ -85,8 +84,8 @@ describe Hbc::Artifact::App do
|
|||||||
TestHelper.must_output(self, lambda {
|
TestHelper.must_output(self, lambda {
|
||||||
Hbc::Artifact::App.new(cask).install_phase
|
Hbc::Artifact::App.new(cask).install_phase
|
||||||
}, <<-EOS.undent.chomp)
|
}, <<-EOS.undent.chomp)
|
||||||
==> Moving App 'Caffeine Mini.app' to '#{Hbc.appdir.join('Caffeine Mini.app')}'
|
==> Moving App 'Caffeine Mini.app' to '#{Hbc.appdir.join("Caffeine Mini.app")}'
|
||||||
==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Pro.app')}'; not moving.
|
==> It seems there is already an App at '#{Hbc.appdir.join("Caffeine Pro.app")}'; not moving.
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
source_path = cask.staged_path.join("Caffeine Pro.app")
|
source_path = cask.staged_path.join("Caffeine Pro.app")
|
||||||
|
|||||||
@ -79,9 +79,9 @@ describe Hbc::CLI::List do
|
|||||||
Hbc::CLI::List.run("local-transmission", "local-caffeine")
|
Hbc::CLI::List.run("local-transmission", "local-caffeine")
|
||||||
}.must_output <<-EOS.undent
|
}.must_output <<-EOS.undent
|
||||||
==> Apps
|
==> Apps
|
||||||
#{Hbc.appdir.join('Transmission.app')} (#{Hbc.appdir.join('Transmission.app').abv})
|
#{Hbc.appdir.join("Transmission.app")} (#{Hbc.appdir.join("Transmission.app").abv})
|
||||||
==> Apps
|
==> Apps
|
||||||
Missing App: #{Hbc.appdir.join('Caffeine.app')}
|
Missing App: #{Hbc.appdir.join("Caffeine.app")}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,7 +10,7 @@ project_root = Pathname.new(File.expand_path("../..", __FILE__))
|
|||||||
tap_root = Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "homebrew-cask")
|
tap_root = Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "homebrew-cask")
|
||||||
|
|
||||||
# add Homebrew to load path
|
# add Homebrew to load path
|
||||||
$LOAD_PATH.unshift(File.expand_path("#{ENV['HOMEBREW_REPOSITORY']}/Library/Homebrew"))
|
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
|
||||||
|
|
||||||
require "global"
|
require "global"
|
||||||
|
|
||||||
|
|||||||
@ -69,27 +69,34 @@ class Caveats
|
|||||||
end
|
end
|
||||||
|
|
||||||
def bash_completion_caveats
|
def bash_completion_caveats
|
||||||
if keg && keg.completion_installed?(:bash) then <<-EOS.undent
|
return unless keg
|
||||||
|
return unless keg.completion_installed?(:bash)
|
||||||
|
|
||||||
|
<<-EOS.undent
|
||||||
Bash completion has been installed to:
|
Bash completion has been installed to:
|
||||||
#{HOMEBREW_PREFIX}/etc/bash_completion.d
|
#{HOMEBREW_PREFIX}/etc/bash_completion.d
|
||||||
EOS
|
EOS
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def zsh_completion_caveats
|
def zsh_completion_caveats
|
||||||
if keg && keg.completion_installed?(:zsh) then <<-EOS.undent
|
return unless keg
|
||||||
|
return unless keg.completion_installed?(:zsh)
|
||||||
|
|
||||||
|
<<-EOS.undent
|
||||||
zsh completion has been installed to:
|
zsh completion has been installed to:
|
||||||
#{HOMEBREW_PREFIX}/share/zsh/site-functions
|
#{HOMEBREW_PREFIX}/share/zsh/site-functions
|
||||||
EOS
|
EOS
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def fish_completion_caveats
|
def fish_completion_caveats
|
||||||
if keg && keg.completion_installed?(:fish) && which("fish") then <<-EOS.undent
|
return unless keg
|
||||||
|
return unless keg.completion_installed?(:fish)
|
||||||
|
return unless which("fish")
|
||||||
|
|
||||||
|
<<-EOS.undent
|
||||||
fish completion has been installed to:
|
fish completion has been installed to:
|
||||||
#{HOMEBREW_PREFIX}/share/fish/vendor_completions.d
|
#{HOMEBREW_PREFIX}/share/fish/vendor_completions.d
|
||||||
EOS
|
EOS
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def python_caveats
|
def python_caveats
|
||||||
@ -140,22 +147,24 @@ class Caveats
|
|||||||
end
|
end
|
||||||
|
|
||||||
def app_caveats
|
def app_caveats
|
||||||
if keg && keg.app_installed?
|
return unless keg
|
||||||
<<-EOS.undent
|
return unless keg.app_installed?
|
||||||
.app bundles were installed.
|
|
||||||
Run `brew linkapps #{keg.name}` to symlink these to /Applications.
|
<<-EOS.undent
|
||||||
EOS
|
.app bundles were installed.
|
||||||
end
|
Run `brew linkapps #{keg.name}` to symlink these to /Applications.
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def elisp_caveats
|
def elisp_caveats
|
||||||
return if f.keg_only?
|
return if f.keg_only?
|
||||||
if keg && keg.elisp_installed?
|
return unless keg
|
||||||
<<-EOS.undent
|
return unless keg.elisp_installed?
|
||||||
Emacs Lisp files have been installed to:
|
|
||||||
#{HOMEBREW_PREFIX}/share/emacs/site-lisp/#{f.name}
|
<<-EOS.undent
|
||||||
EOS
|
Emacs Lisp files have been installed to:
|
||||||
end
|
#{HOMEBREW_PREFIX}/share/emacs/site-lisp/#{f.name}
|
||||||
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def plist_caveats
|
def plist_caveats
|
||||||
|
|||||||
@ -87,9 +87,9 @@ class Cleaner
|
|||||||
|
|
||||||
Find.prune if @f.skip_clean? path
|
Find.prune if @f.skip_clean? path
|
||||||
|
|
||||||
if path.symlink? || path.directory?
|
next if path.symlink? || path.directory?
|
||||||
next
|
|
||||||
elsif path.extname == ".la"
|
if path.extname == ".la"
|
||||||
path.unlink
|
path.unlink
|
||||||
elsif path.basename.to_s == "perllocal.pod"
|
elsif path.basename.to_s == "perllocal.pod"
|
||||||
# Both this file & the .packlist one below are completely unnecessary
|
# Both this file & the .packlist one below are completely unnecessary
|
||||||
|
|||||||
@ -12,7 +12,7 @@ module Homebrew
|
|||||||
cleanup_logs
|
cleanup_logs
|
||||||
unless ARGV.dry_run?
|
unless ARGV.dry_run?
|
||||||
cleanup_lockfiles
|
cleanup_lockfiles
|
||||||
rm_DS_Store
|
rm_ds_store
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ module Homebrew
|
|||||||
next unless path.file?
|
next unless path.file?
|
||||||
file = path
|
file = path
|
||||||
|
|
||||||
if Pathname::BOTTLE_EXTNAME_RX === file.to_s
|
if file.to_s =~ Pathname::BOTTLE_EXTNAME_RX
|
||||||
version = begin
|
version = begin
|
||||||
Utils::Bottles.resolve_version(file)
|
Utils::Bottles.resolve_version(file)
|
||||||
rescue
|
rescue
|
||||||
@ -86,7 +86,7 @@ module Homebrew
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
file_is_stale = if PkgVersion === version
|
file_is_stale = if version.is_a?(PkgVersion)
|
||||||
f.pkg_version > version
|
f.pkg_version > version
|
||||||
else
|
else
|
||||||
f.version > version
|
f.version > version
|
||||||
@ -119,7 +119,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rm_DS_Store
|
def self.rm_ds_store
|
||||||
paths = Queue.new
|
paths = Queue.new
|
||||||
%w[Cellar Frameworks Library bin etc include lib opt sbin share var]
|
%w[Cellar Frameworks Library bin etc include lib opt sbin share var]
|
||||||
.map { |p| HOMEBREW_PREFIX/p }.each { |p| paths << p if p.exist? }
|
.map { |p| HOMEBREW_PREFIX/p }.each { |p| paths << p if p.exist? }
|
||||||
|
|||||||
@ -22,13 +22,13 @@ module Homebrew
|
|||||||
ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
|
ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
|
||||||
end
|
end
|
||||||
|
|
||||||
if Cleanup.disk_cleanup_size > 0
|
return if Cleanup.disk_cleanup_size.zero?
|
||||||
disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
|
|
||||||
if ARGV.dry_run?
|
disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
|
||||||
ohai "This operation would free approximately #{disk_space} of disk space."
|
if ARGV.dry_run?
|
||||||
else
|
ohai "This operation would free approximately #{disk_space} of disk space."
|
||||||
ohai "This operation has freed approximately #{disk_space} of disk space."
|
else
|
||||||
end
|
ohai "This operation has freed approximately #{disk_space} of disk space."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,11 +31,9 @@ module Homebrew
|
|||||||
def detect_version(path)
|
def detect_version(path)
|
||||||
version = path.version.to_s
|
version = path.version.to_s
|
||||||
|
|
||||||
if version.empty?
|
raise "Couldn't determine version, set it with --version=<version>" if version.empty?
|
||||||
raise "Couldn't determine version, set it with --version=<version>"
|
|
||||||
else
|
version
|
||||||
version
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def detect_name(path, version)
|
def detect_name(path, version)
|
||||||
|
|||||||
@ -54,11 +54,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
# No formula with this name, try a blacklist lookup
|
# No formula with this name, try a blacklist lookup
|
||||||
if (blacklist = blacklisted?(f))
|
raise unless (blacklist = blacklisted?(f))
|
||||||
puts blacklist
|
puts blacklist
|
||||||
else
|
|
||||||
raise
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -245,11 +245,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_macports
|
def check_macports
|
||||||
unless MacOS.macports_or_fink.empty?
|
return if MacOS.macports_or_fink.empty?
|
||||||
opoo "It appears you have MacPorts or Fink installed."
|
|
||||||
puts "Software installed with other package managers causes known problems for"
|
opoo "It appears you have MacPorts or Fink installed."
|
||||||
puts "Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again."
|
puts "Software installed with other package managers causes known problems for"
|
||||||
end
|
puts "Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again."
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_cellar
|
def check_cellar
|
||||||
|
|||||||
@ -58,10 +58,11 @@ module Homebrew
|
|||||||
|
|
||||||
def restore_backup(keg, formula)
|
def restore_backup(keg, formula)
|
||||||
path = backup_path(keg)
|
path = backup_path(keg)
|
||||||
if path.directory?
|
|
||||||
path.rename keg
|
return unless path.directory?
|
||||||
keg.link unless formula.keg_only?
|
|
||||||
end
|
path.rename keg
|
||||||
|
keg.link unless formula.keg_only?
|
||||||
end
|
end
|
||||||
|
|
||||||
def backup_path(path)
|
def backup_path(path)
|
||||||
|
|||||||
@ -150,7 +150,7 @@ module Homebrew
|
|||||||
|
|
||||||
names = remote_tap_formulae["#{user}/#{repo}"]
|
names = remote_tap_formulae["#{user}/#{repo}"]
|
||||||
user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization
|
user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization
|
||||||
names.select { |name| rx === name }.map { |name| "#{user}/#{repo}/#{name}" }
|
names.select { |name| name =~ rx }.map { |name| "#{user}/#{repo}/#{name}" }
|
||||||
rescue GitHub::HTTPNotFoundError
|
rescue GitHub::HTTPNotFoundError
|
||||||
opoo "Failed to search tap: #{user}/#{repo}. Please run `brew update`"
|
opoo "Failed to search tap: #{user}/#{repo}. Please run `brew update`"
|
||||||
[]
|
[]
|
||||||
@ -171,10 +171,11 @@ module Homebrew
|
|||||||
rescue
|
rescue
|
||||||
canonical_name = canonical_full_name = name
|
canonical_name = canonical_full_name = name
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ignore aliases from results when the full name was also found
|
# Ignore aliases from results when the full name was also found
|
||||||
if aliases.include?(name) && results.include?(canonical_full_name)
|
next if aliases.include?(name) && results.include?(canonical_full_name)
|
||||||
next
|
|
||||||
elsif (HOMEBREW_CELLAR/canonical_name).directory?
|
if (HOMEBREW_CELLAR/canonical_name).directory?
|
||||||
pretty_installed(name)
|
pretty_installed(name)
|
||||||
else
|
else
|
||||||
name
|
name
|
||||||
|
|||||||
@ -45,7 +45,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_style_impl(files, output_type, options = {})
|
def check_style_impl(files, output_type, options = {})
|
||||||
fix = options[:fix]
|
fix = options[:fix]
|
||||||
Homebrew.install_gem_setup_path! "rubocop", "0.41.2"
|
Homebrew.install_gem_setup_path! "rubocop", "0.43.0"
|
||||||
|
|
||||||
args = %W[
|
args = %W[
|
||||||
--force-exclusion
|
--force-exclusion
|
||||||
@ -54,20 +54,22 @@ module Homebrew
|
|||||||
args << "--auto-correct" if fix
|
args << "--auto-correct" if fix
|
||||||
args += files
|
args += files
|
||||||
|
|
||||||
case output_type
|
HOMEBREW_LIBRARY.cd do
|
||||||
when :print
|
case output_type
|
||||||
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
when :print
|
||||||
system "rubocop", "--format", "simple", *args
|
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
|
||||||
!$?.success?
|
system "rubocop", "--format", "simple", *args
|
||||||
when :json
|
!$?.success?
|
||||||
json = Utils.popen_read_text("rubocop", "--format", "json", *args)
|
when :json
|
||||||
# exit status of 1 just means violations were found; other numbers mean execution errors
|
json = Utils.popen_read_text("rubocop", "--format", "json", *args)
|
||||||
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
# exit status of 1 just means violations were found; other numbers mean execution errors
|
||||||
# native extension problems
|
# exitstatus can also be nil if RuboCop process crashes, e.g. due to
|
||||||
raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1
|
# native extension problems
|
||||||
RubocopResults.new(Utils::JSON.load(json))
|
raise "Error while running RuboCop" if $?.exitstatus.nil? || $?.exitstatus > 1
|
||||||
else
|
RubocopResults.new(Utils::JSON.load(json))
|
||||||
raise "Invalid output_type for check_style_impl: #{output_type}"
|
else
|
||||||
|
raise "Invalid output_type for check_style_impl: #{output_type}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class CxxStdlib
|
|||||||
if type && ![:libstdcxx, :libcxx].include?(type)
|
if type && ![:libstdcxx, :libcxx].include?(type)
|
||||||
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
raise ArgumentError, "Invalid C++ stdlib type: #{type}"
|
||||||
end
|
end
|
||||||
klass = GNU_GCC_REGEXP === compiler.to_s ? GnuStdlib : AppleStdlib
|
klass = compiler.to_s =~ GNU_GCC_REGEXP ? GnuStdlib : AppleStdlib
|
||||||
klass.new(type, compiler)
|
klass.new(type, compiler)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -118,20 +118,22 @@ module Debrew
|
|||||||
menu.prompt = "Choose an action: "
|
menu.prompt = "Choose an action: "
|
||||||
|
|
||||||
menu.choice(:raise) { original_raise(e) }
|
menu.choice(:raise) { original_raise(e) }
|
||||||
menu.choice(:ignore) { return :ignore } if Ignorable === e
|
menu.choice(:ignore) { return :ignore } if e.is_a?(Ignorable)
|
||||||
menu.choice(:backtrace) { puts e.backtrace }
|
menu.choice(:backtrace) { puts e.backtrace }
|
||||||
|
|
||||||
menu.choice(:irb) do
|
if e.is_a?(Ignorable)
|
||||||
puts "When you exit this IRB session, execution will continue."
|
menu.choice(:irb) do
|
||||||
set_trace_func proc { |event, _, _, id, binding, klass|
|
puts "When you exit this IRB session, execution will continue."
|
||||||
if klass == Raise && id == :raise && event == "return"
|
set_trace_func proc { |event, _, _, id, binding, klass|
|
||||||
set_trace_func(nil)
|
if klass == Raise && id == :raise && event == "return"
|
||||||
synchronize { IRB.start_within(binding) }
|
set_trace_func(nil)
|
||||||
end
|
synchronize { IRB.start_within(binding) }
|
||||||
}
|
end
|
||||||
|
}
|
||||||
|
|
||||||
return :ignore
|
return :ignore
|
||||||
end if Ignorable === e
|
end
|
||||||
|
end
|
||||||
|
|
||||||
menu.choice(:shell) do
|
menu.choice(:shell) do
|
||||||
puts "When you exit this shell, you will return to the menu."
|
puts "When you exit this shell, you will return to the menu."
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class Requirements
|
|||||||
end
|
end
|
||||||
|
|
||||||
def <<(other)
|
def <<(other)
|
||||||
if Comparable === other
|
if other.is_a?(Comparable)
|
||||||
@reqs.grep(other.class) do |req|
|
@reqs.grep(other.class) do |req|
|
||||||
return self if req > other
|
return self if req > other
|
||||||
@reqs.delete(req)
|
@reqs.delete(req)
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class DependencyCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cache_key(spec)
|
def cache_key(spec)
|
||||||
if Resource === spec && spec.download_strategy == CurlDownloadStrategy
|
if spec.is_a?(Resource) && spec.download_strategy == CurlDownloadStrategy
|
||||||
File.extname(spec.url)
|
File.extname(spec.url)
|
||||||
else
|
else
|
||||||
spec
|
spec
|
||||||
@ -57,7 +57,7 @@ class DependencyCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build(spec)
|
def build(spec)
|
||||||
spec, tags = Hash === spec ? spec.first : spec
|
spec, tags = spec.is_a?(Hash) ? spec.first : spec
|
||||||
parse_spec(spec, Array(tags))
|
parse_spec(spec, Array(tags))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class DependencyCollector
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse_string_spec(spec, tags)
|
def parse_string_spec(spec, tags)
|
||||||
if HOMEBREW_TAP_FORMULA_REGEX === spec
|
if spec =~ HOMEBREW_TAP_FORMULA_REGEX
|
||||||
TapDependency.new(spec, tags)
|
TapDependency.new(spec, tags)
|
||||||
elsif tags.empty?
|
elsif tags.empty?
|
||||||
Dependency.new(spec, tags)
|
Dependency.new(spec, tags)
|
||||||
@ -165,11 +165,11 @@ class DependencyCollector
|
|||||||
|
|
||||||
def parse_url_spec(url, tags)
|
def parse_url_spec(url, tags)
|
||||||
case File.extname(url)
|
case File.extname(url)
|
||||||
when ".xz" then Dependency.new("xz", tags)
|
when ".xz" then Dependency.new("xz", tags)
|
||||||
when ".lha", ".lzh" then Dependency.new("lha", tags)
|
when ".lha", ".lzh" then Dependency.new("lha", tags)
|
||||||
when ".lz" then Dependency.new("lzip", tags)
|
when ".lz" then Dependency.new("lzip", tags)
|
||||||
when ".rar" then Dependency.new("unrar", tags)
|
when ".rar" then Dependency.new("unrar", tags)
|
||||||
when ".7z" then Dependency.new("p7zip", tags)
|
when ".7z" then Dependency.new("p7zip", tags)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,9 +12,7 @@ class Descriptions
|
|||||||
# If the cache file exists, load it into, and return, a hash; otherwise,
|
# If the cache file exists, load it into, and return, a hash; otherwise,
|
||||||
# return nil.
|
# return nil.
|
||||||
def self.load_cache
|
def self.load_cache
|
||||||
if CACHE_FILE.exist?
|
@cache = Utils::JSON.load(CACHE_FILE.read) if CACHE_FILE.exist?
|
||||||
@cache = Utils::JSON.load(CACHE_FILE.read)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write the cache to disk after ensuring the existence of the containing
|
# Write the cache to disk after ensuring the existence of the containing
|
||||||
@ -138,6 +136,6 @@ class Descriptions
|
|||||||
|
|
||||||
def short_name_counts
|
def short_name_counts
|
||||||
@short_name_counts ||=
|
@short_name_counts ||=
|
||||||
short_names.values.each_with_object(Hash.new(0)) { |name, counts| counts[name] += 1; counts }
|
short_names.values.each_with_object(Hash.new(0)) { |name, counts| counts[name] += 1 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -83,11 +83,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless problem_count.zero?
|
return if problem_count.zero?
|
||||||
problems = "problem" + plural(problem_count)
|
|
||||||
formulae = "formula" + plural(formula_count, "e")
|
problems = "problem" + plural(problem_count)
|
||||||
ofail "#{problem_count} #{problems} in #{formula_count} #{formulae}"
|
formulae = "formula" + plural(formula_count, "e")
|
||||||
end
|
ofail "#{problem_count} #{problems} in #{formula_count} #{formulae}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -279,9 +279,11 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if present.include?("head") && present.include?("head block")
|
if present.include?("head") && present.include?("head block")
|
||||||
problem "Should not have both `head` and `head do`"
|
problem "Should not have both `head` and `head do`"
|
||||||
end
|
end
|
||||||
|
|
||||||
if present.include?("bottle modifier") && present.include?("bottle block")
|
if present.include?("bottle modifier") && present.include?("bottle block")
|
||||||
problem "Should not have `bottle :unneeded/:disable` and `bottle do`"
|
problem "Should not have `bottle :unneeded/:disable` and `bottle do`"
|
||||||
end
|
end
|
||||||
@ -467,7 +469,7 @@ class FormulaAuditor
|
|||||||
|
|
||||||
# Make sure the formula name plus description is no longer than 80 characters
|
# Make sure the formula name plus description is no longer than 80 characters
|
||||||
# Note full_name includes the name of the tap, while name does not
|
# Note full_name includes the name of the tap, while name does not
|
||||||
linelength = formula.name.length + ": ".length + desc.length
|
linelength = "#{formula.name}: #{desc}".length
|
||||||
if linelength > 80
|
if linelength > 80
|
||||||
problem <<-EOS.undent
|
problem <<-EOS.undent
|
||||||
Description is too long. \"name: desc\" should be less than 80 characters.
|
Description is too long. \"name: desc\" should be less than 80 characters.
|
||||||
@ -668,24 +670,26 @@ class FormulaAuditor
|
|||||||
end
|
end
|
||||||
|
|
||||||
revision_map = attributes_map[:revision]
|
revision_map = attributes_map[:revision]
|
||||||
if formula.revision.nonzero?
|
|
||||||
if formula.stable
|
return if formula.revision.zero?
|
||||||
if revision_map[formula.stable.version].empty? # check stable spec
|
|
||||||
problem "'revision #{formula.revision}' should be removed"
|
if formula.stable
|
||||||
end
|
if revision_map[formula.stable.version].empty? # check stable spec
|
||||||
else # head/devel-only formula
|
|
||||||
problem "'revision #{formula.revision}' should be removed"
|
problem "'revision #{formula.revision}' should be removed"
|
||||||
end
|
end
|
||||||
|
else # head/devel-only formula
|
||||||
|
problem "'revision #{formula.revision}' should be removed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_legacy_patches
|
def audit_legacy_patches
|
||||||
return unless formula.respond_to?(:patches)
|
return unless formula.respond_to?(:patches)
|
||||||
legacy_patches = Patch.normalize_legacy_patches(formula.patches).grep(LegacyPatch)
|
legacy_patches = Patch.normalize_legacy_patches(formula.patches).grep(LegacyPatch)
|
||||||
unless legacy_patches.empty?
|
|
||||||
problem "Use the patch DSL instead of defining a 'patches' method"
|
return if legacy_patches.empty?
|
||||||
legacy_patches.each { |p| audit_patch(p) }
|
|
||||||
end
|
problem "Use the patch DSL instead of defining a 'patches' method"
|
||||||
|
legacy_patches.each { |p| audit_patch(p) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_patch(patch)
|
def audit_patch(patch)
|
||||||
@ -961,61 +965,56 @@ class FormulaAuditor
|
|||||||
problem "Use Language::Node for npm install args"
|
problem "Use Language::Node for npm install args"
|
||||||
end
|
end
|
||||||
|
|
||||||
if @strict
|
return unless @strict
|
||||||
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
|
|
||||||
bad_system = $1
|
|
||||||
unless %w[| < > & ; *].any? { |c| bad_system.include? c }
|
|
||||||
good_system = bad_system.gsub(" ", "\", \"")
|
|
||||||
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if line =~ /(require ["']formula["'])/
|
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
|
||||||
problem "`#{$1}` is now unnecessary"
|
bad_system = $1
|
||||||
|
unless %w[| < > & ; *].any? { |c| bad_system.include? c }
|
||||||
|
good_system = bad_system.gsub(" ", "\", \"")
|
||||||
|
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if line =~ %r{#\{share\}/#{Regexp.escape(formula.name)}[/'"]}
|
if line =~ /(require ["']formula["'])/
|
||||||
problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}"
|
problem "`#{$1}` is now unnecessary"
|
||||||
end
|
end
|
||||||
|
|
||||||
if line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)}
|
if line =~ %r{#\{share\}/#{Regexp.escape(formula.name)}[/'"]}
|
||||||
problem "Use pkgshare instead of (share#{$1}\"#{formula.name}\")"
|
problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)}
|
||||||
|
problem "Use pkgshare instead of (share#{$1}\"#{formula.name}\")"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_caveats
|
def audit_caveats
|
||||||
caveats = formula.caveats.to_s
|
return unless formula.caveats.to_s.include?("setuid")
|
||||||
|
problem "Don't recommend setuid in the caveats, suggest sudo instead."
|
||||||
if caveats.include?("setuid")
|
|
||||||
problem "Don't recommend setuid in the caveats, suggest sudo instead."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_reverse_migration
|
def audit_reverse_migration
|
||||||
# Only enforce for new formula being re-added to core and official taps
|
# Only enforce for new formula being re-added to core and official taps
|
||||||
return unless @strict
|
return unless @strict
|
||||||
return unless formula.tap && formula.tap.official?
|
return unless formula.tap && formula.tap.official?
|
||||||
|
return unless formula.tap.tap_migrations.key?(formula.name)
|
||||||
|
|
||||||
if formula.tap.tap_migrations.key?(formula.name)
|
problem <<-EOS.undent
|
||||||
problem <<-EOS.undent
|
#{formula.name} seems to be listed in tap_migrations.json!
|
||||||
#{formula.name} seems to be listed in tap_migrations.json!
|
Please remove #{formula.name} from present tap & tap_migrations.json
|
||||||
Please remove #{formula.name} from present tap & tap_migrations.json
|
before submitting it to Homebrew/homebrew-#{formula.tap.repo}.
|
||||||
before submitting it to Homebrew/homebrew-#{formula.tap.repo}.
|
EOS
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_prefix_has_contents
|
def audit_prefix_has_contents
|
||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
|
return unless Keg.new(formula.prefix).empty_installation?
|
||||||
|
|
||||||
if Keg.new(formula.prefix).empty_installation?
|
problem <<-EOS.undent
|
||||||
problem <<-EOS.undent
|
The installation seems to be empty. Please ensure the prefix
|
||||||
The installation seems to be empty. Please ensure the prefix
|
is set correctly and expected files are installed.
|
||||||
is set correctly and expected files are installed.
|
The prefix configure/make argument may be case-sensitive.
|
||||||
The prefix configure/make argument may be case-sensitive.
|
EOS
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def audit_conditional_dep(dep, condition, line)
|
def audit_conditional_dep(dep, condition, line)
|
||||||
@ -1184,9 +1183,7 @@ class ResourceAuditor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
using_strategy = DownloadStrategyDetector.detect("", using)
|
if url_strategy == DownloadStrategyDetector.detect("", using)
|
||||||
|
|
||||||
if url_strategy == using_strategy
|
|
||||||
problem "Redundant :using value in URL"
|
problem "Redundant :using value in URL"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -51,10 +51,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
@put_filenames ||= []
|
@put_filenames ||= []
|
||||||
unless @put_filenames.include? filename
|
|
||||||
puts "#{Tty.red}#{filename}#{Tty.reset}"
|
return if @put_filenames.include? filename
|
||||||
@put_filenames << filename
|
|
||||||
end
|
puts "#{Tty.red}#{filename}#{Tty.reset}"
|
||||||
|
@put_filenames << filename
|
||||||
end
|
end
|
||||||
|
|
||||||
result = false
|
result = false
|
||||||
@ -107,9 +108,7 @@ module Homebrew
|
|||||||
absolute_symlinks_start_with_string = []
|
absolute_symlinks_start_with_string = []
|
||||||
keg.find do |pn|
|
keg.find do |pn|
|
||||||
next unless pn.symlink? && (link = pn.readlink).absolute?
|
next unless pn.symlink? && (link = pn.readlink).absolute?
|
||||||
if link.to_s.start_with?(string)
|
absolute_symlinks_start_with_string << pn if link.to_s.start_with?(string)
|
||||||
absolute_symlinks_start_with_string << pn
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.verbose?
|
if ARGV.verbose?
|
||||||
@ -137,11 +136,11 @@ module Homebrew
|
|||||||
tap = f.tap
|
tap = f.tap
|
||||||
|
|
||||||
unless tap
|
unless tap
|
||||||
if ARGV.include?("--force-core-tap")
|
unless ARGV.include?("--force-core-tap")
|
||||||
tap = CoreTap.instance
|
|
||||||
else
|
|
||||||
return ofail "Formula not from core or any taps: #{f.full_name}"
|
return ofail "Formula not from core or any taps: #{f.full_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tap = CoreTap.instance
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.bottle_disabled?
|
if f.bottle_disabled?
|
||||||
@ -154,9 +153,7 @@ module Homebrew
|
|||||||
return ofail "Formula not installed with '--build-bottle': #{f.full_name}"
|
return ofail "Formula not installed with '--build-bottle': #{f.full_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
unless f.stable
|
return ofail "Formula has no stable version: #{f.full_name}" unless f.stable
|
||||||
return ofail "Formula has no stable version: #{f.full_name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
if ARGV.include?("--no-rebuild") || !f.tap
|
if ARGV.include?("--no-rebuild") || !f.tap
|
||||||
rebuild = 0
|
rebuild = 0
|
||||||
@ -323,34 +320,33 @@ module Homebrew
|
|||||||
puts "./#{filename}"
|
puts "./#{filename}"
|
||||||
puts output
|
puts output
|
||||||
|
|
||||||
if ARGV.include? "--json"
|
return unless ARGV.include? "--json"
|
||||||
json = {
|
json = {
|
||||||
f.full_name => {
|
f.full_name => {
|
||||||
"formula" => {
|
"formula" => {
|
||||||
"pkg_version" => f.pkg_version.to_s,
|
"pkg_version" => f.pkg_version.to_s,
|
||||||
"path" => f.path.to_s.strip_prefix("#{HOMEBREW_REPOSITORY}/"),
|
"path" => f.path.to_s.strip_prefix("#{HOMEBREW_REPOSITORY}/"),
|
||||||
},
|
},
|
||||||
"bottle" => {
|
"bottle" => {
|
||||||
"root_url" => bottle.root_url,
|
"root_url" => bottle.root_url,
|
||||||
"prefix" => bottle.prefix,
|
"prefix" => bottle.prefix,
|
||||||
"cellar" => bottle.cellar.to_s,
|
"cellar" => bottle.cellar.to_s,
|
||||||
"rebuild" => bottle.rebuild,
|
"rebuild" => bottle.rebuild,
|
||||||
"tags" => {
|
"tags" => {
|
||||||
Utils::Bottles.tag.to_s => {
|
Utils::Bottles.tag.to_s => {
|
||||||
"filename" => filename.to_s,
|
"filename" => filename.to_s,
|
||||||
"sha256" => sha256,
|
"sha256" => sha256,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"bintray" => {
|
|
||||||
"package" => Utils::Bottles::Bintray.package(f.name),
|
|
||||||
"repository" => Utils::Bottles::Bintray.repository(tap),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
"bintray" => {
|
||||||
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
"package" => Utils::Bottles::Bintray.package(f.name),
|
||||||
file.write Utils::JSON.dump json
|
"repository" => Utils::Bottles::Bintray.repository(tap),
|
||||||
end
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
||||||
|
file.write Utils::JSON.dump json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -436,7 +432,7 @@ module Homebrew
|
|||||||
puts output
|
puts output
|
||||||
update_or_add = "add"
|
update_or_add = "add"
|
||||||
if s.include? "stable do"
|
if s.include? "stable do"
|
||||||
indent = s.slice(/^ +stable do/).length - "stable do".length
|
indent = s.slice(/^( +)stable do/, 1).length
|
||||||
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
|
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
|
||||||
else
|
else
|
||||||
string = s.sub!(
|
string = s.sub!(
|
||||||
|
|||||||
@ -33,9 +33,9 @@ module Homebrew
|
|||||||
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
# Don't use ARGV.formulae as that will throw if the file doesn't parse
|
||||||
paths = ARGV.named.map do |name|
|
paths = ARGV.named.map do |name|
|
||||||
path = Formulary.path(name)
|
path = Formulary.path(name)
|
||||||
unless path.file? || ARGV.force?
|
|
||||||
raise FormulaUnavailableError, name
|
raise FormulaUnavailableError, name unless path.file? || ARGV.force?
|
||||||
end
|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
exec_editor(*paths)
|
exec_editor(*paths)
|
||||||
|
|||||||
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def mirror
|
def mirror
|
||||||
if ARGV.named.empty?
|
odie "This command requires at least formula argument!" if ARGV.named.empty?
|
||||||
odie "This command requires at least formula argument!"
|
|
||||||
end
|
|
||||||
|
|
||||||
bintray_user = ENV["BINTRAY_USER"]
|
bintray_user = ENV["BINTRAY_USER"]
|
||||||
bintray_key = ENV["BINTRAY_KEY"]
|
bintray_key = ENV["BINTRAY_KEY"]
|
||||||
|
|||||||
@ -41,12 +41,12 @@ require "pkg_version"
|
|||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
def pull
|
def pull
|
||||||
if ARGV[0] == "--rebase"
|
odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase"
|
||||||
odie "You meant `git pull --rebase`."
|
|
||||||
end
|
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
odie "This command requires at least one argument containing a URL or pull request number"
|
odie "This command requires at least one argument containing a URL or pull request number"
|
||||||
end
|
end
|
||||||
|
|
||||||
do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean")
|
do_bump = ARGV.include?("--bump") && !ARGV.include?("--clean")
|
||||||
|
|
||||||
# Formulae with affected bottles that were published
|
# Formulae with affected bottles that were published
|
||||||
@ -429,9 +429,9 @@ module Homebrew
|
|||||||
# Returns nil if formula is absent or if there was an error reading it
|
# Returns nil if formula is absent or if there was an error reading it
|
||||||
def self.lookup(name)
|
def self.lookup(name)
|
||||||
json = Utils.popen_read(HOMEBREW_BREW_FILE, "info", "--json=v1", name)
|
json = Utils.popen_read(HOMEBREW_BREW_FILE, "info", "--json=v1", name)
|
||||||
unless $?.success?
|
|
||||||
return nil
|
return nil unless $?.success?
|
||||||
end
|
|
||||||
Homebrew.force_utf8!(json)
|
Homebrew.force_utf8!(json)
|
||||||
FormulaInfoFromJson.new(Utils::JSON.load(json)[0])
|
FormulaInfoFromJson.new(Utils::JSON.load(json)[0])
|
||||||
end
|
end
|
||||||
|
|||||||
@ -185,8 +185,8 @@ module Homebrew
|
|||||||
|
|
||||||
def puts_result
|
def puts_result
|
||||||
if ENV["TRAVIS"]
|
if ENV["TRAVIS"]
|
||||||
travis_start_time = @start_time.to_i*1000000000
|
travis_start_time = @start_time.to_i * 1_000_000_000
|
||||||
travis_end_time = @end_time.to_i*1000000000
|
travis_end_time = @end_time.to_i * 1_000_000_000
|
||||||
travis_duration = travis_end_time - travis_start_time
|
travis_duration = travis_end_time - travis_start_time
|
||||||
puts "#{Tty.white}==>#{Tty.green} PASSED#{Tty.reset}" if passed?
|
puts "#{Tty.white}==>#{Tty.green} PASSED#{Tty.reset}" if passed?
|
||||||
puts "travis_time:end:#{@travis_timer_id},start=#{travis_start_time},finish=#{travis_end_time},duration=#{travis_duration}"
|
puts "travis_time:end:#{@travis_timer_id},start=#{travis_start_time},finish=#{travis_end_time},duration=#{travis_duration}"
|
||||||
@ -563,11 +563,10 @@ module Homebrew
|
|||||||
|
|
||||||
(installed & dependencies).each do |installed_dependency|
|
(installed & dependencies).each do |installed_dependency|
|
||||||
installed_dependency_formula = Formulary.factory(installed_dependency)
|
installed_dependency_formula = Formulary.factory(installed_dependency)
|
||||||
if installed_dependency_formula.installed? &&
|
next unless installed_dependency_formula.installed?
|
||||||
!installed_dependency_formula.keg_only? &&
|
next if installed_dependency_formula.keg_only?
|
||||||
!installed_dependency_formula.linked_keg.exist?
|
next if installed_dependency_formula.linked_keg.exist?
|
||||||
test "brew", "link", installed_dependency
|
test "brew", "link", installed_dependency
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dependencies -= installed
|
dependencies -= installed
|
||||||
@ -725,9 +724,7 @@ module Homebrew
|
|||||||
coverage_args = []
|
coverage_args = []
|
||||||
if ARGV.include?("--coverage")
|
if ARGV.include?("--coverage")
|
||||||
if ENV["JENKINS_HOME"]
|
if ENV["JENKINS_HOME"]
|
||||||
if OS.mac? && MacOS.version == :sierra
|
coverage_args << "--coverage" if OS.mac? && MacOS.version == :sierra
|
||||||
coverage_args << "--coverage"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
coverage_args << "--coverage"
|
coverage_args << "--coverage"
|
||||||
end
|
end
|
||||||
@ -742,9 +739,7 @@ module Homebrew
|
|||||||
test "brew", "cask-tests", *coverage_args
|
test "brew", "cask-tests", *coverage_args
|
||||||
end
|
end
|
||||||
elsif @tap
|
elsif @tap
|
||||||
if @tap.name == "homebrew/core"
|
test "brew", "style", @tap.name if @tap.name == "homebrew/core"
|
||||||
test "brew", "style", @tap.name
|
|
||||||
end
|
|
||||||
test "brew", "readall", "--aliases", @tap.name
|
test "brew", "readall", "--aliases", @tap.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1055,9 +1050,7 @@ module Homebrew
|
|||||||
ARGV << "--junit" << "--local" << "--test-default-formula"
|
ARGV << "--junit" << "--local" << "--test-default-formula"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include? "--ci-master"
|
ARGV << "--fast" if ARGV.include?("--ci-master")
|
||||||
ARGV << "--fast"
|
|
||||||
end
|
|
||||||
|
|
||||||
if ARGV.include? "--local"
|
if ARGV.include? "--local"
|
||||||
ENV["HOMEBREW_CACHE"] = "#{ENV["HOME"]}/Library/Caches/Homebrew"
|
ENV["HOMEBREW_CACHE"] = "#{ENV["HOME"]}/Library/Caches/Homebrew"
|
||||||
@ -1081,9 +1074,7 @@ module Homebrew
|
|||||||
safe_system "brew", "tap", tap.name, "--full"
|
safe_system "brew", "tap", tap.name, "--full"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include? "--ci-upload"
|
return test_ci_upload(tap) if ARGV.include?("--ci-upload")
|
||||||
return test_ci_upload(tap)
|
|
||||||
end
|
|
||||||
|
|
||||||
tests = []
|
tests = []
|
||||||
any_errors = false
|
any_errors = false
|
||||||
|
|||||||
@ -39,15 +39,11 @@ module Homebrew
|
|||||||
vols = get_mounts path
|
vols = get_mounts path
|
||||||
|
|
||||||
# no volume found
|
# no volume found
|
||||||
if vols.empty?
|
return -1 if vols.empty?
|
||||||
return -1
|
|
||||||
end
|
|
||||||
|
|
||||||
vol_index = @volumes.index(vols[0])
|
vol_index = @volumes.index(vols[0])
|
||||||
# volume not found in volume list
|
# volume not found in volume list
|
||||||
if vol_index.nil?
|
return -1 if vol_index.nil?
|
||||||
return -1
|
|
||||||
end
|
|
||||||
vol_index
|
vol_index
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -82,8 +78,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def inject_file_list(list, str)
|
def inject_file_list(list, string)
|
||||||
list.inject(str) { |s, f| s << " #{f}\n" }
|
list.inject(string) { |a, e| a << " #{e}\n" }
|
||||||
end
|
end
|
||||||
############# END HELPERS
|
############# END HELPERS
|
||||||
|
|
||||||
@ -599,7 +595,7 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_DYLD_vars
|
def check_dyld_vars
|
||||||
dyld_vars = ENV.keys.grep(/^DYLD_/)
|
dyld_vars = ENV.keys.grep(/^DYLD_/)
|
||||||
return if dyld_vars.empty?
|
return if dyld_vars.empty?
|
||||||
|
|
||||||
@ -758,7 +754,7 @@ module Homebrew
|
|||||||
cd #{HOMEBREW_REPOSITORY}
|
cd #{HOMEBREW_REPOSITORY}
|
||||||
git remote add origin https://github.com/Homebrew/brew.git
|
git remote add origin https://github.com/Homebrew/brew.git
|
||||||
EOS
|
EOS
|
||||||
elsif origin !~ /Homebrew\/brew(\.git)?$/
|
elsif origin !~ %r{Homebrew/brew(\.git)?$}
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
Suspicious git origin remote found.
|
Suspicious git origin remote found.
|
||||||
|
|
||||||
|
|||||||
@ -663,19 +663,19 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
@shallow && support_depth?
|
@shallow && support_depth?
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_shallow_clone?
|
def shallow_dir?
|
||||||
git_dir.join("shallow").exist?
|
git_dir.join("shallow").exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
def support_depth?
|
def support_depth?
|
||||||
@ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |rx| rx === @url }
|
@ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |regex| @url =~ regex }
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_dir
|
def git_dir
|
||||||
cached_location.join(".git")
|
cached_location.join(".git")
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_ref?
|
def ref?
|
||||||
quiet_system "git", "--git-dir", git_dir, "rev-parse", "-q", "--verify", "#{@ref}^{commit}"
|
quiet_system "git", "--git-dir", git_dir, "rev-parse", "-q", "--verify", "#{@ref}^{commit}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -696,7 +696,8 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
args << "--depth" << "1" if shallow_clone?
|
args << "--depth" << "1" if shallow_clone?
|
||||||
|
|
||||||
case @ref_type
|
case @ref_type
|
||||||
when :branch, :tag then args << "--branch" << @ref
|
when :branch, :tag
|
||||||
|
args << "--branch" << @ref
|
||||||
end
|
end
|
||||||
|
|
||||||
args << @url << cached_location
|
args << @url << cached_location
|
||||||
@ -716,8 +717,8 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_repo
|
def update_repo
|
||||||
if @ref_type == :branch || !has_ref?
|
if @ref_type == :branch || !ref?
|
||||||
if !shallow_clone? && is_shallow_clone?
|
if !shallow_clone? && shallow_dir?
|
||||||
quiet_safe_system "git", "fetch", "origin", "--unshallow"
|
quiet_safe_system "git", "fetch", "origin", "--unshallow"
|
||||||
else
|
else
|
||||||
quiet_safe_system "git", "fetch", "origin"
|
quiet_safe_system "git", "fetch", "origin"
|
||||||
@ -741,9 +742,11 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
|
|
||||||
def reset_args
|
def reset_args
|
||||||
ref = case @ref_type
|
ref = case @ref_type
|
||||||
when :branch then "origin/#{@ref}"
|
when :branch
|
||||||
when :revision, :tag then @ref
|
"origin/#{@ref}"
|
||||||
end
|
when :revision, :tag
|
||||||
|
@ref
|
||||||
|
end
|
||||||
|
|
||||||
%W[reset --hard #{ref}]
|
%W[reset --hard #{ref}]
|
||||||
end
|
end
|
||||||
@ -1021,9 +1024,9 @@ class DownloadStrategyDetector
|
|||||||
def self.detect(url, strategy = nil)
|
def self.detect(url, strategy = nil)
|
||||||
if strategy.nil?
|
if strategy.nil?
|
||||||
detect_from_url(url)
|
detect_from_url(url)
|
||||||
elsif Class === strategy && strategy < AbstractDownloadStrategy
|
elsif strategy.is_a?(Class) && strategy < AbstractDownloadStrategy
|
||||||
strategy
|
strategy
|
||||||
elsif Symbol === strategy
|
elsif strategy.is_a?(Symbol)
|
||||||
detect_from_symbol(strategy)
|
detect_from_symbol(strategy)
|
||||||
else
|
else
|
||||||
raise TypeError,
|
raise TypeError,
|
||||||
|
|||||||
@ -216,7 +216,7 @@ module HomebrewArgvExtension
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_all_from_source?
|
def build_all_from_source?
|
||||||
!!ENV["HOMEBREW_BUILD_FROM_SOURCE"]
|
!ENV["HOMEBREW_BUILD_FROM_SOURCE"].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether a given formula should be built from source during the current
|
# Whether a given formula should be built from source during the current
|
||||||
|
|||||||
@ -192,15 +192,11 @@ module Stdenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def libcxx
|
def libcxx
|
||||||
if compiler == :clang
|
append "CXX", "-stdlib=libc++" if compiler == :clang
|
||||||
append "CXX", "-stdlib=libc++"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def libstdcxx
|
def libstdcxx
|
||||||
if compiler == :clang
|
append "CXX", "-stdlib=libstdc++" if compiler == :clang
|
||||||
append "CXX", "-stdlib=libstdc++"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
|||||||
@ -64,9 +64,7 @@ module Superenv
|
|||||||
self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths
|
self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths
|
||||||
self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths
|
self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths
|
||||||
self["HOMEBREW_DEPENDENCIES"] = determine_dependencies
|
self["HOMEBREW_DEPENDENCIES"] = determine_dependencies
|
||||||
unless formula.nil?
|
self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix unless formula.nil?
|
||||||
self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix
|
|
||||||
end
|
|
||||||
|
|
||||||
# The HOMEBREW_CCCFG ENV variable is used by the ENV/cc tool to control
|
# The HOMEBREW_CCCFG ENV variable is used by the ENV/cc tool to control
|
||||||
# compiler flag stripping. It consists of a string of characters which act
|
# compiler flag stripping. It consists of a string of characters which act
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "blacklist"
|
require "blacklist"
|
||||||
|
require "extend/os/mac/blacklist" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/blacklist"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "utils/bottles"
|
require "utils/bottles"
|
||||||
|
require "extend/os/mac/utils/bottles" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/utils/bottles"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "cleaner"
|
require "cleaner"
|
||||||
|
require "extend/os/mac/cleaner" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/cleaner"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "dependency_collector"
|
require "dependency_collector"
|
||||||
|
require "extend/os/mac/dependency_collector" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/dependency_collector"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "development_tools"
|
require "development_tools"
|
||||||
|
require "extend/os/mac/development_tools" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/development_tools"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
|
require "extend/os/mac/diagnostic" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/diagnostic"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
require "os"
|
require "os"
|
||||||
require "emoji"
|
require "emoji"
|
||||||
|
require "extend/os/mac/emoji" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/emoji"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "extend/ENV/shared"
|
require "extend/ENV/shared"
|
||||||
|
require "extend/os/mac/extend/ENV/shared" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/extend/ENV/shared"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "extend/ENV/std"
|
require "extend/ENV/std"
|
||||||
|
require "extend/os/mac/extend/ENV/std" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/extend/ENV/std"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "extend/ENV/super"
|
require "extend/ENV/super"
|
||||||
|
require "extend/os/mac/extend/ENV/super" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/extend/ENV/super"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "formula_cellar_checks"
|
require "formula_cellar_checks"
|
||||||
|
require "extend/os/mac/formula_cellar_checks" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/formula_cellar_checks"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "keg_relocate"
|
require "keg_relocate"
|
||||||
|
require "extend/os/mac/keg_relocate" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/keg_relocate"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -2,13 +2,8 @@ module SharedEnvExtension
|
|||||||
def no_weak_imports_support?
|
def no_weak_imports_support?
|
||||||
return false unless compiler == :clang
|
return false unless compiler == :clang
|
||||||
|
|
||||||
if MacOS::Xcode.version && MacOS::Xcode.version < "8.0"
|
return false if MacOS::Xcode.version && MacOS::Xcode.version < "8.0"
|
||||||
return false
|
return false if MacOS::CLT.version && MacOS::CLT.version < "8.0"
|
||||||
end
|
|
||||||
|
|
||||||
if MacOS::CLT.version && MacOS::CLT.version < "8.0"
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
require "system_config"
|
require "system_config"
|
||||||
|
require "extend/os/mac/system_config" if OS.mac?
|
||||||
if OS.mac?
|
|
||||||
require "extend/os/mac/system_config"
|
|
||||||
end
|
|
||||||
|
|||||||
@ -71,13 +71,13 @@ class Pathname
|
|||||||
when Array
|
when Array
|
||||||
if src.empty?
|
if src.empty?
|
||||||
opoo "tried to install empty array to #{self}"
|
opoo "tried to install empty array to #{self}"
|
||||||
return
|
break
|
||||||
end
|
end
|
||||||
src.each { |s| install_p(s, File.basename(s)) }
|
src.each { |s| install_p(s, File.basename(s)) }
|
||||||
when Hash
|
when Hash
|
||||||
if src.empty?
|
if src.empty?
|
||||||
opoo "tried to install empty hash to #{self}"
|
opoo "tried to install empty hash to #{self}"
|
||||||
return
|
break
|
||||||
end
|
end
|
||||||
src.each { |s, new_basename| install_p(s, new_basename) }
|
src.each { |s, new_basename| install_p(s, new_basename) }
|
||||||
else
|
else
|
||||||
|
|||||||
@ -395,9 +395,7 @@ class Formula
|
|||||||
def oldname
|
def oldname
|
||||||
@oldname ||= if tap
|
@oldname ||= if tap
|
||||||
formula_renames = tap.formula_renames
|
formula_renames = tap.formula_renames
|
||||||
if formula_renames.value?(name)
|
formula_renames.to_a.rassoc(name).first if formula_renames.value?(name)
|
||||||
formula_renames.to_a.rassoc(name).first
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1052,7 +1050,7 @@ class Formula
|
|||||||
self.class.link_overwrite_paths.any? do |p|
|
self.class.link_overwrite_paths.any? do |p|
|
||||||
p == to_check ||
|
p == to_check ||
|
||||||
to_check.start_with?(p.chomp("/") + "/") ||
|
to_check.start_with?(p.chomp("/") + "/") ||
|
||||||
/^#{Regexp.escape(p).gsub('\*', ".*?")}$/ === to_check
|
to_check =~ /^#{Regexp.escape(p).gsub('\*', ".*?")}$/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1246,7 +1244,7 @@ class Formula
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
return unless Formula === other
|
return unless other.is_a?(Formula)
|
||||||
name <=> other.name
|
name <=> other.name
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1776,9 +1774,7 @@ class Formula
|
|||||||
ENV["HOMEBREW_CC_LOG_PATH"] = logfn
|
ENV["HOMEBREW_CC_LOG_PATH"] = logfn
|
||||||
|
|
||||||
# TODO: system "xcodebuild" is deprecated, this should be removed soon.
|
# TODO: system "xcodebuild" is deprecated, this should be removed soon.
|
||||||
if cmd.to_s.start_with? "xcodebuild"
|
ENV.remove_cc_etc if cmd.to_s.start_with? "xcodebuild"
|
||||||
ENV.remove_cc_etc
|
|
||||||
end
|
|
||||||
|
|
||||||
# Turn on argument filtering in the superenv compiler wrapper.
|
# Turn on argument filtering in the superenv compiler wrapper.
|
||||||
# We should probably have a better mechanism for this than adding
|
# We should probably have a better mechanism for this than adding
|
||||||
@ -1786,9 +1782,7 @@ class Formula
|
|||||||
if cmd == "python"
|
if cmd == "python"
|
||||||
setup_py_in_args = %w[setup.py build.py].include?(args.first)
|
setup_py_in_args = %w[setup.py build.py].include?(args.first)
|
||||||
setuptools_shim_in_args = args.any? { |a| a.to_s.start_with? "import setuptools" }
|
setuptools_shim_in_args = args.any? { |a| a.to_s.start_with? "import setuptools" }
|
||||||
if setup_py_in_args || setuptools_shim_in_args
|
ENV.refurbish_args if setup_py_in_args || setuptools_shim_in_args
|
||||||
ENV.refurbish_args
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
$stdout.reopen(out)
|
$stdout.reopen(out)
|
||||||
@ -2226,7 +2220,7 @@ class Formula
|
|||||||
# If this formula conflicts with another one.
|
# If this formula conflicts with another one.
|
||||||
# <pre>conflicts_with "imagemagick", :because => "because this is just a stupid example"</pre>
|
# <pre>conflicts_with "imagemagick", :because => "because this is just a stupid example"</pre>
|
||||||
def conflicts_with(*names)
|
def conflicts_with(*names)
|
||||||
opts = Hash === names.last ? names.pop : {}
|
opts = names.last.is_a?(Hash) ? names.pop : {}
|
||||||
names.each { |name| conflicts << FormulaConflict.new(name, opts[:because]) }
|
names.each { |name| conflicts << FormulaConflict.new(name, opts[:because]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
require "utils/shell"
|
require "utils/shell"
|
||||||
|
|
||||||
module FormulaCellarChecks
|
module FormulaCellarChecks
|
||||||
def check_PATH(bin)
|
def check_env_path(bin)
|
||||||
# warn the user if stuff was installed outside of their PATH
|
# warn the user if stuff was installed outside of their PATH
|
||||||
return unless bin.directory?
|
return unless bin.directory?
|
||||||
return if bin.children.empty?
|
return if bin.children.empty?
|
||||||
|
|||||||
@ -24,7 +24,9 @@ class FormulaInstaller
|
|||||||
private(*names)
|
private(*names)
|
||||||
names.each do |name|
|
names.each do |name|
|
||||||
predicate = "#{name}?"
|
predicate = "#{name}?"
|
||||||
define_method(predicate) { !!send(name) }
|
define_method(predicate) do
|
||||||
|
send(name) ? true : false
|
||||||
|
end
|
||||||
private(predicate)
|
private(predicate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -71,7 +73,8 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_bottle?
|
def build_bottle?
|
||||||
!!@build_bottle && !formula.bottle_disabled?
|
return false unless @build_bottle
|
||||||
|
!formula.bottle_disabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
def pour_bottle?(install_bottle_options = { warn: false })
|
def pour_bottle?(install_bottle_options = { warn: false })
|
||||||
@ -254,9 +257,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
unless @poured_bottle
|
unless @poured_bottle
|
||||||
not_pouring = !pour_bottle || @pour_failed
|
not_pouring = !pour_bottle || @pour_failed
|
||||||
if not_pouring && !ignore_deps?
|
compute_and_install_dependencies if not_pouring && !ignore_deps?
|
||||||
compute_and_install_dependencies
|
|
||||||
end
|
|
||||||
build
|
build
|
||||||
clean
|
clean
|
||||||
end
|
end
|
||||||
@ -543,7 +544,7 @@ class FormulaInstaller
|
|||||||
@build_time ||= Time.now - @start_time if @start_time && !interactive?
|
@build_time ||= Time.now - @start_time if @start_time && !interactive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitized_ARGV_options
|
def sanitized_argv_options
|
||||||
args = []
|
args = []
|
||||||
args << "--ignore-dependencies" if ignore_deps?
|
args << "--ignore-dependencies" if ignore_deps?
|
||||||
|
|
||||||
@ -582,7 +583,7 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build_argv
|
def build_argv
|
||||||
sanitized_ARGV_options + options.as_flags
|
sanitized_argv_options + options.as_flags
|
||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
@ -810,8 +811,8 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def audit_installed
|
def audit_installed
|
||||||
audit_check_output(check_PATH(formula.bin))
|
audit_check_output(check_env_path(formula.bin))
|
||||||
audit_check_output(check_PATH(formula.sbin))
|
audit_check_output(check_env_path(formula.sbin))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,8 @@ class FormulaLock
|
|||||||
if @lockfile.nil? || @lockfile.closed?
|
if @lockfile.nil? || @lockfile.closed?
|
||||||
@lockfile = @path.open(File::RDWR | File::CREAT)
|
@lockfile = @path.open(File::RDWR | File::CREAT)
|
||||||
@lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
@lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
@lockfile
|
|
||||||
else
|
|
||||||
@lockfile
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@lockfile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -52,9 +52,7 @@ class FormulaVersions
|
|||||||
rev_list(branch) do |rev|
|
rev_list(branch) do |rev|
|
||||||
formula_at_revision(rev) do |f|
|
formula_at_revision(rev) do |f|
|
||||||
bottle = f.bottle_specification
|
bottle = f.bottle_specification
|
||||||
unless bottle.checksums.empty?
|
map[f.pkg_version] << bottle.rebuild unless bottle.checksums.empty?
|
||||||
map[f.pkg_version] << bottle.rebuild
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
map
|
map
|
||||||
|
|||||||
@ -301,9 +301,7 @@ class Formulary
|
|||||||
return TapLoader.new(ref)
|
return TapLoader.new(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.extname(ref) == ".rb"
|
return FromPathLoader.new(ref) if File.extname(ref) == ".rb"
|
||||||
return FromPathLoader.new(ref)
|
|
||||||
end
|
|
||||||
|
|
||||||
formula_with_that_name = core_path(ref)
|
formula_with_that_name = core_path(ref)
|
||||||
if formula_with_that_name.file?
|
if formula_with_that_name.file?
|
||||||
@ -311,9 +309,7 @@ class Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
possible_alias = CoreTap.instance.alias_dir/ref
|
possible_alias = CoreTap.instance.alias_dir/ref
|
||||||
if possible_alias.file?
|
return AliasLoader.new(possible_alias) if possible_alias.file?
|
||||||
return AliasLoader.new(possible_alias)
|
|
||||||
end
|
|
||||||
|
|
||||||
possible_tap_formulae = tap_paths(ref)
|
possible_tap_formulae = tap_paths(ref)
|
||||||
if possible_tap_formulae.size > 1
|
if possible_tap_formulae.size > 1
|
||||||
|
|||||||
@ -62,12 +62,17 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
||||||
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
|
LOCALEDIR_RX = %r{(locale|man)/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?}
|
||||||
INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}
|
INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}
|
||||||
TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks].freeze
|
TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks].freeze
|
||||||
ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze
|
ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze
|
||||||
PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs var/homebrew/linked].map do |d|
|
PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs var/homebrew/linked].map do |dir|
|
||||||
case d when "LinkedKegs" then HOMEBREW_LIBRARY/d else HOMEBREW_PREFIX/d end
|
case dir
|
||||||
|
when "LinkedKegs"
|
||||||
|
HOMEBREW_LIBRARY/dir
|
||||||
|
else
|
||||||
|
HOMEBREW_PREFIX/dir
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# These paths relative to the keg's share directory should always be real
|
# These paths relative to the keg's share directory should always be real
|
||||||
@ -249,10 +254,10 @@ class Keg
|
|||||||
|
|
||||||
def completion_installed?(shell)
|
def completion_installed?(shell)
|
||||||
dir = case shell
|
dir = case shell
|
||||||
when :bash then path.join("etc", "bash_completion.d")
|
when :bash then path.join("etc", "bash_completion.d")
|
||||||
when :zsh then path.join("share", "zsh", "site-functions")
|
when :zsh then path.join("share", "zsh", "site-functions")
|
||||||
when :fish then path.join("share", "fish", "vendor_completions.d")
|
when :fish then path.join("share", "fish", "vendor_completions.d")
|
||||||
end
|
end
|
||||||
dir && dir.directory? && !dir.children.empty?
|
dir && dir.directory? && !dir.children.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -318,13 +323,13 @@ class Keg
|
|||||||
when "locale/locale.alias" then :skip_file
|
when "locale/locale.alias" then :skip_file
|
||||||
when INFOFILE_RX then :info
|
when INFOFILE_RX then :info
|
||||||
when LOCALEDIR_RX then :mkpath
|
when LOCALEDIR_RX then :mkpath
|
||||||
when /^icons\/.*\/icon-theme\.cache$/ then :skip_file
|
when %r{^icons/.*/icon-theme\.cache$} then :skip_file
|
||||||
# all icons subfolders should also mkpath
|
# all icons subfolders should also mkpath
|
||||||
when /^icons\// then :mkpath
|
when %r{^icons/} then :mkpath
|
||||||
when /^zsh/ then :mkpath
|
when /^zsh/ then :mkpath
|
||||||
when /^fish/ then :mkpath
|
when /^fish/ then :mkpath
|
||||||
# Lua, Lua51, Lua53 all need the same handling.
|
# Lua, Lua51, Lua53 all need the same handling.
|
||||||
when /^lua\// then :mkpath
|
when %r{^lua/} then :mkpath
|
||||||
when %r{^guile/} then :mkpath
|
when %r{^guile/} then :mkpath
|
||||||
when *SHARE_PATHS then :mkpath
|
when *SHARE_PATHS then :mkpath
|
||||||
else :link
|
else :link
|
||||||
@ -362,7 +367,7 @@ class Keg
|
|||||||
# the :link strategy. However, for Foo.framework and
|
# the :link strategy. However, for Foo.framework and
|
||||||
# Foo.framework/Versions we have to use :mkpath so that multiple formulae
|
# Foo.framework/Versions we have to use :mkpath so that multiple formulae
|
||||||
# can link their versions into it and `brew [un]link` works.
|
# can link their versions into it and `brew [un]link` works.
|
||||||
if relative_path.to_s =~ /[^\/]*\.framework(\/Versions)?$/
|
if relative_path.to_s =~ %r{[^/]*\.framework(/Versions)?$}
|
||||||
:mkpath
|
:mkpath
|
||||||
else
|
else
|
||||||
:link
|
:link
|
||||||
|
|||||||
@ -79,19 +79,16 @@ module Language
|
|||||||
|
|
||||||
# if we have build flags, we have to pass them to cabal install to resolve the necessary
|
# if we have build flags, we have to pass them to cabal install to resolve the necessary
|
||||||
# dependencies, and call cabal configure afterwards to set the flags again for compile
|
# dependencies, and call cabal configure afterwards to set the flags again for compile
|
||||||
flags = ""
|
flags = "--flags=#{options[:flags].join(" ")}" if options[:flags]
|
||||||
if options[:flags]
|
|
||||||
flags = "--flags=#{options[:flags].join(" ")}"
|
|
||||||
end
|
|
||||||
|
|
||||||
args_and_flags = args
|
args_and_flags = args
|
||||||
args_and_flags << flags unless flags.empty?
|
args_and_flags << flags unless flags.nil?
|
||||||
|
|
||||||
# install dependencies in the sandbox
|
# install dependencies in the sandbox
|
||||||
cabal_install "--only-dependencies", *args_and_flags
|
cabal_install "--only-dependencies", *args_and_flags
|
||||||
|
|
||||||
# call configure if build flags are set
|
# call configure if build flags are set
|
||||||
cabal_configure flags unless flags.empty?
|
cabal_configure flags unless flags.nil?
|
||||||
|
|
||||||
# install the main package in the destination dir
|
# install the main package in the destination dir
|
||||||
cabal_install "--prefix=#{prefix}", *args
|
cabal_install "--prefix=#{prefix}", *args
|
||||||
|
|||||||
@ -337,9 +337,7 @@ class Migrator
|
|||||||
end
|
end
|
||||||
|
|
||||||
def backup_oldname_cellar
|
def backup_oldname_cellar
|
||||||
unless old_cellar.exist?
|
FileUtils.mv(new_cellar, old_cellar) unless old_cellar.exist?
|
||||||
FileUtils.mv(new_cellar, old_cellar)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def backup_old_tabs
|
def backup_old_tabs
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class Option
|
|||||||
end
|
end
|
||||||
|
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
return unless Option === other
|
return unless other.is_a?(Option)
|
||||||
name <=> other.name
|
name <=> other.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,7 @@ module OS
|
|||||||
# Returns true even if outdated tools are installed, e.g.
|
# Returns true even if outdated tools are installed, e.g.
|
||||||
# tools from Xcode 4.x on 10.9
|
# tools from Xcode 4.x on 10.9
|
||||||
def installed?
|
def installed?
|
||||||
!!detect_version
|
!detect_version.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_instructions
|
def update_instructions
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class DATAPatch < EmbeddedPatch
|
|||||||
path.open("rb") do |f|
|
path.open("rb") do |f|
|
||||||
begin
|
begin
|
||||||
line = f.gets
|
line = f.gets
|
||||||
end until line.nil? || /^__END__$/ === line
|
end until line.nil? || line =~ /^__END__$/
|
||||||
data << line while line = f.gets
|
data << line while line = f.gets
|
||||||
end
|
end
|
||||||
data
|
data
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class PkgVersion
|
|||||||
alias_method :to_str, :to_s
|
alias_method :to_str, :to_s
|
||||||
|
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
return unless PkgVersion === other
|
return unless other.is_a?(PkgVersion)
|
||||||
(version <=> other.version).nonzero? || revision <=> other.revision
|
(version <=> other.version).nonzero? || revision <=> other.revision
|
||||||
end
|
end
|
||||||
alias_method :eql?, :==
|
alias_method :eql?, :==
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class Requirement
|
|||||||
def satisfied?
|
def satisfied?
|
||||||
result = self.class.satisfy.yielder { |p| instance_eval(&p) }
|
result = self.class.satisfy.yielder { |p| instance_eval(&p) }
|
||||||
@satisfied_result = result
|
@satisfied_result = result
|
||||||
!!result
|
result ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overriding #fatal? is deprecated.
|
# Overriding #fatal? is deprecated.
|
||||||
@ -83,7 +83,7 @@ class Requirement
|
|||||||
# PATH.
|
# PATH.
|
||||||
# This is undocumented magic and it should be removed, but we need to add
|
# This is undocumented magic and it should be removed, but we need to add
|
||||||
# a way to declare path-based requirements that work with superenv first.
|
# a way to declare path-based requirements that work with superenv first.
|
||||||
if Pathname === @satisfied_result
|
if @satisfied_result.is_a?(Pathname)
|
||||||
parent = @satisfied_result.parent
|
parent = @satisfied_result.parent
|
||||||
unless ENV["PATH"].split(File::PATH_SEPARATOR).include?(parent.to_s)
|
unless ENV["PATH"].split(File::PATH_SEPARATOR).include?(parent.to_s)
|
||||||
ENV.append_path("PATH", parent)
|
ENV.append_path("PATH", parent)
|
||||||
@ -115,7 +115,7 @@ class Requirement
|
|||||||
def to_dependency
|
def to_dependency
|
||||||
f = self.class.default_formula
|
f = self.class.default_formula
|
||||||
raise "No default formula defined for #{inspect}" if f.nil?
|
raise "No default formula defined for #{inspect}" if f.nil?
|
||||||
if HOMEBREW_TAP_FORMULA_REGEX === f
|
if f =~ HOMEBREW_TAP_FORMULA_REGEX
|
||||||
TapDependency.new(f, tags, method(:modify_build_environment), name)
|
TapDependency.new(f, tags, method(:modify_build_environment), name)
|
||||||
else
|
else
|
||||||
Dependency.new(f, tags, method(:modify_build_environment), name)
|
Dependency.new(f, tags, method(:modify_build_environment), name)
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class XcodeRequirement < Requirement
|
|||||||
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 { |tag| tags.delete(tag) if tag =~ /(\d\.)+\d/ }
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ class XcodeRequirement < Requirement
|
|||||||
Installing just the Command Line Tools is not sufficient.
|
Installing just the Command Line Tools is not sufficient.
|
||||||
EOS
|
EOS
|
||||||
if MacOS.version >= :lion
|
if MacOS.version >= :lion
|
||||||
message += <<-EOS.undent
|
message + <<-EOS.undent
|
||||||
Xcode can be installed from the App Store.
|
Xcode can be installed from the App Store.
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
message += <<-EOS.undent
|
message + <<-EOS.undent
|
||||||
Xcode can be installed from https://developer.apple.com/xcode/downloads/
|
Xcode can be installed from https://developer.apple.com/xcode/downloads/
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|||||||
@ -65,11 +65,12 @@ class SoftwareSpec
|
|||||||
end
|
end
|
||||||
|
|
||||||
def bottle_unneeded?
|
def bottle_unneeded?
|
||||||
!!@bottle_disable_reason && @bottle_disable_reason.unneeded?
|
return false unless @bottle_disable_reason
|
||||||
|
@bottle_disable_reason.unneeded?
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottle_disabled?
|
def bottle_disabled?
|
||||||
!!@bottle_disable_reason
|
@bottle_disable_reason ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :bottle_disable_reason
|
attr_reader :bottle_disable_reason
|
||||||
@ -116,12 +117,12 @@ class SoftwareSpec
|
|||||||
|
|
||||||
def option(name, description = "")
|
def option(name, description = "")
|
||||||
opt = PREDEFINED_OPTIONS.fetch(name) do
|
opt = PREDEFINED_OPTIONS.fetch(name) do
|
||||||
if Symbol === name
|
if name.is_a?(Symbol)
|
||||||
opoo "Passing arbitrary symbols to `option` is deprecated: #{name.inspect}"
|
opoo "Passing arbitrary symbols to `option` is deprecated: #{name.inspect}"
|
||||||
puts "Symbols are reserved for future use, please pass a string instead"
|
puts "Symbols are reserved for future use, please pass a string instead"
|
||||||
name = name.to_s
|
name = name.to_s
|
||||||
end
|
end
|
||||||
unless String === name
|
unless name.is_a?(String)
|
||||||
raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}"
|
raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}"
|
||||||
end
|
end
|
||||||
raise ArgumentError, "option name is required" if name.empty?
|
raise ArgumentError, "option name is required" if name.empty?
|
||||||
@ -318,7 +319,7 @@ class BottleSpecification
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tag?(tag)
|
def tag?(tag)
|
||||||
!!checksum_for(tag)
|
checksum_for(tag) ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checksum methods in the DSL's bottle block optionally take
|
# Checksum methods in the DSL's bottle block optionally take
|
||||||
|
|||||||
@ -328,9 +328,9 @@ class Tab < OpenStruct
|
|||||||
else
|
else
|
||||||
s << "Built from source"
|
s << "Built from source"
|
||||||
end
|
end
|
||||||
if time
|
|
||||||
s << Time.at(time).strftime("on %Y-%m-%d at %H:%M:%S")
|
s << Time.at(time).strftime("on %Y-%m-%d at %H:%M:%S") if time
|
||||||
end
|
|
||||||
unless used_options.empty?
|
unless used_options.empty?
|
||||||
s << "with:"
|
s << "with:"
|
||||||
s << used_options.to_a.join(" ")
|
s << used_options.to_a.join(" ")
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class DiagnosticChecksTest < Homebrew::TestCase
|
|||||||
def test_check_dyld_vars
|
def test_check_dyld_vars
|
||||||
ENV["DYLD_INSERT_LIBRARIES"] = "foo"
|
ENV["DYLD_INSERT_LIBRARIES"] = "foo"
|
||||||
assert_match "Setting DYLD_INSERT_LIBRARIES",
|
assert_match "Setting DYLD_INSERT_LIBRARIES",
|
||||||
@checks.check_DYLD_vars
|
@checks.check_dyld_vars
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_check_for_symlinked_cellar
|
def test_check_for_symlinked_cellar
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class GitDownloadStrategyTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_source_modified_time
|
def test_source_modified_time
|
||||||
setup_git_repo
|
setup_git_repo
|
||||||
assert_equal 1242860651, @strategy.source_modified_time.to_i
|
assert_equal 1_242_860_651, @strategy.source_modified_time.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_last_commit
|
def test_last_commit
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class PathnameTests < Homebrew::TestCase
|
|||||||
mkdir_p @dir/"a-directory"
|
mkdir_p @dir/"a-directory"
|
||||||
touch @dir/".DS_Store"
|
touch @dir/".DS_Store"
|
||||||
touch @dir/"a-file"
|
touch @dir/"a-file"
|
||||||
File.truncate(@dir/"a-file", 1048576)
|
File.truncate(@dir/"a-file", 1_048_576)
|
||||||
ln_s @dir/"a-file", @dir/"a-symlink"
|
ln_s @dir/"a-file", @dir/"a-symlink"
|
||||||
ln @dir/"a-file", @dir/"a-hardlink"
|
ln @dir/"a-file", @dir/"a-hardlink"
|
||||||
assert_equal 3, @dir.file_count
|
assert_equal 3, @dir.file_count
|
||||||
|
|||||||
@ -22,9 +22,7 @@ module Utils
|
|||||||
return if git_available?
|
return if git_available?
|
||||||
|
|
||||||
# we cannot install brewed git if homebrew/core is unavailable.
|
# we cannot install brewed git if homebrew/core is unavailable.
|
||||||
unless CoreTap.instance.installed?
|
raise "Git is unavailable" unless CoreTap.instance.installed?
|
||||||
raise "Git is unavailable"
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
oh1 "Installing git"
|
oh1 "Installing git"
|
||||||
|
|||||||
@ -208,7 +208,7 @@ class Version
|
|||||||
end
|
end
|
||||||
|
|
||||||
def <=>(other)
|
def <=>(other)
|
||||||
return unless Version === other
|
return unless other.is_a?(Version)
|
||||||
return 0 if version == other.version
|
return 0 if version == other.version
|
||||||
return 1 if head? && !other.head?
|
return 1 if head? && !other.head?
|
||||||
return -1 if !head? && other.head?
|
return -1 if !head? && other.head?
|
||||||
@ -386,7 +386,7 @@ class Version
|
|||||||
|
|
||||||
# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
|
# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
|
||||||
# e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar
|
# e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar
|
||||||
m = /\/(\d\.\d+(\.\d+)?)\//.match(spec_s)
|
m = %r{/(\d\.\d+(\.\d+)?)}.match(spec_s)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz
|
# e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user