diff --git a/.github/codecov.yml b/.github/codecov.yml index ec60ef7970..20c1e42d0a 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -6,3 +6,6 @@ coverage: project: default: threshold: 0.05% + patch: + default: + informational: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 532b00437f..7e573f2db2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -103,6 +103,12 @@ jobs: if [ "$RUNNER_OS" = "macOS" ]; then brew tap homebrew/cask brew update-reset Library/Taps/homebrew/homebrew-cask + + # don't care about `brew cask style` here. + brew untap adoptopenjdk/openjdk + + # don't care about `brew audit` here. + brew untap mongodb/brew else # Fix permissions for 'brew tests' sudo chmod -R g-w,o-w /home/linuxbrew /home/runner /opt @@ -159,6 +165,13 @@ jobs: - name: Run brew style on official taps run: brew style --display-cop-names homebrew/bundle homebrew/services homebrew/test-bot + - name: Run brew cask style + if: matrix.os == 'macOS-latest' + run: brew cask style + + - name: Run brew audit + run: brew audit --skip-style + - name: Run vale for docs linting run: | brew install vale @@ -174,12 +187,12 @@ jobs: if: matrix.os == 'ubuntu-latest' run: docker build -t brew --build-arg=version=16.04 . - - name: Run brew test-bot + - name: Run brew test-bot --only-formulae --test-default-formula run: | if [ "$RUNNER_OS" = "Linux" ]; then - docker run --rm brew brew test-bot + docker run --rm brew brew test-bot --only-formulae --test-default-formula else - brew test-bot + brew test-bot --only-formulae --test-default-formula fi - name: Deploy the Docker image to GitHub and Docker Hub diff --git a/.gitignore b/.gitignore index f2a0f78cf0..8026b79241 100644 --- a/.gitignore +++ b/.gitignore @@ -86,11 +86,13 @@ **/vendor/bundle/ruby/*/gems/byebug-*/ **/vendor/bundle/ruby/*/gems/coderay-*/ **/vendor/bundle/ruby/*/gems/colorize-*/ +**/vendor/bundle/ruby/*/gems/commander-*/ **/vendor/bundle/ruby/*/gems/connection_pool-*/ **/vendor/bundle/ruby/*/gems/codecov-*/ **/vendor/bundle/ruby/*/gems/diff-lcs-*/ **/vendor/bundle/ruby/*/gems/docile-*/ **/vendor/bundle/ruby/*/gems/domain_name-*/ +**/vendor/bundle/ruby/*/gems/highline-*/ **/vendor/bundle/ruby/*/gems/http-cookie-*/ **/vendor/bundle/ruby/*/gems/hpricot-*/ **/vendor/bundle/ruby/*/gems/jaro_winkler-*/ @@ -107,6 +109,7 @@ **/vendor/bundle/ruby/*/gems/ntlm-http-*/ **/vendor/bundle/ruby/*/gems/parallel-*/ **/vendor/bundle/ruby/*/gems/parallel_tests-*/ +**/vendor/bundle/ruby/*/gems/parlour-*/ **/vendor/bundle/ruby/*/gems/parser-*/ **/vendor/bundle/ruby/*/gems/powerpack-*/ **/vendor/bundle/ruby/*/gems/psych-*/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b5be7c10..f880deb64a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,3 @@ See Homebrew's [releases on GitHub](https://github.com/Homebrew/brew/releases) for the changelog. + +Release notes for major and minor releases can also be found in the [Homebrew blog](https://brew.sh/blog/). diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 81c1dc6692..d8d0fdcedb 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -1,4 +1,12 @@ -inherit_from: ./.rubocop_shared.yml +# TODO: Try getting more rules in sync. + +require: ./Homebrew/rubocops.rb + +AllCops: + TargetRubyVersion: 2.6 + DisplayCopNames: false + # enable all pending rubocops + NewCops: enable # enable all formulae audits FormulaAudit: @@ -8,9 +16,108 @@ FormulaAudit: FormulaAuditStrict: Enabled: true -# enable all pending rubocops -AllCops: - NewCops: enable +# Use `<<~` for heredocs. +Layout/HeredocIndentation: + Enabled: true + +# Not useful in casks and formulae. +Metrics/BlockLength: + Enabled: false + +# Keyword arguments don't have the same readability +# problems as normal parameters. +Metrics/ParameterLists: + CountKeywordArgs: false + +# Implicitly allow EOS as we use it everywhere. +Naming/HeredocDelimiterNaming: + ForbiddenDelimiters: + - END, EOD, EOF + +# Allow dashes in filenames. +Naming/FileName: + Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ + +# Both styles are used depending on context, +# e.g. `sha256` and `something_countable_1`. +Naming/VariableNumber: + Enabled: false + +# Avoid leaking resources. +Style/AutoResourceCleanup: + Enabled: true + +# This makes these a little more obvious. +Style/BarePercentLiterals: + EnforcedStyle: percent_q + +# Use consistent style for better readability. +Style/CollectionMethods: + Enabled: true + +# Prefer tokens with type annotations for consistency +# between formatting numbers and strings. +Style/FormatStringToken: + EnforcedStyle: annotated + +# autocorrectable and more readable +Style/HashEachMethods: + Enabled: true +Style/HashTransformKeys: + Enabled: true +Style/HashTransformValues: + Enabled: true + +# Enabled now LineLength is lowish. +Style/IfUnlessModifier: + Enabled: true + +# Only use this for numbers >= `1_000_000`. +Style/NumericLiterals: + MinDigits: 7 + Strict: true + +# Zero-prefixed octal literals are widely used and understood. +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# Rescuing `StandardError` is an understood default. +Style/RescueStandardError: + EnforcedStyle: implicit + +# Returning `nil` is unnecessary. +Style/ReturnNil: + Enabled: true + +# We have no use for using `warn` because we +# are calling Ruby with warnings disabled. +Style/StderrPuts: + Enabled: false + +# Use consistent method names. +Style/StringMethods: + Enabled: true + +# An array of symbols is more readable than a symbol array +# and also allows for easier grepping. +Style/SymbolArray: + EnforcedStyle: brackets + +# Trailing commas make diffs nicer. +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: comma +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: comma + +# Does not hinder readability, so might as well enable it. +Performance/CaseWhenSplat: + Enabled: true + +# Makes code less readable for minor performance increases. +Performance/Caller: + Enabled: false # don't allow cops to be disabled in formulae Style/DisableCopsWithinSourceCodeDirective: @@ -54,6 +161,7 @@ Lint/AmbiguousRegexpLiteral: Lint/ParenthesesAsGroupedExpression: Enabled: false + # most metrics don't make sense to apply for formulae/taps Metrics/AbcSize: Enabled: false @@ -72,7 +180,17 @@ Metrics/PerceivedComplexity: Layout/LineLength: Max: 118 # ignore manpage comments and long single-line strings - IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :'] + IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options ', + ' appcast "', ' executable: "', ' font "', ' homepage "', ' name "', + ' pkg "', ' pkgutil: "', '#{language}', '#{version.', + ' "/Library/Application Support/', '"/Library/Caches/', '"/Library/PreferencePanes/', + ' "~/Library/Application Support/', '"~/Library/Caches/', '"~/Application Support', + ' was verified as official when first introduced to the cask'] + +# TODO: remove this when possible. +Style/ClassVars: + Exclude: + - '**/developer/bin/*' # most of our APIs are internal so don't require docs Style/Documentation: @@ -82,26 +200,18 @@ Style/Documentation: Style/FrozenStringLiteralComment: Enabled: false +# TODO: remove this when possible. +Style/GlobalVars: + Exclude: + - '**/developer/bin/*' + # potential for errors in formulae too high with this Style/GuardClause: Enabled: false -# depends_on a: :b looks weird in formulae. +# avoid hash rockets where possible Style/HashSyntax: - EnforcedStyle: hash_rockets - Exclude: - - '**/Guardfile' - - '**/cmd/**/*.rb' - - '**/lib/**/*.rb' - - '**/spec/**/*.rb' - -# autocorrectable and more readable -Style/HashEachMethods: - Enabled: true -Style/HashTransformKeys: - Enabled: true -Style/HashTransformValues: - Enabled: true + EnforcedStyle: ruby19 # ruby style guide favorite Style/StringLiterals: @@ -118,3 +228,11 @@ Style/TernaryParentheses: # a bit confusing to non-Rubyists but useful for longer arrays Style/WordArray: MinSize: 4 + +# would rather freeze too much than too little +Style/MutableConstant: + EnforcedStyle: strict + +# unused keyword arguments improve APIs +Lint/UnusedMethodArgument: + AllowUnusedKeywordArguments: true diff --git a/Library/.rubocop_cask.yml b/Library/.rubocop_cask.yml index db3d6caf66..e53db5a55d 100644 --- a/Library/.rubocop_cask.yml +++ b/Library/.rubocop_cask.yml @@ -1,10 +1,8 @@ -inherit_from: ./.rubocop_shared.yml +inherit_from: ./Homebrew/.rubocop.yml Cask/HomepageMatchesUrl: Description: 'Ensure that the homepage and url match, otherwise add a comment. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/doc/cask_language_reference/stanzas/url.md#when-url-and-homepage-hostnames-differ-add-a-comment' Enabled: true - Exclude: - - '**/test/support/fixtures/cask/Casks/**/*.rb' Cask/HomepageUrlTrailingSlash: Description: 'Ensure that the homepage url has a slash after the domain name.' @@ -22,44 +20,6 @@ Cask/StanzaOrder: Description: 'Ensure that cask stanzas are sorted correctly. More info at https://github.com/Homebrew/homebrew-cask/blob/HEAD/CONTRIBUTING.md#stanza-order' Enabled: true -Layout/HashAlignment: - EnforcedHashRocketStyle: table - EnforcedColonStyle: table - -Layout/FirstArrayElementIndentation: - EnforcedStyle: align_brackets - -Layout/FirstHashElementIndentation: - EnforcedStyle: align_braces - -# Casks often contain long URLs and file paths. -Layout/LineLength: - Enabled: false - -# Casks don't need documentation. -Style/Documentation: - Enabled: false - -# These would only be distracting in casks. +# don't want this for casks but re-enabled for Library/Homebrew Style/FrozenStringLiteralComment: - EnforcedStyle: never - -# Don't use hash rockets. -Style/HashSyntax: - EnforcedStyle: ruby19_no_mixed_keys - -# This is more readable when the regex contains slashes. -Style/RegexpLiteral: - EnforcedStyle: percent_r - -# Use consistent style for all arrays. -Style/WordArray: - EnforcedStyle: brackets - -# This makes multi-line arrays more readable and alignable. -Layout/FirstArrayElementLineBreak: - Enabled: true - -# This makes multi-line hashes more readable and alignable. -Layout/FirstHashElementLineBreak: - Enabled: true + Enabled: false diff --git a/Library/.rubocop_shared.yml b/Library/.rubocop_shared.yml deleted file mode 100644 index 1f35180e12..0000000000 --- a/Library/.rubocop_shared.yml +++ /dev/null @@ -1,110 +0,0 @@ -# TODO: Try getting more rules in sync. - -require: ./Homebrew/rubocops.rb - -AllCops: - TargetRubyVersion: 2.6 - DisplayCopNames: false - -# Use `<<~` for heredocs. -Layout/HeredocIndentation: - Enabled: true - -# Not useful in casks and formulae. -Metrics/BlockLength: - Enabled: false - -# Keyword arguments don't have the same readability -# problems as normal parameters. -Metrics/ParameterLists: - CountKeywordArgs: false - -# Implicitly allow EOS as we use it everywhere. -Naming/HeredocDelimiterNaming: - ForbiddenDelimiters: - - END, EOD, EOF - -# Allow dashes in filenames. -Naming/FileName: - Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/ - -# Both styles are used depending on context, -# e.g. `sha256` and `something_countable_1`. -Naming/VariableNumber: - Enabled: false - -# Avoid leaking resources. -Style/AutoResourceCleanup: - Enabled: true - -# This makes these a little more obvious. -Style/BarePercentLiterals: - EnforcedStyle: percent_q - -# Use consistent style for better readability. -Style/CollectionMethods: - Enabled: true - -# Prefer tokens with type annotations for consistency -# between formatting numbers and strings. -Style/FormatStringToken: - EnforcedStyle: annotated - -# autocorrectable and more readable -Style/HashEachMethods: - Enabled: true -Style/HashTransformKeys: - Enabled: true -Style/HashTransformValues: - Enabled: true - -# Enabled now LineLength is lowish. -Style/IfUnlessModifier: - Enabled: true - -# Only use this for numbers >= `1_000_000`. -Style/NumericLiterals: - MinDigits: 7 - Strict: true - -# Zero-prefixed octal literals are widely used and understood. -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# Rescuing `StandardError` is an understood default. -Style/RescueStandardError: - EnforcedStyle: implicit - -# Returning `nil` is unnecessary. -Style/ReturnNil: - Enabled: true - -# We have no use for using `warn` because we -# are calling Ruby with warnings disabled. -Style/StderrPuts: - Enabled: false - -# Use consistent method names. -Style/StringMethods: - Enabled: true - -# An array of symbols is more readable than a symbol array -# and also allows for easier grepping. -Style/SymbolArray: - EnforcedStyle: brackets - -# Trailing commas make diffs nicer. -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: comma -Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: comma -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: comma - -# Does not hinder readability, so might as well enable it. -Performance/CaseWhenSplat: - Enabled: true - -# Makes code less readable for minor performance increases. -Performance/Caller: - Enabled: false diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index 7641e575e5..cca1eb3204 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -6,7 +6,6 @@ AllCops: - 'Library/Homebrew/.simplecov' Exclude: - 'bin/*' - - '**/Casks/**/*' - '**/vendor/**/*' # messes up system formatting for formulae but good for Homebrew/brew @@ -35,10 +34,6 @@ Lint/NestedMethodDefinition: Lint/ParenthesesAsGroupedExpression: Enabled: true -# unused keyword arguments improve APIs -Lint/UnusedMethodArgument: - AllowUnusedKeywordArguments: true - # TODO: try to bring down all metrics maximums Metrics/AbcSize: Enabled: true @@ -113,10 +108,7 @@ Style/BlockDelimiters: # don't group nicely documented or private attr_readers Style/AccessorGrouping: - Enabled: true Exclude: - - 'cask/cmd/internal_stanza.rb' - - 'cask/download.rb' - 'formula.rb' - 'formulary.rb' - 'migrator.rb' @@ -124,11 +116,6 @@ Style/AccessorGrouping: - 'system_command.rb' - 'tap.rb' -# https://github.com/rubocop-hq/rubocop/issues/8257 -Style/BisectedAttrAccessor: - Exclude: - - 'cask/url.rb' - # document our public APIs Style/Documentation: Enabled: true @@ -143,19 +130,9 @@ Style/DocumentationMethod: Style/FrozenStringLiteralComment: Enabled: true EnforcedStyle: always + Exclude: + - '**/Casks/**/*.rb' # so many of these in formulae but none in here Style/GuardClause: Enabled: true - -# hash-rockets preferred for formulae, a: 1 preferred here -Style/HashSyntax: - EnforcedStyle: ruby19_no_mixed_keys - -# would rather freeze too much than too little -Style/MutableConstant: - EnforcedStyle: strict - -# LineLength is low enough here to re-enable it. -Style/IfUnlessModifier: - Enabled: true diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 6988423278..810ddbfebd 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -10,7 +10,7 @@ GEM ast (2.4.1) bindata (2.4.8) byebug (11.1.3) - codecov (0.2.2) + codecov (0.2.3) colorize json simplecov @@ -55,7 +55,7 @@ GEM parallel parser (2.7.1.4) ast (~> 2.4.1) - patchelf (1.1.1) + patchelf (1.2.0) elftools (~> 1.1) plist (3.5.0) rainbow (3.0.0) @@ -95,8 +95,8 @@ GEM rubocop-ast (>= 0.1.0, < 1.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.2.0) - parser (>= 2.7.0.1) + rubocop-ast (0.3.0) + parser (>= 2.7.1.4) rubocop-performance (1.7.1) rubocop (>= 0.82.0) rubocop-rspec (1.42.0) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index d86bc8298c..ca89004014 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -35,19 +35,13 @@ rescue MissingEnvironmentVariables => e exec ENV["HOMEBREW_BREW_FILE"], *ARGV end -def output_unsupported_error - $stderr.puts <<~EOS - Please create pull requests instead of asking for help on Homebrew's GitHub, - Discourse, Twitter or IRC. - EOS -end - begin trap("INT", std_trap) # restore default CTRL-C handler empty_argv = ARGV.empty? help_flag_list = %w[-h --help --usage -?] help_flag = !ENV["HOMEBREW_HELP"].nil? + help_cmd_index = nil cmd = nil ARGV.each_with_index do |arg, i| @@ -56,12 +50,17 @@ begin if arg == "help" && !cmd # Command-style help: `help ` is fine, but ` help` is not. help_flag = true + help_cmd_index = i elsif !cmd && !help_flag_list.include?(arg) cmd = ARGV.delete_at(i) cmd = Commands::HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) end end + ARGV.delete_at(help_cmd_index) if help_cmd_index + + Homebrew.args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) + path = PATH.new(ENV["PATH"]) homebrew_path = PATH.new(ENV["HOMEBREW_PATH"]) @@ -124,16 +123,17 @@ begin odie "Unknown command: #{cmd}" if !possible_tap || possible_tap.installed? # Unset HOMEBREW_HELP to avoid confusing the tap - ENV.delete("HOMEBREW_HELP") if help_flag - tap_commands = [] - cgroup = Utils.popen_read("cat", "/proc/1/cgroup") - if %w[azpl_job actions_job docker garden kubepods].none? { |container| cgroup.include?(container) } - brew_uid = HOMEBREW_BREW_FILE.stat.uid - tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero? + with_env HOMEBREW_HELP: nil do + tap_commands = [] + cgroup = Utils.popen_read("cat", "/proc/1/cgroup") + if %w[azpl_job actions_job docker garden kubepods].none? { |container| cgroup.include?(container) } + brew_uid = HOMEBREW_BREW_FILE.stat.uid + tap_commands += %W[/usr/bin/sudo -u ##{brew_uid}] if Process.uid.zero? && !brew_uid.zero? + end + tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap.name}] + safe_system(*tap_commands) end - tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap.name}] - safe_system(*tap_commands) - ENV["HOMEBREW_HELP"] = "1" if help_flag + exec HOMEBREW_BREW_FILE, cmd, *ARGV end rescue UsageError => e @@ -150,7 +150,12 @@ rescue BuildError => e Utils::Analytics.report_build_error(e) e.dump - output_unsupported_error if e.formula.head? || e.formula.deprecated? || e.formula.disabled? + if e.formula.head? || e.formula.deprecated? || e.formula.disabled? + $stderr.puts <<~EOS + Please create pull requests instead of asking for help on Homebrew's GitHub, + Discourse, Twitter or IRC. + EOS + end exit 1 rescue RuntimeError, SystemCallError => e @@ -159,8 +164,6 @@ rescue RuntimeError, SystemCallError => e onoe e $stderr.puts e.backtrace if Homebrew.args.debug? - output_unsupported_error if Homebrew.args.HEAD? - exit 1 rescue MethodDeprecatedError => e onoe e diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index f0bafb577e..977d3bd06b 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -12,7 +12,16 @@ then then export LC_ALL="en_US.UTF-8" else - export LC_ALL="C.UTF-8" + locales=$(locale -a) + c_utf_regex='\bC\.(utf8|UTF-8)\b' + en_us_regex='\ben_US\.(utf8|UTF-8)\b' + utf_regex='\b[a-z][a-z]_[A-Z][A-Z]\.(utf8|UTF-8)\b' + if [[ $locales =~ $c_utf_regex || $locales =~ $en_us_regex || $locales =~ $utf_regex ]] + then + export LC_ALL=${BASH_REMATCH[0]} + else + export LC_ALL=C + fi fi fi @@ -327,6 +336,8 @@ fi for arg in "$@" do + [[ $arg = "--" ]] && break + if [[ $arg = "--help" || $arg = "-h" || $arg = "--usage" || $arg = "-?" ]] then export HOMEBREW_HELP="1" @@ -518,6 +529,7 @@ update-preinstall() { if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "bump-formula-pr" || + "$HOMEBREW_COMMAND" = "bundle" || "$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 || "$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]] then diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index f448995e09..d0ec6dacf7 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -83,20 +83,38 @@ class Build fixopt(dep) unless dep.opt_prefix.directory? end - ENV.activate_extensions!(args: args) + ENV.activate_extensions!(env: args.env) - if superenv?(args: args) + if superenv?(args.env) ENV.keg_only_deps = keg_only_deps ENV.deps = formula_deps ENV.run_time_deps = run_time_deps ENV.x11 = reqs.any? { |rq| rq.is_a?(X11Requirement) } - ENV.setup_build_environment(formula, args: args) + ENV.setup_build_environment( + formula: formula, + cc: args.cc, + build_bottle: args.build_bottle?, + bottle_arch: args.bottle_arch, + ) post_superenv_hacks - reqs.each { |req| req.modify_build_environment(args: args) } + reqs.each do |req| + req.modify_build_environment( + env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch, + ) + end deps.each(&:modify_build_environment) else - ENV.setup_build_environment(formula, args: args) - reqs.each { |req| req.modify_build_environment(args: args) } + ENV.setup_build_environment( + formula: formula, + cc: args.cc, + build_bottle: args.build_bottle?, + bottle_arch: args.bottle_arch, + ) + reqs.each do |req| + req.modify_build_environment( + env: args.env, cc: args.cc, build_bottle: args.build_bottle?, bottle_arch: args.bottle_arch, + ) + end deps.each(&:modify_build_environment) keg_only_deps.each do |dep| @@ -117,7 +135,7 @@ class Build } with_env(new_env) do - formula.extend(Debrew::Formula) if Homebrew.args.debug? + formula.extend(Debrew::Formula) if args.debug? formula.update_head_version @@ -190,7 +208,10 @@ class Build end begin + Homebrew.args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) + args = Homebrew.install_args.parse + error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) diff --git a/Library/Homebrew/cask/all.rb b/Library/Homebrew/cask/all.rb index 3a6e489a78..2b798d8cb5 100644 --- a/Library/Homebrew/cask/all.rb +++ b/Library/Homebrew/cask/all.rb @@ -9,7 +9,6 @@ require "cask/cache" require "cask/cask" require "cask/cask_loader" require "cask/caskroom" -require "cask/checkable" require "cask/cmd" require "cask/exceptions" require "cask/installer" diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index ce85fd6a65..272404635c 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -4,6 +4,7 @@ require "timeout" require "utils/user" require "cask/artifact/abstract_artifact" +require "cask/pkg" require "extend/hash_validator" using HashValidator diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index fbaff98c80..3a5fcae495 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "cask/denylist" -require "cask/checkable" require "cask/download" require "digest" require "utils/curl" @@ -10,7 +9,6 @@ require "utils/notability" module Cask class Audit - include Checkable extend Predicable attr_reader :cask, :commit_range, :download @@ -62,12 +60,56 @@ module Cask self end - def success? - !(errors? || warnings?) + def errors + @errors ||= [] end - def summary_header - "audit for #{cask}" + def warnings + @warnings ||= [] + end + + def add_error(message) + errors << message + end + + def add_warning(message) + warnings << message + end + + def errors? + errors.any? + end + + def warnings? + warnings.any? + end + + def result + if errors? + Formatter.error("failed") + elsif warnings? + Formatter.warning("warning") + else + Formatter.success("passed") + end + end + + def summary + summary = ["audit for #{cask}: #{result}"] + + errors.each do |error| + summary << " #{Formatter.error("-")} #{error}" + end + + warnings.each do |warning| + summary << " #{Formatter.warning("-")} #{warning}" + end + + summary.join("\n") + end + + def success? + !(errors? || warnings?) end private diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index 7abc4bb2c6..9ba9148e66 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -2,7 +2,6 @@ module Cask class Auditor - include Checkable extend Predicable def self.audit(cask, audit_download: false, audit_appcast: false, @@ -39,19 +38,28 @@ module Cask :audit_strict?, :audit_new_cask?, :audit_token_conflicts?, :quarantine? def audit + warnings = Set.new + errors = Set.new + if !Homebrew.args.value("language") && language_blocks - audit_all_languages + language_blocks.each_key do |l| + audit = audit_languages(l) + puts audit.summary + warnings += audit.warnings + errors += audit.errors + end else - audit_cask_instance(cask) + audit = audit_cask_instance(cask) + puts audit.summary + warnings += audit.warnings + errors += audit.errors end + + { warnings: warnings, errors: errors } end private - def audit_all_languages - language_blocks.keys.all?(&method(:audit_languages)) - end - def audit_languages(languages) ohai "Auditing language: #{languages.map { |lang| "'#{lang}'" }.to_sentence}" localized_cask = CaskLoader.load(cask.sourcefile_path) @@ -71,8 +79,7 @@ module Cask quarantine: quarantine?, commit_range: commit_range) audit.run! - puts audit.summary - audit.success? + audit end def language_blocks diff --git a/Library/Homebrew/cask/checkable.rb b/Library/Homebrew/cask/checkable.rb deleted file mode 100644 index 1e7a87464d..0000000000 --- a/Library/Homebrew/cask/checkable.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module Cask - module Checkable - def errors - @errors ||= [] - end - - def warnings - @warnings ||= [] - end - - def add_error(message) - errors << message - end - - def add_warning(message) - warnings << message - end - - def errors? - errors.any? - end - - def warnings? - warnings.any? - end - - def result - if errors? - Formatter.error("failed") - elsif warnings? - Formatter.warning("warning") - else - Formatter.success("passed") - end - end - - def summary - summary = ["#{summary_header}: #{result}"] - - errors.each do |error| - summary << " #{Formatter.error("-")} #{error}" - end - - warnings.each do |warning| - summary << " #{Formatter.warning("-")} #{warning}" - end - - summary.join("\n") - end - end -end diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 60abf6580a..63ae4c5fa1 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -87,6 +87,10 @@ module Cask @lookup.fetch(command_name, nil) end + def self.aliases + ALIASES + end + def self.run(*args) new(*args).run end diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index c2b94dba98..543c1a3c06 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -48,13 +48,15 @@ module Cask failed_casks = casks(alternative: -> { Cask.to_a }) .reject do |cask| odebug "Auditing Cask #{cask}" - Auditor.audit(cask, audit_download: download, - audit_appcast: appcast, - audit_online: online, - audit_strict: strict, - audit_new_cask: new_cask_arg?, - audit_token_conflicts: token_conflicts, - quarantine: quarantine?) + result = Auditor.audit(cask, audit_download: download, + audit_appcast: appcast, + audit_online: online, + audit_strict: strict, + audit_new_cask: new_cask_arg?, + audit_token_conflicts: token_conflicts, + quarantine: quarantine?) + + result[:warnings].empty? && result[:errors].empty? end return if failed_casks.empty? diff --git a/Library/Homebrew/cask/cmd/doctor.rb b/Library/Homebrew/cask/cmd/doctor.rb index cc5dbe3730..3ddc83ff51 100644 --- a/Library/Homebrew/cask/cmd/doctor.rb +++ b/Library/Homebrew/cask/cmd/doctor.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "system_config" -require "cask/checkable" require "diagnostic" module Cask diff --git a/Library/Homebrew/cask/cmd/internal_stanza.rb b/Library/Homebrew/cask/cmd/internal_stanza.rb index 20235e13af..106bd91560 100644 --- a/Library/Homebrew/cask/cmd/internal_stanza.rb +++ b/Library/Homebrew/cask/cmd/internal_stanza.rb @@ -32,12 +32,8 @@ module Cask option "--yaml", :yaml, false option "--inspect", :inspect, false - attr_accessor :format - + attr_accessor :format, :stanza private :format, :format= - - attr_accessor :stanza - private :stanza, :stanza= def initialize(*) diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index da5e4f56cb..6532f26c3a 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -47,7 +47,7 @@ module Cask upgradable_casks.each do |(old_cask, new_cask)| upgrade_cask(old_cask, new_cask) rescue => e - caught_exceptions << e + caught_exceptions << e.exception("#{new_cask.full_name}: #{e}") next end diff --git a/Library/Homebrew/cask_dependent.rb b/Library/Homebrew/cask_dependent.rb new file mode 100644 index 0000000000..96137a1a17 --- /dev/null +++ b/Library/Homebrew/cask_dependent.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# An adapter for casks to provide dependency information in a formula-like interface +class CaskDependent + def initialize(cask) + @cask = cask + end + + def name + @cask.token + end + + def full_name + @cask.full_name + end + + def runtime_dependencies + recursive_dependencies + end + + def deps + @deps ||= begin + @cask.depends_on.formula.map do |f| + Dependency.new f + end + end + end + + def requirements + @requirements ||= begin + requirements = [] + dsl_reqs = @cask.depends_on + + dsl_reqs.arch&.each do |arch| + requirements << ArchRequirement.new([:x86_64]) if arch[:bits] == 64 + requirements << ArchRequirement.new([arch[:type]]) + end + dsl_reqs.cask.each do |cask_ref| + requirements << Requirement.new([{ cask: cask_ref }]) + end + requirements << dsl_reqs.macos if dsl_reqs.macos + requirements << X11Requirement.new if dsl_reqs.x11 + + requirements + end + end + + def recursive_dependencies(&block) + Dependency.expand(self, &block) + end + + def recursive_requirements(&block) + Requirement.expand(self, &block) + end + + def any_version_installed? + @cask.installed? + end +end diff --git a/Library/Homebrew/cli/args.rb b/Library/Homebrew/cli/args.rb index cc7a571764..1253c71b0c 100644 --- a/Library/Homebrew/cli/args.rb +++ b/Library/Homebrew/cli/args.rb @@ -10,31 +10,27 @@ module Homebrew # undefine tap to allow --tap argument undef tap - def initialize(argv = ARGV.freeze, set_default_args: false) + def initialize super() @processed_options = [] - @options_only = args_options_only(argv) - @flags_only = args_flags_only(argv) + @options_only = [] + @flags_only = [] # Can set these because they will be overwritten by freeze_named_args! # (whereas other values below will only be overwritten if passed). - self[:named_args] = argv.reject { |arg| arg.start_with?("-") } + self[:named_args] = [] + self[:remaining] = [] + end - # Set values needed before Parser#parse has been run. - return unless set_default_args - - self[:build_from_source?] = argv.include?("--build-from-source") || argv.include?("-s") - self[:build_bottle?] = argv.include?("--build-bottle") - self[:force_bottle?] = argv.include?("--force-bottle") - self[:HEAD?] = argv.include?("--HEAD") - self[:devel?] = argv.include?("--devel") - self[:universal?] = argv.include?("--universal") + def freeze_remaining_args!(remaining_args) + self[:remaining] = remaining_args.freeze end def freeze_named_args!(named_args) # Reset cache values reliant on named_args @formulae = nil + @formulae_and_casks = nil @resolved_formulae = nil @resolved_formulae_casks = nil @formulae_paths = nil @@ -42,8 +38,7 @@ module Homebrew @kegs = nil @kegs_casks = nil - self[:named_args] = named_args - self[:named_args].freeze + self[:named_args] = named_args.freeze end def freeze_processed_options!(processed_options) @@ -53,12 +48,8 @@ module Homebrew @processed_options += processed_options @processed_options.freeze - @options_only = args_options_only(cli_args) - @flags_only = args_flags_only(cli_args) - end - - def passthrough - options_only - CLI::Parser.global_options.values.map(&:first).flatten + @options_only = cli_args.select { |a| a.start_with?("-") }.freeze + @flags_only = cli_args.select { |a| a.start_with?("--") }.freeze end def named @@ -69,32 +60,37 @@ module Homebrew named.blank? end - # If the user passes any flags that trigger building over installing from - # a bottle, they are collected here and returned as an Array for checking. - def collect_build_args - build_flags = [] - - build_flags << "--HEAD" if HEAD? - build_flags << "--universal" if build_universal? - build_flags << "--build-bottle" if build_bottle? - build_flags << "--build-from-source" if build_from_source? - - build_flags - end - def formulae require "formula" @formulae ||= (downcased_unique_named - casks).map do |name| - Formulary.factory(name, spec) + Formulary.factory(name, spec, force_bottle: force_bottle?, flags: flags_only) end.uniq(&:name).freeze end + def formulae_and_casks + @formulae_and_casks ||= begin + formulae_and_casks = [] + + downcased_unique_named.each do |name| + formulae_and_casks << Formulary.factory(name, spec) + rescue FormulaUnavailableError + begin + formulae_and_casks << Cask::CaskLoader.load(name) + rescue Cask::CaskUnavailableError + raise "No available formula or cask with the name \"#{name}\"" + end + end + + formulae_and_casks.freeze + end + end + def resolved_formulae require "formula" @resolved_formulae ||= (downcased_unique_named - casks).map do |name| - Formulary.resolve(name, spec: spec(nil)) + Formulary.resolve(name, spec: spec(nil), force_bottle: force_bottle?, flags: flags_only) end.uniq(&:name).freeze end @@ -104,7 +100,8 @@ module Homebrew casks = [] downcased_unique_named.each do |name| - resolved_formulae << Formulary.resolve(name, spec: spec(nil)) + resolved_formulae << Formulary.resolve(name, spec: spec(nil), + force_bottle: force_bottle?, flags: flags_only) rescue FormulaUnavailableError begin casks << Cask::CaskLoader.load(name) @@ -162,18 +159,20 @@ module Homebrew !(HEAD? || devel?) end - # Whether a given formula should be built from source during the current - # installation run. - def build_formula_from_source?(f) - return false if !build_from_source? && !build_bottle? - - formulae.any? { |args_f| args_f.full_name == f.full_name } + def build_from_source_formulae + if build_from_source? || build_bottle? + formulae.map(&:full_name) + else + [] + end end - def include_formula_test_deps?(f) - return false unless include_test? - - formulae.any? { |args_f| args_f.full_name == f.full_name } + def include_test_formulae + if include_test? + formulae.map(&:full_name) + else + [] + end end def value(name) @@ -210,16 +209,6 @@ module Homebrew @cli_args.freeze end - def args_options_only(args) - args.select { |arg| arg.start_with?("-") } - .freeze - end - - def args_flags_only(args) - args.select { |arg| arg.start_with?("--") } - .freeze - end - def downcased_unique_named # Only lowercase names, not paths, bottle filenames or URLs named.map do |arg| diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index e48cafab01..7d414e07d0 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -13,10 +13,6 @@ module Homebrew class Parser attr_reader :processed_options, :hide_from_man_page - def self.parse(argv = ARGV.freeze, allow_no_named_args: false, &block) - new(argv, &block).parse(allow_no_named_args: allow_no_named_args) - end - def self.from_cmd_path(cmd_path) cmd_args_method_name = Commands.args_method_name(cmd_path) @@ -30,18 +26,17 @@ module Homebrew end def self.global_options - { - quiet: [["-q", "--quiet"], :quiet, "Suppress any warnings."], - verbose: [["-v", "--verbose"], :verbose, "Make some output more verbose."], - debug: [["-d", "--debug"], :debug, "Display any debugging information."], - force: [["-f", "--force"], :force, "Override warnings and enable potentially unsafe operations."], - } + [ + ["-q", "--quiet", "Suppress any warnings."], + ["-v", "--verbose", "Make some output more verbose."], + ["-d", "--debug", "Display any debugging information."], + ] end - def initialize(argv = ARGV.freeze, &block) + def initialize(&block) @parser = OptionParser.new - @argv = argv - @args = Homebrew::CLI::Args.new(@argv) + + @args = Homebrew::CLI::Args.new @constraints = [] @conflicts = [] @@ -51,25 +46,32 @@ module Homebrew @min_named_args = nil @min_named_type = nil @hide_from_man_page = false - instance_eval(&block) + @formula_options = false + + self.class.global_options.each do |short, long, desc| + switch short, long, description: desc, env: option_to_name(long) + end + + instance_eval(&block) if block_given? + post_initialize end def post_initialize + # Disable default handling of `--version` switch. + @parser.base.long.delete("version") + + # Disable default handling of `--help` switch. @parser.on_tail("-h", "--help", "Show this message.") do - puts generate_help_text - exit 0 + # Handled in `brew.rb`. end end def switch(*names, description: nil, env: nil, required_for: nil, depends_on: nil) global_switch = names.first.is_a?(Symbol) - names, env, default_description = common_switch(*names) if global_switch - if description.nil? && global_switch - description = default_description - elsif description.nil? - description = option_to_description(*names) - end + return if global_switch + + description = option_to_description(*names) if description.nil? process_option(*names, description) @parser.on(*names, *wrap_option_desc(description)) do enable_switch(*names, from: :args) @@ -154,31 +156,83 @@ module Homebrew @parser.to_s end - def parse(argv = @argv, allow_no_named_args: false) - raise "Arguments were already parsed!" if @args_parsed + def parse_remaining(argv, ignore_invalid_options: false) + i = 0 + remaining = [] - begin - named_args = @parser.parse(argv) - rescue OptionParser::InvalidOption => e - $stderr.puts generate_help_text - raise e + argv, non_options = split_non_options(argv) + + while i < argv.count + begin + begin + arg = argv[i] + + remaining << arg unless @parser.parse([arg]).empty? + rescue OptionParser::MissingArgument + raise if i + 1 >= argv.count + + args = argv[i..(i + 1)] + @parser.parse(args) + i += 1 + end + rescue OptionParser::InvalidOption + if ignore_invalid_options + remaining << arg + else + $stderr.puts generate_help_text + raise + end + end + + i += 1 end - check_constraint_violations - check_named_args(named_args, allow_no_named_args: allow_no_named_args) + [remaining, non_options] + end + + def parse(argv = ARGV.freeze, ignore_invalid_options: false) + raise "Arguments were already parsed!" if @args_parsed + + # If we accept formula options, parse once allowing invalid options + # so we can get the remaining list containing formula names. + if @formula_options + remaining, non_options = parse_remaining(argv, ignore_invalid_options: true) + + argv = [*remaining, "--", *non_options] + + formulae(argv).each do |f| + next if f.options.empty? + + f.options.each do |o| + name = o.flag + description = "`#{f.name}`: #{o.description}" + if name.end_with? "=" + flag name, description: description + else + switch name, description: description + end + end + end + end + + remaining, non_options = parse_remaining(argv, ignore_invalid_options: ignore_invalid_options) + + named_args = if ignore_invalid_options + [] + else + remaining + non_options + end + + check_constraint_violations unless ignore_invalid_options + check_named_args(named_args) unless ignore_invalid_options @args.freeze_named_args!(named_args) + @args.freeze_remaining_args!(non_options.empty? ? remaining : [*remaining, "--", non_options]) @args.freeze_processed_options!(@processed_options) - Homebrew.args = @args @args_parsed = true @args end - def global_option?(name, desc) - Homebrew::CLI::Parser.global_options.key?(name.to_sym) && - Homebrew::CLI::Parser.global_options[name.to_sym].last == desc - end - def generate_help_text @parser.to_s .sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") @@ -189,21 +243,7 @@ module Homebrew end def formula_options - formulae.each do |f| - next if f.options.empty? - - f.options.each do |o| - name = o.flag - description = "`#{f.name}`: #{o.description}" - if name.end_with? "=" - flag name, description: description - else - switch name, description: description - end - end - end - rescue FormulaUnavailableError - [] + @formula_options = true end def max_named(count) @@ -257,11 +297,6 @@ module Homebrew end end - # These are common/global switches accessible throughout Homebrew - def common_switch(name) - Homebrew::CLI::Parser.global_options.fetch(name, name) - end - def option_passed?(name) @args[name.to_sym] || @args["#{name}?".to_sym] end @@ -329,8 +364,10 @@ module Homebrew check_constraints end - def check_named_args(args, allow_no_named_args: false) + def check_named_args(args) min_exception = case @min_named_type + when :cask + Cask::CaskUnspecifiedError.new when :formula FormulaUnspecifiedError.new when :keg @@ -338,8 +375,8 @@ module Homebrew else MinNamedArgumentsError.new(@min_named_args) end - raise min_exception if !allow_no_named_args && !@min_named_args.nil? && args.size < @min_named_args - raise MaxNamedArgumentsError, @max_named_args if !@max_named_args.nil? && args.size > @max_named_args + raise min_exception if @min_named_args && args.size < @min_named_args + raise MaxNamedArgumentsError, @max_named_args if @max_named_args && args.size > @max_named_args end def process_option(*args) @@ -347,11 +384,21 @@ module Homebrew @processed_options << [option.short.first, option.long.first, option.arg, option.desc.first] end - def formulae - named_args = @argv.reject { |arg| arg.start_with?("-") } - spec = if @argv.include?("--HEAD") + def split_non_options(argv) + if sep = argv.index("--") + [argv.take(sep), argv.drop(sep + 1)] + else + [argv, []] + end + end + + def formulae(argv) + argv, non_options = split_non_options(argv) + + named_args = argv.reject { |arg| arg.start_with?("-") } + non_options + spec = if argv.include?("--HEAD") :head - elsif @argv.include?("--devel") + elsif argv.include?("--devel") :devel else :stable @@ -361,7 +408,11 @@ module Homebrew named_args.map do |arg| next if arg.match?(HOMEBREW_CASK_TAP_CASK_REGEX) - Formulary.factory(arg, spec) + begin + Formulary.factory(arg, spec, flags: argv.select { |a| a.start_with?("--") }) + rescue FormulaUnavailableError + nil + end end.compact.uniq(&:name) end end diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index 191f018c3f..bd6018efe4 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -33,13 +33,13 @@ module Homebrew end def __cache - __cache_args.parse + args = __cache_args.parse if args.no_named? puts HOMEBREW_CACHE elsif args.formula? args.named.each do |name| - print_formula_cache name + print_formula_cache name, args: args end elsif args.cask? args.named.each do |name| @@ -47,7 +47,7 @@ module Homebrew end else args.named.each do |name| - print_formula_cache name + print_formula_cache name, args: args rescue FormulaUnavailableError begin print_cask_cache name @@ -58,9 +58,9 @@ module Homebrew end end - def print_formula_cache(name) - formula = Formulary.factory name - if fetch_bottle?(formula) + def print_formula_cache(name, args:) + formula = Formulary.factory(name, force_bottle: args.force_bottle?, flags: args.flags_only) + if fetch_bottle?(formula, args: args) puts formula.bottle.cached_download else puts formula.cached_download diff --git a/Library/Homebrew/cmd/--cellar.rb b/Library/Homebrew/cmd/--cellar.rb index 4b1367cf67..7ef1b6fc39 100644 --- a/Library/Homebrew/cmd/--cellar.rb +++ b/Library/Homebrew/cmd/--cellar.rb @@ -20,7 +20,7 @@ module Homebrew end def __cellar - __cellar_args.parse + args = __cellar_args.parse if args.no_named? puts HOMEBREW_CELLAR diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb index ad97d80d13..7586631754 100644 --- a/Library/Homebrew/cmd/--env.rb +++ b/Library/Homebrew/cmd/--env.rb @@ -29,9 +29,9 @@ module Homebrew def __env args = __env_args.parse - ENV.activate_extensions!(args: args) - ENV.deps = args.formulae if superenv?(args: args) - ENV.setup_build_environment(args: args) + ENV.activate_extensions!(env: args.env) + ENV.deps = args.formulae if superenv?(args.env) + ENV.setup_build_environment shell = if args.plain? nil diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb index 5269e38d9e..82a0b464a8 100644 --- a/Library/Homebrew/cmd/--prefix.rb +++ b/Library/Homebrew/cmd/--prefix.rb @@ -20,7 +20,7 @@ module Homebrew end def __prefix - __prefix_args.parse + args = __prefix_args.parse if args.no_named? puts HOMEBREW_PREFIX diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index 8e27a8def4..211f1c0c2f 100644 --- a/Library/Homebrew/cmd/--repository.rb +++ b/Library/Homebrew/cmd/--repository.rb @@ -18,7 +18,7 @@ module Homebrew end def __repository - __repository_args.parse + args = __repository_args.parse if args.no_named? puts HOMEBREW_REPOSITORY diff --git a/Library/Homebrew/cmd/analytics.rb b/Library/Homebrew/cmd/analytics.rb index 1e641e7214..4c8ef458f7 100644 --- a/Library/Homebrew/cmd/analytics.rb +++ b/Library/Homebrew/cmd/analytics.rb @@ -22,14 +22,12 @@ module Homebrew `brew analytics regenerate-uuid`: Regenerate the UUID used for Homebrew's analytics. EOS - switch :verbose - switch :debug max_named 1 end end def analytics - analytics_args.parse + args = analytics_args.parse case args.named.first when nil, "state" diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 3f8481c8e6..510b872f03 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -27,13 +27,11 @@ module Homebrew "If you want to delete those too: `rm -rf \"$(brew --cache)\"`" switch "--prune-prefix", description: "Only prune the symlinks and directories from the prefix and remove no other files." - switch :verbose - switch :debug end end def cleanup - cleanup_args.parse + args = cleanup_args.parse cleanup = Cleanup.new(*args.named, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i) if args.prune_prefix? diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 7dcc7509cd..29fd687555 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -12,33 +12,39 @@ module Homebrew Show lists of built-in and external commands. EOS - switch :quiet, + switch "-q", "--quiet", description: "List only the names of commands without category headers." switch "--include-aliases", depends_on: "--quiet", description: "Include aliases of internal commands." - switch :verbose - switch :debug + max_named 0 end end def commands - commands_args.parse + args = commands_args.parse if args.quiet? puts Formatter.columns(Commands.commands(aliases: args.include_aliases?)) return end - ohai "Built-in commands", Formatter.columns(Commands.internal_commands) - puts - ohai "Built-in developer commands", Formatter.columns(Commands.internal_developer_commands) + prepend_separator = false - external_commands = Commands.external_commands - return if external_commands.blank? + { + "Built-in commands" => Commands.internal_commands, + "Built-in developer commands" => Commands.internal_developer_commands, + "External commands" => Commands.external_commands, + "Cask commands" => Commands.cask_internal_commands, + "External cask commands" => Commands.cask_external_commands, + }.each do |title, commands| + next if commands.blank? - puts - ohai "External commands", Formatter.columns(external_commands) + puts if prepend_separator + ohai title, Formatter.columns(commands) + + prepend_separator ||= true + end end end diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index a95ab42f6f..d0519bf4ac 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -14,8 +14,7 @@ module Homebrew Show Homebrew and system configuration info useful for debugging. If you file a bug report, you will be required to provide this information. EOS - switch :verbose - switch :debug + max_named 0 end end diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 03412059f9..4cb93befde 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -3,6 +3,8 @@ require "formula" require "ostruct" require "cli/parser" +require "cask/caskroom" +require "dependencies_helpers" module Homebrew extend DependenciesHelpers @@ -51,67 +53,73 @@ module Homebrew description: "Switch into the mode used by the `--all` option, but only list dependencies "\ "for each provided , one formula per line. This is used for "\ "debugging the `--installed`/`--all` display mode." - switch :verbose - switch :debug + conflicts "--installed", "--all" formula_options end end def deps - deps_args.parse + args = deps_args.parse Formulary.enable_factory_cache! recursive = !args.send("1?") - installed = args.installed? || args.formulae.all?(&:opt_or_installed_prefix_keg) + installed = args.installed? || dependents(args.formulae_and_casks).all?(&:any_version_installed?) @use_runtime_dependencies = installed && recursive && + !args.tree? && !args.include_build? && !args.include_test? && !args.include_optional? && !args.skip_recommended? if args.tree? - if args.installed? - puts_deps_tree Formula.installed.sort, recursive + dependents = if args.named.present? + sorted_dependents(args.formulae_and_casks) + elsif args.installed? + sorted_dependents(Formula.installed + Cask::Caskroom.casks) else - raise FormulaUnspecifiedError if args.no_named? - - puts_deps_tree args.formulae, recursive + raise FormulaUnspecifiedError end + + puts_deps_tree dependents, recursive, args: args return elsif args.all? - puts_deps Formula.sort, recursive + puts_deps sorted_dependents(Formula.to_a + Cask::Cask.to_a), recursive, args: args return elsif !args.no_named? && args.for_each? - puts_deps args.formulae, recursive + puts_deps sorted_dependents(args.formulae_and_casks), recursive, args: args return end if args.no_named? raise FormulaUnspecifiedError unless args.installed? - puts_deps Formula.installed.sort, recursive + puts_deps sorted_dependents(Formula.installed + Cask::Caskroom.casks), recursive return end - all_deps = deps_for_formulae(args.formulae, recursive, &(args.union? ? :| : :&)) - all_deps = condense_requirements(all_deps) - all_deps.select!(&:installed?) if args.installed? - all_deps.map!(&method(:dep_display_name)) + dependents = dependents(args.formulae_and_casks) + + all_deps = deps_for_dependents(dependents, recursive, args: args, &(args.union? ? :| : :&)) + condense_requirements(all_deps, args: args) + all_deps.map! { |d| dep_display_name(d, args: args) } all_deps.uniq! all_deps.sort! unless args.n? puts all_deps end - def condense_requirements(deps) - return deps if args.include_requirements? - - deps.select { |dep| dep.is_a? Dependency } + def sorted_dependents(formulae_or_casks) + dependents(formulae_or_casks).sort_by(&:name) end - def dep_display_name(dep) + def condense_requirements(deps, args:) + deps.select! { |dep| dep.is_a?(Dependency) } unless args.include_requirements? + deps.select! { |dep| dep.is_a?(Requirement) || dep.installed? } if args.installed? + end + + def dep_display_name(dep, args:) str = if dep.is_a? Requirement if args.include_requirements? ":#{dep.display_s}" @@ -136,47 +144,47 @@ module Homebrew str end - def deps_for_formula(f, recursive = false) - includes, ignores = argv_includes_ignores(ARGV) + def deps_for_dependent(d, recursive = false, args:) + includes, ignores = args_includes_ignores(args) - deps = f.runtime_dependencies if @use_runtime_dependencies + deps = d.runtime_dependencies if @use_runtime_dependencies if recursive - deps ||= recursive_includes(Dependency, f, includes, ignores) - reqs = recursive_includes(Requirement, f, includes, ignores) + deps ||= recursive_includes(Dependency, d, includes, ignores) + reqs = recursive_includes(Requirement, d, includes, ignores) else - deps ||= reject_ignores(f.deps, ignores, includes) - reqs = reject_ignores(f.requirements, ignores, includes) + deps ||= reject_ignores(d.deps, ignores, includes) + reqs = reject_ignores(d.requirements, ignores, includes) end deps + reqs.to_a end - def deps_for_formulae(formulae, recursive = false, &block) - formulae.map { |f| deps_for_formula(f, recursive) }.reduce(&block) + def deps_for_dependents(dependents, recursive = false, args:, &block) + dependents.map { |d| deps_for_dependent(d, recursive, args: args) }.reduce(&block) end - def puts_deps(formulae, recursive = false) - formulae.each do |f| - deps = deps_for_formula(f, recursive) - deps = condense_requirements(deps) + def puts_deps(dependents, recursive = false, args:) + dependents.each do |dependent| + deps = deps_for_dependent(dependent, recursive, args: args) + condense_requirements(deps, args: args) deps.sort_by!(&:name) - deps.map!(&method(:dep_display_name)) - puts "#{f.full_name}: #{deps.join(" ")}" + deps.map! { |d| dep_display_name(d, args: args) } + puts "#{dependent.full_name}: #{deps.join(" ")}" end end - def puts_deps_tree(formulae, recursive = false) - formulae.each do |f| - puts f.full_name + def puts_deps_tree(dependents, recursive = false, args:) + dependents.each do |d| + puts d.full_name @dep_stack = [] - recursive_deps_tree(f, "", recursive) + recursive_deps_tree(d, "", recursive, args: args) puts end end - def recursive_deps_tree(f, prefix, recursive) - includes, ignores = argv_includes_ignores(ARGV) + def recursive_deps_tree(f, prefix, recursive, args:) + includes, ignores = args_includes_ignores(args) dependables = @use_runtime_dependencies ? f.runtime_dependencies : f.deps deps = reject_ignores(dependables, ignores, includes) reqs = reject_ignores(f.requirements, ignores, includes) @@ -193,7 +201,7 @@ module Homebrew "├──" end - display_s = "#{tree_lines} #{dep_display_name(dep)}" + display_s = "#{tree_lines} #{dep_display_name(dep, args: args)}" is_circular = @dep_stack.include?(dep.name) display_s = "#{display_s} (CIRCULAR DEPENDENCY)" if is_circular puts "#{prefix}#{display_s}" @@ -206,7 +214,9 @@ module Homebrew "│ " end - recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true) if dep.is_a? Dependency + if dep.is_a? Dependency + recursive_deps_tree(Formulary.factory(dep.name), prefix + prefix_addition, true, args: args) + end end @dep_stack.pop diff --git a/Library/Homebrew/cmd/desc.rb b/Library/Homebrew/cmd/desc.rb index ce505aaa0f..bd5c669459 100644 --- a/Library/Homebrew/cmd/desc.rb +++ b/Library/Homebrew/cmd/desc.rb @@ -28,14 +28,14 @@ module Homebrew switch "-d", "--description", description: "Search just descriptions for . If is flanked by slashes, "\ "it is interpreted as a regular expression." - switch :verbose + conflicts "--search", "--name", "--description" min_named 1 end end def desc - desc_args.parse + args = desc_args.parse search_type = if args.search? :either diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 7fc4208926..24da404e6c 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -23,13 +23,11 @@ module Homebrew "if provided as arguments." switch "-D", "--audit-debug", description: "Enable debugging and profiling of audit methods." - switch :verbose - switch :debug end end def doctor - doctor_args.parse + args = doctor_args.parse inject_dump_stats!(Diagnostic::Checks, /^check_*/) if args.audit_debug? diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 362af7506a..93fb6ff6b9 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -21,9 +21,9 @@ module Homebrew description: "Fetch HEAD version instead of stable version." switch "--devel", description: "Fetch development version instead of stable version." - switch :force, + switch "-f", "--force", description: "Remove a previously cached version and re-fetch." - switch :verbose, + switch "-v", "--verbose", description: "Do a verbose VCS checkout, if the URL represents a VCS. This is useful for "\ "seeing if an existing VCS cache has been updated." switch "--retry", @@ -38,7 +38,7 @@ module Homebrew switch "--force-bottle", description: "Download a bottle if it exists for the current or newest version of macOS, "\ "even if it would not be used during installation." - switch :debug + conflicts "--devel", "--HEAD" conflicts "--build-from-source", "--build-bottle", "--force-bottle" min_named :formula @@ -46,7 +46,7 @@ module Homebrew end def fetch - fetch_args.parse + args = fetch_args.parse if args.deps? bucket = [] @@ -64,9 +64,9 @@ module Homebrew f.print_tap_action verb: "Fetching" fetched_bottle = false - if fetch_bottle?(f) + if fetch_bottle?(f, args: args) begin - fetch_formula(f.bottle) + fetch_formula(f.bottle, args: args) rescue Interrupt raise rescue => e @@ -82,40 +82,40 @@ module Homebrew next if fetched_bottle - fetch_formula(f) + fetch_formula(f, args: args) f.resources.each do |r| - fetch_resource(r) - r.patches.each { |p| fetch_patch(p) if p.external? } + fetch_resource(r, args: args) + r.patches.each { |p| fetch_patch(p, args: args) if p.external? } end - f.patchlist.each { |p| fetch_patch(p) if p.external? } + f.patchlist.each { |p| fetch_patch(p, args: args) if p.external? } end end - def fetch_resource(r) + def fetch_resource(r, args:) puts "Resource: #{r.name}" - fetch_fetchable r + fetch_fetchable r, args: args rescue ChecksumMismatchError => e - retry if retry_fetch? r + retry if retry_fetch?(r, args: args) opoo "Resource #{r.name} reports different #{e.hash_type}: #{e.expected}" end - def fetch_formula(f) - fetch_fetchable f + def fetch_formula(f, args:) + fetch_fetchable f, args: args rescue ChecksumMismatchError => e - retry if retry_fetch? f + retry if retry_fetch?(f, args: args) opoo "Formula reports different #{e.hash_type}: #{e.expected}" end - def fetch_patch(p) - fetch_fetchable p + def fetch_patch(p, args:) + fetch_fetchable p, args: args rescue ChecksumMismatchError => e Homebrew.failed = true opoo "Patch reports different #{e.hash_type}: #{e.expected}" end - def retry_fetch?(f) + def retry_fetch?(f, args:) @fetch_failed ||= Set.new if args.retry? && @fetch_failed.add?(f) ohai "Retrying download" @@ -127,7 +127,7 @@ module Homebrew end end - def fetch_fetchable(f) + def fetch_fetchable(f, args:) f.clear_cache if args.force? already_fetched = f.cached_download.exist? @@ -135,7 +135,7 @@ module Homebrew begin download = f.fetch(verify_download_integrity: false) rescue DownloadError - retry if retry_fetch? f + retry if retry_fetch?(f, args: args) raise end diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index 346ee8ab6e..b4b49660c1 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -8,6 +8,8 @@ require "socket" require "cli/parser" module Homebrew + extend Install + module_function def gist_logs_args @@ -26,13 +28,12 @@ module Homebrew switch "-p", "--private", description: "The Gist will be marked private and will not appear in listings but will "\ "be accessible with its link." - switch :verbose - switch :debug + named :formula end end - def gistify_logs(f) + def gistify_logs(f, args:) files = load_logs(f.logs) build_time = f.logs.ctime timestamp = build_time.strftime("%Y-%m-%d_%H-%M-%S") @@ -40,7 +41,7 @@ module Homebrew s = StringIO.new SystemConfig.dump_verbose_config s # Dummy summary file, asciibetically first, to control display title of gist - files["# #{f.name} - #{timestamp}.txt"] = { content: brief_build_info(f) } + files["# #{f.name} - #{timestamp}.txt"] = { content: brief_build_info(f, with_hostname: args.with_hostname?) } files["00.config.out"] = { content: s.string } files["00.doctor.out"] = { content: Utils.popen_read("#{HOMEBREW_PREFIX}/bin/brew", "doctor", err: :out) } unless f.core_formula? @@ -68,19 +69,19 @@ module Homebrew else "#{f.name} (#{f.full_name}) on #{OS_VERSION} - Homebrew build logs" end - url = create_gist(files, descr) + url = create_gist(files, descr, private: args.private?) url = create_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url) if args.new_issue? puts url if url end - def brief_build_info(f) + def brief_build_info(f, with_hostname:) build_time_str = f.logs.ctime.strftime("%Y-%m-%d %H:%M:%S") s = +<<~EOS Homebrew build logs for #{f.full_name} on #{OS_VERSION} EOS - if args.with_hostname? + if with_hostname hostname = Socket.gethostname s << "Host: #{hostname}\n" end @@ -121,13 +122,9 @@ module Homebrew logs end - def create_private? - args.private? - end - - def create_gist(files, description) + def create_gist(files, description, private:) url = "https://api.github.com/gists" - data = { "public" => !create_private?, "files" => files, "description" => description } + data = { "public" => !private, "files" => files, "description" => description } scopes = GitHub::CREATE_GIST_SCOPES GitHub.open_api(url, data: data, scopes: scopes)["html_url"] end @@ -140,10 +137,10 @@ module Homebrew end def gist_logs - gist_logs_args.parse + args = gist_logs_args.parse Install.perform_preinstall_checks(all_fatal: true) Install.perform_build_from_source_checks(all_fatal: true) - gistify_logs(args.resolved_formulae.first) + gistify_logs(args.resolved_formulae.first, args: args) end end diff --git a/Library/Homebrew/cmd/home.rb b/Library/Homebrew/cmd/home.rb index e567febfab..8b37d3810c 100644 --- a/Library/Homebrew/cmd/home.rb +++ b/Library/Homebrew/cmd/home.rb @@ -15,12 +15,11 @@ module Homebrew Open 's homepage in a browser, or open Homebrew's own homepage if no formula is provided. EOS - switch :debug end end def home - home_args.parse + args = home_args.parse if args.no_named? exec_browser HOMEBREW_WWW diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index bcd8a71e3a..d975d131f9 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -52,15 +52,15 @@ module Homebrew switch "--all", depends_on: "--json", description: "Print JSON of all available formulae." - switch :verbose, + switch "-v", "--verbose", description: "Show more verbose analytics data for ." - switch :debug + conflicts "--installed", "--all" end end def info - info_args.parse + args = info_args.parse if args.days.present? raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days) @@ -83,17 +83,17 @@ module Homebrew raise FormulaUnspecifiedError if args.no_named? end - print_json + print_json(args: args) elsif args.github? raise FormulaUnspecifiedError if args.no_named? exec_browser(*args.formulae.map { |f| github_info(f) }) else - print_info + print_info(args: args) end end - def print_info + def print_info(args:) if args.no_named? if args.analytics? Utils::Analytics.output(args: args) @@ -126,7 +126,7 @@ module Homebrew end end - def print_json + def print_json(args:) ff = if args.all? Formula.sort elsif args.installed? @@ -211,7 +211,7 @@ module Homebrew puts "From: #{Formatter.url(github_info(f))}" - puts "License: #{f.license}" if f.license + puts "License: #{f.license.join(", ")}" if f.license unless f.deps.empty? ohai "Dependencies" @@ -256,7 +256,7 @@ module Homebrew def decorate_requirements(requirements) req_status = requirements.map do |req| req_s = req.display_s - req.satisfied?(args: args) ? pretty_installed(req_s) : pretty_uninstalled(req_s) + req.satisfied? ? pretty_installed(req_s) : pretty_uninstalled(req_s) end req_status.join(", ") end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 34c33d71fa..607e69ec92 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -10,10 +10,10 @@ require "cli/parser" require "upgrade" module Homebrew - module_function - extend Search + module_function + def install_args Homebrew::CLI::Parser.new do usage_banner <<~EOS @@ -24,7 +24,7 @@ module Homebrew Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the installed formulae or, every 30 days, for all formulae. EOS - switch :debug, + switch "-d", "--debug", description: "If brewing fails, open an interactive debugging session with access to IRB "\ "or a shell inside the temporary build directory." flag "--env=", @@ -71,10 +71,10 @@ module Homebrew depends_on: "--build-bottle", description: "Optimise bottles for the specified architecture rather than the oldest "\ "architecture supported by the version of macOS the bottles are built on." - switch :force, + switch "-f", "--force", description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." - switch :verbose, + switch "-v", "--verbose", description: "Print the verification and postinstall steps." switch "--display-times", env: :display_install_times, @@ -115,13 +115,13 @@ module Homebrew formulae = [] - unless Homebrew.args.casks.empty? + unless args.casks.empty? cask_args = [] cask_args << "--force" if args.force? cask_args << "--debug" if args.debug? cask_args << "--verbose" if args.verbose? - Homebrew.args.casks.each do |c| + args.casks.each do |c| ohai "brew cask install #{c} #{cask_args.join " "}" system("#{HOMEBREW_PREFIX}/bin/brew", "cask", "install", c, *cask_args) end @@ -129,7 +129,7 @@ module Homebrew # if the user's flags will prevent bottle only-installations when no # developer tools are available, we need to stop them early on - FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? + FormulaInstaller.prevent_build_flags(args) args.formulae.each do |f| # head-only without --HEAD is an error @@ -255,17 +255,17 @@ module Homebrew return if formulae.empty? - Install.perform_preinstall_checks + Install.perform_preinstall_checks(cc: args.cc) formulae.each do |f| - Migrator.migrate_if_needed(f) - install_formula(f) + Migrator.migrate_if_needed(f, force: args.force?) + install_formula(f, args: args) Cleanup.install_formula_clean!(f) end check_installed_dependents(args: args) - Homebrew.messages.display_messages + Homebrew.messages.display_messages(display_times: args.display_times?) rescue FormulaUnreadableError, FormulaClassUnavailableError, TapFormulaUnreadableError, TapFormulaClassUnavailableError => e # Need to rescue before `FormulaUnavailableError` (superclass of this) @@ -319,12 +319,13 @@ module Homebrew end end - def install_formula(f) + def install_formula(f, args:) f.print_tap_action build_options = f.build - fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, - build_from_source: args.build_from_source?) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, + include_test_formulae: args.include_test_formulae, + build_from_source_formulae: args.build_from_source_formulae) fi.options = build_options.used_options fi.env = args.env fi.force = args.force? diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb index be4fcdf559..1768227b79 100644 --- a/Library/Homebrew/cmd/leaves.rb +++ b/Library/Homebrew/cmd/leaves.rb @@ -14,7 +14,7 @@ module Homebrew List installed formulae that are not dependencies of another installed formula. EOS - switch :debug + max_named 0 end end diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 9cb622dacf..25719e29a8 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -21,16 +21,15 @@ module Homebrew switch "-n", "--dry-run", description: "List files which would be linked or deleted by "\ "`brew link --overwrite` without actually linking or deleting any files." - switch :force, + switch "-f", "--force", description: "Allow keg-only formulae to be linked." - switch :verbose - switch :debug + min_named :keg end end def link - link_args.parse + args = link_args.parse mode = OpenStruct.new diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 6dda14d46a..4948c173c5 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -45,16 +45,15 @@ module Homebrew description: "Reverse the order of the sort to list the oldest entries first." switch "-t", description: "Sort by time modified, listing most recently modified first." - switch :verbose - switch :debug + ["--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each { |flag| conflicts "--cask", flag } end end def list - list_args.parse + args = list_args.parse - return list_casks if args.cask? + return list_casks(args: args) if args.cask? return list_unbrewed if args.unbrewed? @@ -67,7 +66,7 @@ module Homebrew end if args.pinned? || args.versions? - filtered_list + filtered_list args: args elsif args.no_named? if args.full_name? full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison) @@ -76,7 +75,14 @@ module Homebrew puts Formatter.columns(full_names) else ENV["CLICOLOR"] = nil - safe_system "ls", *args.passthrough << HOMEBREW_CELLAR + + ls_args = [] + ls_args << "-1" if args.public_send(:'1?') + ls_args << "-l" if args.l? + ls_args << "-r" if args.r? + ls_args << "-t" if args.t? + + safe_system "ls", *ls_args, HOMEBREW_CELLAR end elsif args.verbose? || !$stdout.tty? system_command! "find", args: args.kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true @@ -128,7 +134,7 @@ module Homebrew safe_system "find", *arguments end - def filtered_list + def filtered_list(args:) names = if args.no_named? Formula.racks else @@ -157,9 +163,9 @@ module Homebrew end end - def list_casks + def list_casks(args:) cask_list = Cask::Cmd::List.new args.named - cask_list.one = ARGV.include? "-1" + cask_list.one = args.public_send(:'1?') cask_list.versions = args.versions? cask_list.full_name = args.full_name? cask_list.run diff --git a/Library/Homebrew/cmd/log.rb b/Library/Homebrew/cmd/log.rb index ffee96f468..03200a7539 100644 --- a/Library/Homebrew/cmd/log.rb +++ b/Library/Homebrew/cmd/log.rb @@ -20,14 +20,17 @@ module Homebrew description: "Also print diffstat from commit." switch "--oneline", description: "Print only one line per commit." - flag "-1", "--max-count", - description: "Print only one or a specified number of commits." + switch "-1", + description: "Print only one commit." + flag "-n", "--max-count=", + description: "Print only a specified number of commits." max_named 1 + conflicts "-1", "--max-count" end end def log - log_args.parse + args = log_args.parse # As this command is simplifying user-run commands then let's just use a # user path, too. @@ -38,11 +41,11 @@ module Homebrew else path = Formulary.path(args.named.first) tap = Tap.from_path(path) - git_log path.dirname, path, tap + git_log path.dirname, path, tap, args: args end end - def git_log(cd_dir, path = nil, tap = nil) + def git_log(cd_dir, path = nil, tap = nil, args:) cd cd_dir repo = Utils.popen_read("git rev-parse --show-toplevel").chomp if tap @@ -62,8 +65,14 @@ module Homebrew git -C "#{git_cd}" fetch --unshallow EOS end - system_args = args.options_only - system_args += ["--follow", "--", path] if path.present? - system "git", "log", *system_args + + git_args = [] + git_args << "--patch" if args.patch? + git_args << "--stat" if args.stat? + git_args << "--oneline" if args.oneline? + git_args << "-1" if args.public_send(:'1?') + git_args << "--max-count" << args.max_count if args.max_count + git_args += ["--follow", "--", path] if path.present? + system "git", "log", *git_args end end diff --git a/Library/Homebrew/cmd/migrate.rb b/Library/Homebrew/cmd/migrate.rb index e7d285479a..c6f12d7831 100644 --- a/Library/Homebrew/cmd/migrate.rb +++ b/Library/Homebrew/cmd/migrate.rb @@ -14,17 +14,16 @@ module Homebrew Migrate renamed packages to new names, where are old names of packages. EOS - switch :force, + switch "-f", "--force", description: "Treat installed and provided as if they are from "\ "the same taps and migrate them anyway." - switch :verbose - switch :debug + min_named :formula end end def migrate - migrate_args.parse + args = migrate_args.parse args.resolved_formulae.each do |f| if f.oldname @@ -34,7 +33,7 @@ module Homebrew raise "#{rack} is a symlink" if rack.symlink? end - migrator = Migrator.new(f) + migrator = Migrator.new(f, force: args.force?) migrator.migrate end end diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index 11714597dd..ee249d5a6e 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -20,13 +20,11 @@ module Homebrew comma_array "--hide", description: "Act as if none of the specified are installed. should be "\ "a comma-separated list of formulae." - switch :verbose - switch :debug end end def missing - missing_args.parse + args = missing_args.parse return unless HOMEBREW_CELLAR.exist? diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index c41d27f149..f82a029bcf 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -23,18 +23,18 @@ module Homebrew description: "Show options for all available formulae." flag "--command=", description: "Show options for the specified ." - switch :debug + conflicts "--installed", "--all", "--command" end end def options - options_args.parse + args = options_args.parse if args.all? - puts_options Formula.to_a.sort + puts_options Formula.to_a.sort, args: args elsif args.installed? - puts_options Formula.installed.sort + puts_options Formula.installed.sort, args: args elsif !args.command.nil? path = Commands.path(args.command) odie "Unknown command: #{args.command}" unless path @@ -54,7 +54,7 @@ module Homebrew elsif args.no_named? raise FormulaUnspecifiedError else - puts_options args.formulae + puts_options args.formulae, args: args end end @@ -72,7 +72,7 @@ module Homebrew options end - def puts_options(formulae) + def puts_options(formulae, args:) formulae.each do |f| next if f.options.empty? diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index ae065b1bcf..1f6ce94cf2 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -3,6 +3,8 @@ require "formula" require "keg" require "cli/parser" +require "cask/cmd" +require "cask/caskroom" module Homebrew module_function @@ -15,99 +17,188 @@ module Homebrew List installed formulae that have an updated version available. By default, version information is displayed in interactive shells, and suppressed otherwise. EOS - switch :quiet, + switch "-q", "--quiet", description: "List only the names of outdated kegs (takes precedence over `--verbose`)." - switch :verbose, + switch "-v", "--verbose", description: "Include detailed version information." flag "--json", - description: "Print output in JSON format. Currently the default and only accepted "\ - "value for is `v1`. See the docs for examples of using the JSON "\ - "output: " + description: "Print output in JSON format. There are two versions: v1 and v2. " \ + "v1 is deprecated and is currently the default if no version is specified. " \ + "v2 prints outdated formulae and casks. " switch "--fetch-HEAD", description: "Fetch the upstream repository to detect if the HEAD installation of the "\ "formula is outdated. Otherwise, the repository's HEAD will only be checked for "\ "updates when a new stable or development version has been released." - switch :debug + switch "--greedy", + description: "Print outdated casks with `auto_updates` or `version :latest`." + switch "--formula", + description: "Treat all arguments as formulae." + switch "--cask", + description: "Treat all arguments as casks." + conflicts "--quiet", "--verbose", "--json" + conflicts "--formula", "--cask" end end def outdated - outdated_args.parse + args = outdated_args.parse - formulae = if args.resolved_formulae.blank? - Formula.installed - else - args.resolved_formulae - end - if args.json - raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json + case json_version(args.json) + when :v1, :default + # TODO: enable for next major/minor release + # odeprecated "brew outdated --json#{json_version == :v1 ? "=v1" : ""}", "brew outdated --json=v2" + + outdated = if args.formula? || !args.cask? + outdated_formulae args: args + else + outdated_casks args: args + end + + puts JSON.generate(json_info(outdated, args: args)) + + when :v2 + formulae, casks = if args.formula? + [outdated_formulae(args: args), []] + elsif args.cask? + [[], outdated_casks(args: args)] + else + outdated_formulae_casks args: args + end + + json = { + "formulae" => json_info(formulae, args: args), + "casks" => json_info(casks, args: args), + } + puts JSON.generate(json) + + outdated = formulae + casks - outdated = print_outdated_json(formulae) else - outdated = print_outdated(formulae) + outdated = if args.formula? + outdated_formulae args: args + elsif args.cask? + outdated_casks args: args + else + outdated_formulae_casks(args: args).flatten + end + + print_outdated(outdated, args: args) end - Homebrew.failed = args.resolved_formulae.present? && !outdated.empty? + + Homebrew.failed = args.named.present? && outdated.present? end - def print_outdated(formulae) - verbose = ($stdout.tty? || args.verbose?) && !args.quiet? - fetch_head = args.fetch_HEAD? + def print_outdated(formulae_or_casks, args:) + formulae_or_casks.each do |formula_or_cask| + if formula_or_cask.is_a?(Formula) + f = formula_or_cask - outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } - .sort + if verbose? args: args + outdated_kegs = f.outdated_kegs(fetch_head: args.fetch_HEAD?) - outdated_formulae.each do |f| - if verbose - outdated_kegs = f.outdated_kegs(fetch_head: fetch_head) + current_version = if f.alias_changed? + latest = f.latest_formula + "#{latest.name} (#{latest.pkg_version})" + elsif f.head? && outdated_kegs.any? { |k| k.version.to_s == f.pkg_version.to_s } + # There is a newer HEAD but the version number has not changed. + "latest HEAD" + else + f.pkg_version.to_s + end - current_version = if f.alias_changed? - latest = f.latest_formula - "#{latest.name} (#{latest.pkg_version})" - elsif f.head? && outdated_kegs.any? { |k| k.version.to_s == f.pkg_version.to_s } - # There is a newer HEAD but the version number has not changed. - "latest HEAD" + outdated_versions = outdated_kegs.group_by { |keg| Formulary.from_keg(keg).full_name } + .sort_by { |full_name, _kegs| full_name } + .map do |full_name, kegs| + "#{full_name} (#{kegs.map(&:version).join(", ")})" + end.join(", ") + + pinned_version = " [pinned at #{f.pinned_version}]" if f.pinned? + + puts "#{outdated_versions} < #{current_version}#{pinned_version}" + else + puts f.full_installed_specified_name + end + else + c = formula_or_cask + + puts c.outdated_info(args.greedy?, verbose?(args: args), false) + end + end + end + + def json_info(formulae_or_casks, args:) + formulae_or_casks.map do |formula_or_cask| + if formula_or_cask.is_a?(Formula) + f = formula_or_cask + + outdated_versions = f.outdated_kegs(fetch_head: args.fetch_HEAD?).map(&:version) + current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s } + "HEAD" else f.pkg_version.to_s end - outdated_versions = outdated_kegs - .group_by { |keg| Formulary.from_keg(keg).full_name } - .sort_by { |full_name, _kegs| full_name } - .map do |full_name, kegs| - "#{full_name} (#{kegs.map(&:version).join(", ")})" - end.join(", ") - - pinned_version = " [pinned at #{f.pinned_version}]" if f.pinned? - - puts "#{outdated_versions} < #{current_version}#{pinned_version}" + { name: f.full_name, + installed_versions: outdated_versions.map(&:to_s), + current_version: current_version, + pinned: f.pinned?, + pinned_version: f.pinned_version } else - puts f.full_installed_specified_name + c = formula_or_cask + + c.outdated_info(args.greedy?, verbose?(args: args), true) end end end - def print_outdated_json(formulae) - json = [] - fetch_head = args.fetch_HEAD? - outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } + def verbose?(args:) + ($stdout.tty? || args.verbose?) && !args.quiet? + end - outdated = outdated_formulae.each do |f| - outdated_versions = f.outdated_kegs(fetch_head: fetch_head).map(&:version) - current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s } - "HEAD" - else - f.pkg_version.to_s - end + def json_version(version) + version_hash = { + nil => nil, + true => :default, + "v1" => :v1, + "v2" => :v2, + } - json << { name: f.full_name, - installed_versions: outdated_versions.map(&:to_s), - current_version: current_version, - pinned: f.pinned?, - pinned_version: f.pinned_version } + raise UsageError, "invalid JSON version: #{version}" unless version_hash.include?(version) + + version_hash[version] + end + + def outdated_formulae(args:) + select_outdated((args.resolved_formulae.presence || Formula.installed), args: args).sort + end + + def outdated_casks(args:) + if args.named.present? + select_outdated(args.named.uniq.map(&Cask::CaskLoader.method(:load)), args: args) + else + select_outdated(Cask::Caskroom.casks, args: args) end - puts JSON.generate(json) + end - outdated + def outdated_formulae_casks(args:) + formulae, casks = args.resolved_formulae_casks + + if formulae.blank? && casks.blank? + formulae = Formula.installed + casks = Cask::Caskroom.casks + end + + [select_outdated(formulae, args: args).sort, select_outdated(casks, args: args)] + end + + def select_outdated(formulae_or_casks, args:) + formulae_or_casks.select do |formula_or_cask| + if formula_or_cask.is_a?(Formula) + formula_or_cask.outdated?(fetch_head: args.fetch_HEAD?) + else + formula_or_cask.outdated?(args.greedy?) + end + end end end diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb index 37acaed464..a86d4a448e 100644 --- a/Library/Homebrew/cmd/pin.rb +++ b/Library/Homebrew/cmd/pin.rb @@ -14,13 +14,13 @@ module Homebrew Pin the specified , preventing them from being upgraded when issuing the `brew upgrade` command. See also `unpin`. EOS - switch :debug + min_named :formula end end def pin - pin_args.parse + args = pin_args.parse args.resolved_formulae.each do |f| if f.pinned? diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 89e3adf736..e0ac1d548c 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -14,9 +14,7 @@ module Homebrew Rerun the post-install steps for . EOS - switch :force - switch :verbose - switch :debug + min_named :keg end end @@ -27,7 +25,6 @@ module Homebrew args.resolved_formulae.each do |f| ohai "Postinstalling #{f}" fi = FormulaInstaller.new(f) - fi.force = args.force? fi.post_install end end diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 2eedf9cb59..a4f1d47a5d 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -19,16 +19,14 @@ module Homebrew switch "--aliases", description: "Verify any alias symlinks in each tap." switch "--syntax", - description: "Syntax-check all of Homebrew's Ruby files." - switch :verbose - switch :debug + description: "Syntax-check all of Homebrew's Ruby files (if no `` is passed)." end end def readall - readall_args.parse + args = readall_args.parse - if args.syntax? + if args.syntax? && args.no_named? scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb" ruby_files = Dir.glob(scan_files).reject { |file| file =~ %r{/(vendor)/} } diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 7a732f7d01..e70106f114 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -3,6 +3,7 @@ require "formula_installer" require "development_tools" require "messages" +require "install" require "reinstall" require "cli/parser" require "cleanup" @@ -25,7 +26,7 @@ module Homebrew Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the reinstalled formulae or, every 30 days, for all formulae. EOS - switch :debug, + switch "-d", "--debug", description: "If brewing fails, open an interactive debugging session with access to IRB "\ "or a shell inside the temporary build directory." switch "-s", "--build-from-source", @@ -39,10 +40,10 @@ module Homebrew "macOS, even if it would not normally be used for installation." switch "--keep-tmp", description: "Retain the temporary files created during installation." - switch :force, + switch "-f", "--force", description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." - switch :verbose, + switch "-v", "--verbose", description: "Print the verification and postinstall steps." switch "--display-times", env: :display_install_times, @@ -56,7 +57,7 @@ module Homebrew def reinstall args = reinstall_args.parse - FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? + FormulaInstaller.prevent_build_flags(args) Install.perform_preinstall_checks @@ -66,14 +67,14 @@ module Homebrew onoe "#{f.full_name} is pinned. You must unpin it to reinstall." next end - Migrator.migrate_if_needed(f) + Migrator.migrate_if_needed(f, force: args.force?) reinstall_formula(f, args: args) Cleanup.install_formula_clean!(f) end check_installed_dependents(args: args) - Homebrew.messages.display_messages + Homebrew.messages.display_messages(display_times: args.display_times?) return if casks.blank? diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 4032e8ea07..5992c73aa5 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -51,14 +51,13 @@ module Homebrew switch s, description: "Search for in the given package manager's list." end - switch :verbose - switch :debug + conflicts(*package_manager_switches) end end def search - search_args.parse + args = search_args.parse if package_manager = PACKAGE_MANAGERS.find { |name,| args[:"#{name}?"] } _, url = package_manager diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb index e9103565d3..06feb4badc 100644 --- a/Library/Homebrew/cmd/switch.rb +++ b/Library/Homebrew/cmd/switch.rb @@ -14,14 +14,13 @@ module Homebrew Symlink all of the specified of 's installation into Homebrew's prefix. EOS - switch :verbose - switch :debug + named 2 end end def switch - switch_args.parse + args = switch_args.parse name = args.named.first rack = Formulary.to_rack(name) diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 9f3708bd1d..e7d1dbf791 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -20,12 +20,11 @@ module Homebrew description: "Print a JSON representation of . Currently the default and only accepted "\ "value for is `v1`. See the docs for examples of using the JSON "\ "output: " - switch :debug end end def tap_info - tap_info_args.parse + args = tap_info_args.parse taps = if args.installed? Tap diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index bdd396cae2..74e53414ff 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -36,14 +36,13 @@ module Homebrew description: "Migrate tapped formulae from symlink-based to directory-based structure." switch "--list-pinned", description: "List all pinned taps." - switch :quiet - switch :debug + max_named 2 end end def tap - tap_args.parse + args = tap_args.parse if args.repair? Tap.each(&:link_completions_and_manpages) @@ -63,7 +62,7 @@ module Homebrew tap = Tap.fetch(args.named.first) begin tap.install clone_target: args.named.second, - force_auto_update: force_auto_update?, + force_auto_update: force_auto_update?(args: args), quiet: args.quiet?, full_clone: full_clone rescue TapRemoteMismatchError => e @@ -74,7 +73,7 @@ module Homebrew end end - def force_auto_update? + def force_auto_update?(args:) # if no relevant flag is present, return nil, meaning "no change" true if args.force_auto_update? end diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb index 2cb101b296..be851d9e85 100644 --- a/Library/Homebrew/cmd/uninstall.rb +++ b/Library/Homebrew/cmd/uninstall.rb @@ -19,18 +19,18 @@ module Homebrew Uninstall . EOS - switch :force, + switch "-f", "--force", description: "Delete all installed versions of ." switch "--ignore-dependencies", description: "Don't fail uninstall, even if is a dependency of any installed "\ "formulae." - switch :debug + min_named :formula end end def uninstall - uninstall_args.parse + args = uninstall_args.parse if args.force? casks = [] @@ -54,7 +54,9 @@ module Homebrew kegs_by_rack = all_kegs.group_by(&:rack) end - handle_unsatisfied_dependents(kegs_by_rack) + handle_unsatisfied_dependents(kegs_by_rack, + ignore_dependencies: args.ignore_dependencies?, + named_args: args.named) return if Homebrew.failed? kegs_by_rack.each do |rack, kegs| @@ -142,40 +144,41 @@ module Homebrew end end - def handle_unsatisfied_dependents(kegs_by_rack) - return if args.ignore_dependencies? + def handle_unsatisfied_dependents(kegs_by_rack, ignore_dependencies: false, named_args: []) + return if ignore_dependencies all_kegs = kegs_by_rack.values.flatten(1) - check_for_dependents all_kegs + check_for_dependents(all_kegs, named_args: named_args) rescue MethodDeprecatedError # Silently ignore deprecations when uninstalling. nil end - def check_for_dependents(kegs) + def check_for_dependents(kegs, named_args: []) return false unless result = Keg.find_some_installed_dependents(kegs) if Homebrew::EnvConfig.developer? - DeveloperDependentsMessage.new(*result).output + DeveloperDependentsMessage.new(*result, named_args: named_args).output else - NondeveloperDependentsMessage.new(*result).output + NondeveloperDependentsMessage.new(*result, named_args: named_args).output end true end class DependentsMessage - attr_reader :reqs, :deps + attr_reader :reqs, :deps, :named_args - def initialize(requireds, dependents) + def initialize(requireds, dependents, named_args: []) @reqs = requireds @deps = dependents + @named_args = named_args end protected def sample_command - "brew uninstall --ignore-dependencies #{Array(Homebrew.args.named).join(" ")}" + "brew uninstall --ignore-dependencies #{named_args.join(" ")}" end def are_required_by_deps diff --git a/Library/Homebrew/cmd/unlink.rb b/Library/Homebrew/cmd/unlink.rb index 688d1bec59..e31bde919a 100644 --- a/Library/Homebrew/cmd/unlink.rb +++ b/Library/Homebrew/cmd/unlink.rb @@ -18,14 +18,13 @@ module Homebrew switch "-n", "--dry-run", description: "List files which would be unlinked without actually unlinking or "\ "deleting any files." - switch :verbose - switch :debug + min_named :keg end end def unlink - unlink_args.parse + args = unlink_args.parse mode = OpenStruct.new mode.dry_run = true if args.dry_run? diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb index 4daed2ea06..0a346c967d 100644 --- a/Library/Homebrew/cmd/unpin.rb +++ b/Library/Homebrew/cmd/unpin.rb @@ -14,14 +14,13 @@ module Homebrew Unpin , allowing them to be upgraded by `brew upgrade` . See also `pin`. EOS - switch :verbose - switch :debug + min_named :formula end end def unpin - unpin_args.parse + args = unpin_args.parse args.resolved_formulae.each do |f| if f.pinned? diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 7afb51c551..5209dd26c3 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -12,13 +12,13 @@ module Homebrew Remove a tapped formula repository. EOS - switch :debug + min_named 1 end end def untap - untap_args.parse + args = untap_args.parse args.named.each do |tapname| tap = Tap.fetch(tapname) diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 6b0d842827..b35f1462d3 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -11,7 +11,7 @@ require "cli/parser" module Homebrew module_function - def update_preinstall_header + def update_preinstall_header(args:) @update_preinstall_header ||= begin ohai "Auto-updated Homebrew!" if args.preinstall? true @@ -27,16 +27,16 @@ module Homebrew EOS switch "--preinstall", description: "Run in 'auto-update' mode (faster, less output)." - switch :force - switch :quiet - switch :verbose - switch :debug + switch "-f", "--force", + description: "Treat installed and updated formulae as if they are from "\ + "the same taps and migrate them anyway." + hide_from_man_page! end end def update_report - update_report_args.parse + args = update_report_args.parse if !Utils::Analytics.messages_displayed? && !Utils::Analytics.disabled? && @@ -80,7 +80,7 @@ module Homebrew odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty? if initial_revision != current_revision - update_preinstall_header + update_preinstall_header args: args puts "Updated Homebrew from #{shorten_revision(initial_revision)} to #{shorten_revision(current_revision)}." updated = true end @@ -102,12 +102,12 @@ module Homebrew end if reporter.updated? updated_taps << tap.name - hub.add(reporter) + hub.add(reporter, preinstall: args.preinstall?) end end unless updated_taps.empty? - update_preinstall_header + update_preinstall_header args: args puts "Updated #{updated_taps.count} #{"tap".pluralize(updated_taps.count)} (#{updated_taps.to_sentence})." updated = true end @@ -120,7 +120,7 @@ module Homebrew else hub.dump(updated_formula_report: !args.preinstall?) hub.reporters.each(&:migrate_tap_migration) - hub.reporters.each(&:migrate_formula_rename) + hub.reporters.each { |r| r.migrate_formula_rename(force: args.force?) } CacheStoreDatabase.use(:descriptions) do |db| DescriptionCacheStore.new(db) .update_from_report!(hub) @@ -184,7 +184,7 @@ class Reporter raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty? end - def report + def report(preinstall: false) return @report if @report @report = Hash.new { |h, k| h[k] = [] } @@ -221,7 +221,7 @@ class Reporter name = tap.formula_file_to_name(src) # Skip reporting updated formulae to speed up automatic updates. - if Homebrew.args.preinstall? + if preinstall @report[:M] << name next end @@ -371,7 +371,7 @@ class Reporter end end - def migrate_formula_rename + def migrate_formula_rename(force:) Formula.installed.each do |formula| next unless Migrator.needs_migration?(formula) @@ -395,7 +395,7 @@ class Reporter next end - Migrator.migrate_if_needed(f) + Migrator.migrate_if_needed(f, force: force) end end @@ -423,9 +423,9 @@ class ReporterHub @hash.fetch(key, []) end - def add(reporter) + def add(reporter, preinstall: false) @reporters << reporter - report = reporter.report.delete_if { |_k, v| v.empty? } + report = reporter.report(preinstall: preinstall).delete_if { |_k, v| v.empty? } @hash.update(report) { |_key, oldval, newval| oldval.concat(newval) } end diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 0bd7c02db9..71530f6349 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -1,8 +1,9 @@ -#: * `update`, `up` [] +#: * `update` [] #: #: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. #: #: --merge Use `git merge` to apply updates (rather than `git rebase`). +#: --preinstall Run on auto-updates (e.g. before `brew install`). Skips some slower steps. #: -f, --force Always do a slower, full update check (even if unnecessary). #: -v, --verbose Print the directories checked and `git` operations performed. #: -d, --debug Display a trace of all shell commands as they are executed. diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index caaf02a746..aeaac8669b 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -4,6 +4,9 @@ require "cli/parser" require "formula_installer" require "install" require "upgrade" +require "cask/cmd" +require "cask/utils" +require "cask/macos" module Homebrew module_function @@ -20,7 +23,7 @@ module Homebrew Unless `HOMEBREW_NO_INSTALL_CLEANUP` is set, `brew cleanup` will then be run for the upgraded formulae or, every 30 days, for all formulae. EOS - switch :debug, + switch "-d", "--debug", description: "If brewing fails, open an interactive debugging session with access to IRB "\ "or a shell inside the temporary build directory." switch "-s", "--build-from-source", @@ -40,16 +43,18 @@ module Homebrew description: "Set a successful exit status even if pinned formulae are not upgraded." switch "--keep-tmp", description: "Retain the temporary files created during installation." - switch :force, + switch "-f", "--force", description: "Install without checking for previously installed keg-only or "\ "non-migrated versions." - switch :verbose, + switch "-v", "--verbose", description: "Print the verification and postinstall steps." switch "--display-times", env: :display_install_times, description: "Print install times for each formula at the end of the run." switch "-n", "--dry-run", description: "Show what would be upgraded, but do not actually upgrade anything." + switch "--greedy", + description: "Upgrade casks with `auto_updates` or `version :latest`" conflicts "--build-from-source", "--force-bottle" formula_options end @@ -58,22 +63,32 @@ module Homebrew def upgrade args = upgrade_args.parse - FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? + formulae, casks = args.resolved_formulae_casks + # If one or more formulae are specified, but no casks were + # specified, we want to make note of that so we don't + # try to upgrade all outdated casks. + named_formulae_specified = !formulae.empty? && casks.empty? + named_casks_specified = !casks.empty? && formulae.empty? + + upgrade_outdated_formulae(formulae, args: args) unless named_casks_specified + upgrade_outdated_casks(casks, args: args) unless named_formulae_specified + end + + def upgrade_outdated_formulae(formulae, args:) + FormulaInstaller.prevent_build_flags(args) Install.perform_preinstall_checks - if args.no_named? + if formulae.blank? outdated = Formula.installed.select do |f| f.outdated?(fetch_head: args.fetch_HEAD?) end - - exit 0 if outdated.empty? else - outdated = args.resolved_formulae.select do |f| + outdated, not_outdated = formulae.partition do |f| f.outdated?(fetch_head: args.fetch_HEAD?) end - (args.resolved_formulae - outdated).each do |f| + not_outdated.each do |f| versions = f.installed_kegs.map(&:version) if versions.empty? ofail "#{f.full_specified_name} not installed" @@ -82,9 +97,10 @@ module Homebrew opoo "#{f.full_specified_name} #{version} already installed" end end - return if outdated.empty? end + return if outdated.blank? + pinned = outdated.select(&:pinned?) outdated -= pinned formulae_to_install = outdated.map(&:latest_formula) @@ -113,6 +129,14 @@ module Homebrew check_installed_dependents(args: args) - Homebrew.messages.display_messages + Homebrew.messages.display_messages(display_times: args.display_times?) + end + + def upgrade_outdated_casks(casks, args:) + cask_upgrade = Cask::Cmd::Upgrade.new(casks) + cask_upgrade.force = args.force? + cask_upgrade.dry_run = args.dry_run? + cask_upgrade.greedy = args.greedy? + cask_upgrade.run end end diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index db8a89c20d..91e58e9dbd 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -6,6 +6,8 @@ require "formula" require "cli/parser" +require "cask/caskroom" +require "dependencies_helpers" module Homebrew extend DependenciesHelpers @@ -38,14 +40,14 @@ module Homebrew description: "Show usage of by development builds." switch "--HEAD", description: "Show usage of by HEAD builds." - switch :debug + conflicts "--devel", "--HEAD" min_named :formula end end def uses - uses_args.parse + args = uses_args.parse odeprecated "brew uses --devel" if args.devel? odeprecated "brew uses --HEAD" if args.HEAD? @@ -68,39 +70,22 @@ module Homebrew !args.include_optional? && !args.skip_recommended? + recursive = args.recursive? + includes, ignores = args_includes_ignores(args) + uses = if use_runtime_dependents && !used_formulae_missing used_formulae.map(&:runtime_installed_formula_dependents) .reduce(&:&) - .select(&:any_version_installed?) + .select(&:any_version_installed?) + + select_used_dependents(dependents(Cask::Caskroom.casks), used_formulae, recursive, includes, ignores) else - formulae = args.installed? ? Formula.installed : Formula - recursive = args.recursive? - includes, ignores = argv_includes_ignores(ARGV) - - formulae.select do |f| - deps = if recursive - recursive_includes(Dependency, f, includes, ignores) - else - reject_ignores(f.deps, ignores, includes) - end - - used_formulae.all? do |ff| - deps.any? do |dep| - match = begin - dep.to_formula.full_name == ff.full_name if dep.name.include?("/") - rescue - nil - end - next match unless match.nil? - - dep.name == ff.name - end - rescue FormulaUnavailableError - # Silently ignore this case as we don't care about things used in - # taps that aren't currently tapped. - next - end + deps = if args.installed? + dependents(Formula.installed + Cask::Caskroom.casks) + else + dependents(Formula.to_a + Cask::Cask.to_a) end + + select_used_dependents(deps, used_formulae, recursive, includes, ignores) end return if uses.empty? @@ -108,4 +93,31 @@ module Homebrew puts Formatter.columns(uses.map(&:full_name).sort) odie "Missing formulae should not have dependents!" if used_formulae_missing end + + def select_used_dependents(dependents, used_formulae, recursive, includes, ignores) + dependents.select do |d| + deps = if recursive + recursive_includes(Dependency, d, includes, ignores) + else + reject_ignores(d.deps, ignores, includes) + end + + used_formulae.all? do |ff| + deps.any? do |dep| + match = begin + dep.to_formula.full_name == ff.full_name if dep.name.include?("/") + rescue + nil + end + next match unless match.nil? + + dep.name == ff.name + end + rescue FormulaUnavailableError + # Silently ignore this case as we don't care about things used in + # taps that aren't currently tapped. + next + end + end + end end diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 02fc3d5e05..d68feffe5b 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "cask/cmd" + module Commands module_function @@ -89,6 +91,7 @@ module Commands cmds += internal_developer_commands cmds += external_commands cmds += internal_commands_aliases if aliases + cmds += cask_commands(aliases: aliases).map { |cmd| "cask #{cmd}" } cmds.sort end @@ -129,11 +132,39 @@ module Commands Tap.cmd_directories.flat_map do |path| find_commands(path).select(&:executable?) .map(&method(:basename_without_extension)) - .map { |p| p.to_s.sub(/^brew(cask)?-/, '\1 ').strip } + .map { |p| p.to_s.delete_prefix("brew-").strip } end.map(&:to_s) .sort end + def cask_commands(aliases: false) + cmds = cask_internal_commands + cmds += cask_internal_command_aliases if aliases + cmds += cask_external_commands + cmds + end + + def cask_internal_commands + Cask::Cmd.commands + end + + def cask_internal_command_aliases + Cask::Cmd.aliases.keys + end + + def cask_external_commands + PATH.new(Tap.cmd_directories, ENV["HOMEBREW_PATH"]).flat_map do |search_path| + find_commands(search_path).map do |possible_command| + path = possible_command.to_path + command_name = path.match(/brewcask-(.*)\.rb/) { |data| data[1].delete_suffix(".rb") } + if command_name.blank? && possible_command.executable? + command_name = path.match(/brewcask-(.*)/) { |data| data[1] } + end + command_name + end.compact + end + end + def basename_without_extension(path) path.basename(path.extname) end diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index cd88377eed..476d1b53ec 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "delegate" +require "cask_dependent" class Dependencies < DelegateClass(Array) def initialize(*args) @@ -55,71 +56,3 @@ class Requirements < DelegateClass(Set) "#<#{self.class.name}: {#{to_a.join(", ")}}>" end end - -module DependenciesHelpers - def argv_includes_ignores(argv) - includes = [] - ignores = [] - - if argv.include? "--include-build" - includes << "build?" - else - ignores << "build?" - end - - if argv.include? "--include-test" - includes << "test?" - else - ignores << "test?" - end - - if argv.include? "--include-optional" - includes << "optional?" - else - ignores << "optional?" - end - - ignores << "recommended?" if args.skip_recommended? - - [includes, ignores] - end - - def recursive_includes(klass, formula, includes, ignores) - type = if klass == Dependency - :dependencies - elsif klass == Requirement - :requirements - else - raise ArgumentError, "Invalid class argument: #{klass}" - end - - formula.send("recursive_#{type}") do |dependent, dep| - if dep.recommended? - klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) - elsif dep.optional? - klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep) - elsif dep.build? || dep.test? - keep = false - keep ||= dep.test? && includes.include?("test?") && dependent == formula - keep ||= dep.build? && includes.include?("build?") - klass.prune unless keep - end - - # If a tap isn't installed, we can't find the dependencies of one of - # its formulae, and an exception will be thrown if we try. - if type == :dependencies && - dep.is_a?(TapDependency) && - !dep.tap.installed? - Dependency.keep_but_prune_recursive_deps - end - end - end - - def reject_ignores(dependables, ignores, includes) - dependables.reject do |dep| - next false unless ignores.any? { |ignore| dep.send(ignore) } - - includes.none? { |include| dep.send(include) } - end - end -end diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb new file mode 100644 index 0000000000..fb6f13e9d1 --- /dev/null +++ b/Library/Homebrew/dependencies_helpers.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require "cask_dependent" + +module DependenciesHelpers + def args_includes_ignores(args) + includes = [] + ignores = [] + + if args.include_build? + includes << "build?" + else + ignores << "build?" + end + + if args.include_test? + includes << "test?" + else + ignores << "test?" + end + + if args.include_optional? + includes << "optional?" + else + ignores << "optional?" + end + + ignores << "recommended?" if args.skip_recommended? + + [includes, ignores] + end + + def recursive_includes(klass, root_dependent, includes, ignores) + type = if klass == Dependency + :dependencies + elsif klass == Requirement + :requirements + else + raise ArgumentError, "Invalid class argument: #{klass}" + end + + root_dependent.send("recursive_#{type}") do |dependent, dep| + if dep.recommended? + klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) + elsif dep.optional? + klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep) + elsif dep.build? || dep.test? + keep = false + keep ||= dep.test? && includes.include?("test?") && dependent == root_dependent + keep ||= dep.build? && includes.include?("build?") + klass.prune unless keep + end + + # If a tap isn't installed, we can't find the dependencies of one of + # its formulae, and an exception will be thrown if we try. + if type == :dependencies && + dep.is_a?(TapDependency) && + !dep.tap.installed? + Dependency.keep_but_prune_recursive_deps + end + end + end + + def reject_ignores(dependables, ignores, includes) + dependables.reject do |dep| + next false unless ignores.any? { |ignore| dep.send(ignore) } + + includes.none? { |include| dep.send(include) } + end + end + + def dependents(formulae_or_casks) + formulae_or_casks.map do |formula_or_cask| + if formula_or_cask.is_a?(Formula) + formula_or_cask + else + CaskDependent.new(formula_or_cask) + end + end + end + module_function :dependents +end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index d63d240a29..ba44997d7e 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -61,8 +61,7 @@ module Homebrew comma_array "--except-cops", description: "Specify a comma-separated list to skip checking for violations of the listed "\ "RuboCop cops." - switch :verbose - switch :debug + conflicts "--only", "--except" conflicts "--only-cops", "--except-cops", "--strict" conflicts "--only-cops", "--except-cops", "--only" @@ -88,8 +87,8 @@ module Homebrew git = args.git? skip_style = args.skip_style? || args.no_named? - ENV.activate_extensions!(args: args) - ENV.setup_build_environment(args: args) + ENV.activate_extensions! + ENV.setup_build_environment audit_formulae = args.no_named? ? Formula : args.resolved_formulae style_files = args.formulae_paths unless skip_style @@ -127,6 +126,7 @@ module Homebrew } options[:style_offenses] = style_results.file_offenses(f.path) if style_results options[:display_cop_names] = args.display_cop_names? + options[:build_stable] = args.build_stable? fa = FormulaAuditor.new(f, options) fa.audit @@ -207,6 +207,7 @@ module Homebrew @new_formula = options[:new_formula] && !@versioned_formula @strict = options[:strict] @online = options[:online] + @build_stable = options[:build_stable] @git = options[:git] @display_cop_names = options[:display_cop_names] @only = options[:only] @@ -248,7 +249,7 @@ module Homebrew unversioned_name = unversioned_formula.basename(".rb") problem "#{formula} is versioned but no #{unversioned_name} formula exists" end - elsif Homebrew.args.build_stable? && formula.stable? && + elsif @build_stable && formula.stable? && !(versioned_formulae = formula.versioned_formulae).empty? versioned_aliases = formula.aliases.grep(/.@\d/) _, last_alias_version = versioned_formulae.map(&:name).last.split("@") @@ -267,6 +268,12 @@ module Homebrew valid_alias_names.map! { |a| "#{formula.tap}/#{a}" } end + # Fix naming based on what people expect. + if alias_name_major_minor == "adoptopenjdk@1.8" + valid_alias_names << "adoptopenjdk@8" + valid_alias_names.delete "adoptopenjdk@1" + end + valid_versioned_aliases = versioned_aliases & valid_alias_names invalid_versioned_aliases = versioned_aliases - valid_alias_names @@ -282,7 +289,7 @@ module Homebrew end end - unless invalid_versioned_aliases.empty? + if invalid_versioned_aliases.present? problem <<~EOS Formula has invalid versioned aliases: #{invalid_versioned_aliases.join("\n ")} @@ -330,20 +337,28 @@ module Homebrew def audit_license if formula.license.present? - if @spdx_data["licenses"].any? { |lic| lic["licenseId"] == formula.license } - return unless @online + non_standard_licenses = [] + formula.license.each do |license| + next if @spdx_data["licenses"].any? { |spdx| spdx["licenseId"] == license } - user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula - return if user.blank? - - github_license = GitHub.get_repo_license(user, repo) - return if github_license && [formula.license, "NOASSERTION"].include?(github_license) - - problem "License mismatch - GitHub license is: #{github_license}, "\ - "but Formulae license states: #{formula.license}." - else - problem "#{formula.license} is not a standard SPDX license." + non_standard_licenses << license end + + if non_standard_licenses.present? + problem "Formula #{formula.name} contains non-standard SPDX licenses: #{non_standard_licenses}." + end + + return unless @online + + user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula + return if user.blank? + + github_license = GitHub.get_repo_license(user, repo) + return if github_license && (formula.license + ["NOASSERTION"]).include?(github_license) + + problem "License mismatch - GitHub license is: #{Array(github_license)}, "\ + "but Formulae license states: #{formula.license}." + elsif @new_formula problem "No license specified for package." end @@ -375,12 +390,13 @@ module Homebrew end if self.class.aliases.include?(dep.name) && - (dep_f.core_formula? || !dep_f.versioned_formula?) + dep_f.core_formula? && !dep_f.versioned_formula? problem "Dependency '#{dep.name}' from homebrew/core is an alias; " \ "use the canonical name '#{dep.to_formula.full_name}'." end - if @new_formula && + if @core_tap && + @new_formula && dep_f.keg_only? && dep_f.keg_only_reason.provided_by_macos? && dep_f.keg_only_reason.applicable? && @@ -456,6 +472,7 @@ module Homebrew end end + # openssl@1.1 only needed for Linux VERSIONED_KEG_ONLY_ALLOWLIST = %w[ autoconf@2.13 bash-completion@2 @@ -463,6 +480,7 @@ module Homebrew libsigc++@2 lua@5.1 numpy@1.16 + openssl@1.1 python@3.8 ].freeze @@ -478,7 +496,9 @@ module Homebrew end end - return if VERSIONED_KEG_ONLY_ALLOWLIST.include?(formula.name) || formula.name.start_with?("gcc@") + return if VERSIONED_KEG_ONLY_ALLOWLIST.include?(formula.name) + return if formula.name.start_with?("adoptopenjdk@") + return if formula.name.start_with?("gcc@") problem "Versioned formulae in homebrew/core should use `keg_only :versioned_formula`" end diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 113c0bad39..461649cc10 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -76,21 +76,20 @@ module Homebrew "to the formula file." flag "--root-url=", description: "Use the specified as the root of the bottle's URL instead of Homebrew's default." - switch :verbose - switch :debug + conflicts "--no-rebuild", "--keep-old" min_named 1 end end def bottle - bottle_args.parse + args = bottle_args.parse - return merge if args.merge? + return merge(args: args) if args.merge? ensure_relocation_formulae_installed! unless args.skip_relocation? args.resolved_formulae.each do |f| - bottle_formula f + bottle_formula f, args: args end end @@ -103,7 +102,7 @@ module Homebrew end end - def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil) + def keg_contain?(string, keg, ignores, formula_and_runtime_deps_names = nil, args:) @put_string_exists_header, @put_filenames = nil print_filename = lambda do |str, filename| @@ -177,10 +176,10 @@ module Homebrew end end - keg_contain_absolute_symlink_starting_with?(string, keg) || result + keg_contain_absolute_symlink_starting_with?(string, keg, args: args) || result end - def keg_contain_absolute_symlink_starting_with?(string, keg) + def keg_contain_absolute_symlink_starting_with?(string, keg, args:) absolute_symlinks_start_with_string = [] keg.find do |pn| next unless pn.symlink? && (link = pn.readlink).absolute? @@ -211,7 +210,7 @@ module Homebrew system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge" end - def bottle_formula(f) + def bottle_formula(f, args:) return ofail "Formula not installed or up-to-date: #{f.full_name}" unless f.latest_version_installed? unless tap = f.tap @@ -328,14 +327,14 @@ module Homebrew if args.skip_relocation? skip_relocation = true else - relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names) - relocatable = false if keg_contain?(repository, keg, ignores) - relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names) + relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names, args: args) + relocatable = false if keg_contain?(repository, keg, ignores, args: args) + relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names, args: args) if prefix != prefix_check - relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg) - relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores) - relocatable = false if keg_contain?("#{prefix}/var", keg, ignores) - relocatable = false if keg_contain?("#{prefix}/share/vim", keg, ignores) + relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg, args: args) + relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores, args: args) + relocatable = false if keg_contain?("#{prefix}/var", keg, ignores, args: args) + relocatable = false if keg_contain?("#{prefix}/share/vim", keg, ignores, args: args) end skip_relocation = relocatable && !keg.require_relocation? end @@ -434,7 +433,7 @@ module Homebrew end end - def merge + def merge(args:) bottles_hash = args.named.reduce({}) do |hash, json_file| hash.deep_merge(JSON.parse(IO.read(json_file))) do |key, first, second| if key == "cellar" @@ -484,7 +483,7 @@ module Homebrew update_or_add = "update" if args.keep_old? mismatches = [] - bottle_block_contents = s[/ bottle do(.+?)end\n/m, 1] + bottle_block_contents = s.inreplace_string[/ bottle do(.+?)end\n/m, 1] bottle_block_contents.lines.each do |line| line = line.strip next if line.empty? diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 8bdd2ec7a4..a2b4a8f528 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -2,6 +2,7 @@ require "formula" require "cli/parser" +require "utils/pypi" module Homebrew module_function @@ -62,17 +63,16 @@ module Homebrew flag "--revision=", depends_on: "--tag=", description: "Specify the new git commit corresponding to the specified ." - switch :force - switch :quiet - switch :verbose - switch :debug + switch "-f", "--force", + description: "Ignore duplicate open PRs. Remove all mirrors if --mirror= was not specified." + conflicts "--no-audit", "--strict" conflicts "--url", "--tag" max_named 1 end end - def use_correct_linux_tap(formula) + def use_correct_linux_tap(formula, args:) if OS.linux? && formula.tap.core_tap? tap_full_name = formula.tap.full_name.gsub("linuxbrew", "homebrew") homebrew_core_url = "https://github.com/#{tap_full_name}" @@ -109,7 +109,7 @@ module Homebrew end def bump_formula_pr - bump_formula_pr_args.parse + args = bump_formula_pr_args.parse # As this command is simplifying user-run commands then let's just use a # user path, too. @@ -124,11 +124,11 @@ module Homebrew formula ||= determine_formula_from_url(new_url) if new_url raise FormulaUnspecifiedError unless formula - tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula) - check_open_pull_requests(formula, tap_full_name) + tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula, args: args) + check_open_pull_requests(formula, tap_full_name, args: args) new_version = args.version - check_all_pull_requests(formula, tap_full_name, version: new_version) if new_version + check_all_pull_requests(formula, tap_full_name, version: new_version, args: args) if new_version requested_spec = :stable formula_spec = formula.stable @@ -159,10 +159,10 @@ module Homebrew old_version = old_formula_version.to_s forced_version = new_version.present? new_url_hash = if new_url && new_hash - check_all_pull_requests(formula, tap_full_name, url: new_url) unless new_version + check_all_pull_requests(formula, tap_full_name, url: new_url, args: args) unless new_version true elsif new_tag && new_revision - check_all_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag) unless new_version + check_all_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag, args: args) unless new_version false elsif !hash_type odie "#{formula}: no --tag= or --version= argument specified!" if !new_tag && !new_version @@ -173,7 +173,7 @@ module Homebrew and old tag are both #{new_tag}. EOS end - check_all_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag) unless new_version + check_all_pull_requests(formula, tap_full_name, url: old_url, tag: new_tag, args: args) unless new_version resource_path, forced_version = fetch_resource(formula, new_version, old_url, tag: new_tag) new_revision = Utils.popen_read("git -C \"#{resource_path}\" rev-parse -q --verify HEAD") new_revision = new_revision.strip @@ -181,6 +181,7 @@ module Homebrew elsif !new_url && !new_version odie "#{formula}: no --url= or --version= argument specified!" else + new_url ||= PyPI.update_pypi_url(old_url, new_version) new_url ||= old_url.gsub(old_version, new_version) if new_url == old_url odie <<~EOS @@ -189,7 +190,7 @@ module Homebrew #{new_url} EOS end - check_all_pull_requests(formula, tap_full_name, url: new_url) unless new_version + check_all_pull_requests(formula, tap_full_name, url: new_url, args: args) unless new_version resource_path, forced_version = fetch_resource(formula, new_version, new_url) tar_file_extensions = %w[.tar .tb2 .tbz .tbz2 .tgz .tlz .txz .tZ] if tar_file_extensions.any? { |extension| new_url.include? extension } @@ -293,7 +294,7 @@ module Homebrew "", ] end - new_contents = inreplace_pairs(formula.path, replacement_pairs.uniq.compact) + new_contents = inreplace_pairs(formula.path, replacement_pairs.uniq.compact, args: args) new_formula_version = formula_version(formula, requested_spec, new_contents) @@ -330,10 +331,15 @@ module Homebrew alias_rename.map! { |a| formula.tap.alias_dir/a } end - run_audit(formula, alias_rename, old_contents) + ohai "brew update-python-resources #{formula.name}" + if !args.dry_run? || (args.dry_run? && args.write?) + PyPI.update_python_resources! formula, new_formula_version, silent: true, ignore_non_pypi_packages: true + end + + run_audit(formula, alias_rename, old_contents, args: args) formula.path.parent.cd do - branch = "#{formula.name}-#{new_formula_version}" + branch = "bump-#{formula.name}-#{new_formula_version}" git_dir = Utils.popen_read("git rev-parse --git-dir").chomp shallow = !git_dir.empty? && File.exist?("#{git_dir}/shallow") changed_files = [formula.path] @@ -445,10 +451,10 @@ module Homebrew [remote_url, username] end - def inreplace_pairs(path, replacement_pairs) + def inreplace_pairs(path, replacement_pairs, args:) if args.dry_run? - contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } - contents.extend(StringInreplaceExtension) + str = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } + contents = StringInreplaceExtension.new(str) replacement_pairs.each do |old, new| ohai "replace #{old.inspect} with #{new.inspect}" unless args.quiet? raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old @@ -457,8 +463,8 @@ module Homebrew end raise Utils::InreplaceError, path => contents.errors unless contents.errors.empty? - path.atomic_write(contents) if args.write? - contents + path.atomic_write(contents.inreplace_string) if args.write? + contents.inreplace_string else Utils::Inreplace.inreplace(path) do |s| replacement_pairs.each do |old, new| @@ -485,10 +491,10 @@ module Homebrew def check_open_pull_requests(formula, tap_full_name) # check for open requests pull_requests = GitHub.fetch_pull_requests(formula.name, tap_full_name, state: "open") - check_for_duplicate_pull_requests(pull_requests) + check_for_duplicate_pull_requests(pull_requests, args: args) end - def check_all_pull_requests(formula, tap_full_name, version: nil, url: nil, tag: nil) + def check_all_pull_requests(formula, tap_full_name, version: nil, url: nil, tag: nil, args:) unless version specs = {} specs[:tag] = tag if tag @@ -496,10 +502,10 @@ module Homebrew end # if we haven't already found open requests, try for an exact match across all requests pull_requests = GitHub.fetch_pull_requests("#{formula.name} #{version}", tap_full_name) if pull_requests.blank? - check_for_duplicate_pull_requests(pull_requests) + check_for_duplicate_pull_requests(pull_requests, args: args) end - def check_for_duplicate_pull_requests(pull_requests) + def check_for_duplicate_pull_requests(pull_requests, args:) return if pull_requests.blank? duplicates_message = <<~EOS @@ -531,7 +537,7 @@ module Homebrew [versioned_alias, "#{name}@#{new_alias_version}"] end - def run_audit(formula, alias_rename, old_contents) + def run_audit(formula, alias_rename, old_contents, args:) if args.dry_run? if args.no_audit? ohai "Skipping `brew audit`" diff --git a/Library/Homebrew/dev-cmd/bump-revision.rb b/Library/Homebrew/dev-cmd/bump-revision.rb index 131edb3bda..2b71a91d7f 100644 --- a/Library/Homebrew/dev-cmd/bump-revision.rb +++ b/Library/Homebrew/dev-cmd/bump-revision.rb @@ -18,16 +18,13 @@ module Homebrew description: "Print what would be done rather than doing it." flag "--message=", description: "Append to the default commit message." - switch :force - switch :quiet - switch :verbose - switch :debug + named :formula end end def bump_revision - bump_revision_args.parse + args = bump_revision_args.parse # As this command is simplifying user-run commands then let's just use a # user path, too. @@ -43,9 +40,14 @@ module Homebrew end old = if formula.license + license_string = if formula.license.length > 1 + formula.license + else + "\"#{formula.license.first}\"" + end # insert replacement revision after license <<~EOS - license "#{formula.license}" + license #{license_string} EOS elsif formula.path.read.include?("stable do\n") # insert replacement revision after homepage @@ -60,7 +62,7 @@ module Homebrew else # insert replacement revision after :revision <<~EOS - :revision => "#{formula_spec.specs[:revision]}" + revision: "#{formula_spec.specs[:revision]}" EOS end replacement = old + " revision 1\n" diff --git a/Library/Homebrew/dev-cmd/cat.rb b/Library/Homebrew/dev-cmd/cat.rb index 3bec5c5d99..1c3ee81176 100644 --- a/Library/Homebrew/dev-cmd/cat.rb +++ b/Library/Homebrew/dev-cmd/cat.rb @@ -17,7 +17,7 @@ module Homebrew end def cat - cat_args.parse + args = cat_args.parse cd HOMEBREW_REPOSITORY pager = if Homebrew::EnvConfig.bat? @@ -26,6 +26,6 @@ module Homebrew else "cat" end - safe_system pager, args.formulae_paths.first, *args.passthrough + safe_system pager, args.formulae_paths.first end end diff --git a/Library/Homebrew/dev-cmd/command.rb b/Library/Homebrew/dev-cmd/command.rb index e7c686288d..cb928bc577 100644 --- a/Library/Homebrew/dev-cmd/command.rb +++ b/Library/Homebrew/dev-cmd/command.rb @@ -13,14 +13,13 @@ module Homebrew Display the path to the file being used when invoking `brew` . EOS - switch :verbose - switch :debug + min_named 1 end end def command - command_args.parse + args = command_args.parse args.named.each do |cmd| path = Commands.path(cmd) diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 3c22558c27..85b2f857e7 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -4,6 +4,7 @@ require "formula" require "formula_creator" require "missing_formula" require "cli/parser" +require "utils/pypi" module Homebrew module_function @@ -53,9 +54,9 @@ module Homebrew description: "Explicitly set the of the new formula." flag "--tap=", description: "Generate the new formula within the given tap, specified as `/`." - switch :force - switch :verbose - switch :debug + switch "-f", "--force", + description: "Ignore errors for disallowed formula names and named that shadow aliases." + conflicts "--autotools", "--cmake", "--crystal", "--go", "--meson", "--node", "--perl", "--python", "--rust" named 1 end @@ -136,6 +137,8 @@ module Homebrew fc.generate! + PyPI.update_python_resources! Formula[fc.name], ignore_non_pypi_packages: true if args.python? + puts "Please run `brew audit --new-formula #{fc.name}` before submitting, thanks." exec_editor fc.path end diff --git a/Library/Homebrew/dev-cmd/diy.rb b/Library/Homebrew/dev-cmd/diy.rb index 51a7ff4c26..f58ae2fa9c 100644 --- a/Library/Homebrew/dev-cmd/diy.rb +++ b/Library/Homebrew/dev-cmd/diy.rb @@ -19,14 +19,13 @@ module Homebrew description: "Explicitly set the of the package being installed." flag "--version=", description: "Explicitly set the of the package being installed." - switch :verbose - switch :debug + max_named 0 end end def diy - diy_args.parse + args = diy_args.parse path = Pathname.getwd diff --git a/Library/Homebrew/dev-cmd/edit.rb b/Library/Homebrew/dev-cmd/edit.rb index 25ee7cc91f..7b23a6a20a 100644 --- a/Library/Homebrew/dev-cmd/edit.rb +++ b/Library/Homebrew/dev-cmd/edit.rb @@ -14,13 +14,11 @@ module Homebrew Open in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no formula is provided. EOS - switch :verbose - switch :debug end end def edit - edit_args.parse + args = edit_args.parse unless (HOMEBREW_REPOSITORY/".git").directory? raise <<~EOS diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index d7d11b0233..9eb432a17c 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -89,14 +89,15 @@ module Homebrew EOS flag "--version=", description: "Extract the specified of instead of the most recent." - switch :force - switch :debug + switch "-f", "--force", + description: "Overwrite the destination formula if it already exists." + named 2 end end def extract - extract_args.parse + args = extract_args.parse if args.named.first !~ HOMEBREW_TAP_FORMULA_REGEX name = args.named.first.downcase diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 8a782ee4e8..664db4c5e0 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -13,14 +13,13 @@ module Homebrew Display the path where is located. EOS - switch :verbose - switch :debug + min_named :formula end end def formula - formula_args.parse + args = formula_args.parse args.formulae_paths.each(&method(:puts)) end diff --git a/Library/Homebrew/dev-cmd/install-bundler-gems.rb b/Library/Homebrew/dev-cmd/install-bundler-gems.rb index 66aeb1087d..20ba27eb71 100644 --- a/Library/Homebrew/dev-cmd/install-bundler-gems.rb +++ b/Library/Homebrew/dev-cmd/install-bundler-gems.rb @@ -13,7 +13,7 @@ module Homebrew Install Homebrew's Bundler gems. EOS - switch :debug + max_named 0 end end diff --git a/Library/Homebrew/dev-cmd/irb.rb b/Library/Homebrew/dev-cmd/irb.rb index e748e6fa19..4f05e3de6d 100644 --- a/Library/Homebrew/dev-cmd/irb.rb +++ b/Library/Homebrew/dev-cmd/irb.rb @@ -18,8 +18,7 @@ module Homebrew module_function def irb_args - # work around IRB modifying ARGV. - Homebrew::CLI::Parser.new(ARGV.dup.freeze) do + Homebrew::CLI::Parser.new do usage_banner <<~EOS `irb` [] @@ -34,7 +33,8 @@ module Homebrew end def irb - irb_args.parse + # work around IRB modifying ARGV. + args = irb_args.parse(ARGV.dup.freeze) if args.examples? puts "'v8'.f # => instance of the v8 formula" diff --git a/Library/Homebrew/dev-cmd/linkage.rb b/Library/Homebrew/dev-cmd/linkage.rb index ddd542c94d..47258dfab1 100644 --- a/Library/Homebrew/dev-cmd/linkage.rb +++ b/Library/Homebrew/dev-cmd/linkage.rb @@ -24,13 +24,11 @@ module Homebrew switch "--cached", description: "Print the cached linkage values stored in `HOMEBREW_CACHE`, set by a previous "\ "`brew linkage` run." - switch :verbose - switch :debug end end def linkage - linkage_args.parse + args = linkage_args.parse CacheStoreDatabase.use(:linkage) do |db| kegs = if args.kegs.empty? diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 8d864a7b29..1a76bb2d42 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -31,12 +31,12 @@ module Homebrew end def man - man_args.parse + args = man_args.parse odie "`brew man --link` is now done automatically by `brew update`." if args.link? Commands.rebuild_internal_commands_completion_list - regenerate_man_pages + regenerate_man_pages(preserve_date: args.fail_if_changed?) if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/Manpage.md", "manpages", "completions" puts "No changes to manpage or completions output detected." @@ -45,15 +45,15 @@ module Homebrew end end - def regenerate_man_pages + def regenerate_man_pages(preserve_date:) Homebrew.install_bundler_gems! markup = build_man_page - convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md") - convert_man_page(markup, TARGET_MAN_PATH/"brew.1") + convert_man_page(markup, TARGET_DOC_PATH/"Manpage.md", preserve_date: preserve_date) + convert_man_page(markup, TARGET_MAN_PATH/"brew.1", preserve_date: preserve_date) cask_markup = (SOURCE_PATH/"brew-cask.1.md").read - convert_man_page(cask_markup, TARGET_MAN_PATH/"brew-cask.1") + convert_man_page(cask_markup, TARGET_MAN_PATH/"brew-cask.1", preserve_date: preserve_date) end def build_man_page @@ -94,14 +94,13 @@ module Homebrew path.basename.to_s.sub(/\.(rb|sh)$/, "").sub(/^--/, "~~") end - def convert_man_page(markup, target) + def convert_man_page(markup, target, preserve_date:) manual = target.basename(".1") organisation = "Homebrew" # Set the manpage date to the existing one if we're checking for changes. # This avoids the only change being e.g. a new date. - date = if args.fail_if_changed? && - target.extname == ".1" && target.exist? + date = if preserve_date && target.extname == ".1" && target.exist? /"(\d{1,2})" "([A-Z][a-z]+) (\d{4})" "#{organisation}" "#{manual}"/ =~ target.read Date.parse("#{Regexp.last_match(1)} #{Regexp.last_match(2)} #{Regexp.last_match(3)}") else @@ -148,7 +147,7 @@ module Homebrew def generate_cmd_manpages(cmd_paths) man_page_lines = [] - man_args = Homebrew.args + # preserve existing manpage order cmd_paths.sort_by(&method(:sort_key_for_path)) .each do |cmd_path| @@ -162,14 +161,14 @@ module Homebrew man_page_lines << cmd_man_page_lines end - Homebrew.args = man_args + man_page_lines.compact.join("\n") end def cmd_parser_manpage_lines(cmd_parser) lines = [format_usage_banner(cmd_parser.usage_banner_text)] lines += cmd_parser.processed_options.map do |short, long, _, desc| - next if !long.nil? && cmd_parser.global_option?(cmd_parser.option_to_name(long), desc) + next if !long.nil? && Homebrew::CLI::Parser.global_options.include?([short, long, desc]) generate_option_doc(short, long, desc) end.reject(&:blank?) @@ -191,7 +190,7 @@ module Homebrew end # Omit the common global_options documented separately in the man page. - next if line.match?(/--(debug|force|help|quiet|verbose) /) + next if line.match?(/--(debug|help|quiet|verbose) /) # Format one option or a comma-separated pair of short and long options. lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ") @@ -203,8 +202,7 @@ module Homebrew def global_options_manpage lines = ["These options are applicable across multiple subcommands.\n"] - lines += Homebrew::CLI::Parser.global_options.values.map do |names, _, desc| - short, long = names + lines += Homebrew::CLI::Parser.global_options.map do |short, long, desc| generate_option_doc(short, long, desc) end lines.join("\n") diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 851ad476a9..832707227a 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -19,8 +19,7 @@ module Homebrew description: "Upload to the specified Bintray repository (default: `mirror`)." switch "--no-publish", description: "Upload to Bintray, but don't publish." - switch :verbose - switch :debug + hide_from_man_page! min_named :formula end diff --git a/Library/Homebrew/dev-cmd/pr-automerge.rb b/Library/Homebrew/dev-cmd/pr-automerge.rb index c7aadd8ea1..24ed7f5d3d 100644 --- a/Library/Homebrew/dev-cmd/pr-automerge.rb +++ b/Library/Homebrew/dev-cmd/pr-automerge.rb @@ -25,23 +25,21 @@ module Homebrew description: "Run `brew pr-publish` on matching pull requests." switch "--ignore-failures", description: "Include pull requests that have failing status checks." - switch :verbose - switch :debug + max_named 0 end end def pr_automerge - pr_automerge_args.parse + args = pr_automerge_args.parse - ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" unless OS.mac? - without_labels = Homebrew.args.without_labels || ["do not merge", "new formula"] - tap = Tap.fetch(Homebrew.args.tap || CoreTap.instance.name) + without_labels = args.without_labels || ["do not merge", "new formula"] + tap = Tap.fetch(args.tap || CoreTap.instance.name) query = "is:pr is:open repo:#{tap.full_name}" - query += Homebrew.args.ignore_failures? ? " -status:pending" : " status:success" - query += " review:approved" unless Homebrew.args.without_approval? - query += " label:\"#{with_label}\"" if Homebrew.args.with_label + query += args.ignore_failures? ? " -status:pending" : " status:success" + query += " review:approved" unless args.without_approval? + query += " label:\"#{args.with_label}\"" if args.with_label without_labels&.each { |label| query += " -label:\"#{label}\"" } odebug "Searching: #{query}" @@ -59,7 +57,9 @@ module Homebrew end if args.publish? - safe_system "#{HOMEBREW_PREFIX}/bin/brew", "pr-publish", *pr_urls + publish_args = ["pr-publish"] + publish_args << "--tap=#{tap}" if tap + safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls else ohai "Now run:", " brew pr-publish \\\n #{pr_urls.join " \\\n "}" end diff --git a/Library/Homebrew/dev-cmd/pr-publish.rb b/Library/Homebrew/dev-cmd/pr-publish.rb index d45ab8c185..f85011490d 100644 --- a/Library/Homebrew/dev-cmd/pr-publish.rb +++ b/Library/Homebrew/dev-cmd/pr-publish.rb @@ -12,26 +12,35 @@ module Homebrew `pr-publish` [] [ ...] Publish bottles for a pull request with GitHub Actions. - Requires write access to the `homebrew/core` repository. + Requires write access to the repository. EOS - switch :verbose + flag "--tap=", + description: "Target tap repository (default: `homebrew/core`)." + flag "--workflow=", + description: "Target workflow filename (default: `publish-commit-bottles.yml`)." + min_named 1 end end def pr_publish - pr_publish_args.parse + args = pr_publish_args.parse - ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" unless OS.mac? + tap = Tap.fetch(args.tap || CoreTap.instance.name) + workflow = args.workflow || "publish-commit-bottles.yml" + ref = "master" args.named.uniq.each do |arg| - arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive? + arg = "#{tap.default_remote}/pull/#{arg}" if arg.to_i.positive? url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX _, user, repo, issue = *url_match odie "Not a GitHub pull request: #{arg}" unless issue - tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX) + if args.tap.present? && !"#{user}/#{repo}".casecmp(tap.full_name).zero? + odie "Pull request URL is for #{user}/#{repo} but --tap=#{tap.full_name}!" + end + ohai "Dispatching #{tap} pull request ##{issue}" - GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue) + GitHub.workflow_dispatch_event(user, repo, workflow, ref, pull_request: issue) end end end diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 6a672e4119..28ae197fac 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -49,8 +49,7 @@ module Homebrew flag "--bintray-mirror=", description: "Use the specified Bintray repository to automatically mirror stable URLs "\ "defined in the formulae (default: `mirror`)." - switch :verbose - switch :debug + min_named 1 end end @@ -130,7 +129,7 @@ module Homebrew end end - def check_branch(path, ref) + def check_branch(path, ref, args:) branch = Utils.popen_read("git", "-C", path, "symbolic-ref", "--short", "HEAD").strip return if branch == ref || args.clean? || args.branch_okay? @@ -155,8 +154,8 @@ module Homebrew else odebug "Mirroring #{mirror_url}" mirror_args = ["mirror", f.full_name] - mirror_args << "--debug" if Homebrew.args.debug? - mirror_args << "--verbose" if Homebrew.args.verbose? + mirror_args << "--debug" if args.debug? + mirror_args << "--verbose" if args.verbose? mirror_args << "--bintray-org=#{org}" if org mirror_args << "--bintray-repo=#{repo}" if repo mirror_args << "--no-publish" unless publish @@ -233,7 +232,7 @@ module Homebrew _, user, repo, pr = *url_match odie "Not a GitHub pull request: #{arg}" unless pr - check_branch tap.path, "master" + check_branch tap.path, "master", args: args ohai "Fetching #{tap} pull request ##{pr}" Dir.mktmpdir pr do |dir| @@ -259,8 +258,8 @@ module Homebrew next if args.no_upload? upload_args = ["pr-upload"] - upload_args << "--debug" if Homebrew.args.debug? - upload_args << "--verbose" if Homebrew.args.verbose? + upload_args << "--debug" if args.debug? + upload_args << "--verbose" if args.verbose? upload_args << "--no-publish" if args.no_publish? upload_args << "--dry-run" if args.dry_run? upload_args << "--warn-on-upload-failure" if args.warn_on_upload_failure? diff --git a/Library/Homebrew/dev-cmd/pr-upload.rb b/Library/Homebrew/dev-cmd/pr-upload.rb index 2d27d6f5a5..aa83627f63 100644 --- a/Library/Homebrew/dev-cmd/pr-upload.rb +++ b/Library/Homebrew/dev-cmd/pr-upload.rb @@ -27,8 +27,21 @@ module Homebrew description: "Upload to the specified Bintray organisation (default: `homebrew`)." flag "--root-url=", description: "Use the specified as the root of the bottle's URL instead of Homebrew's default." - switch :verbose - switch :debug + end + end + + def check_bottled_formulae(json_files) + hashes = json_files.reduce({}) do |hash, json| + hash.deep_merge(JSON.parse(IO.read(json))) + end + + hashes.each do |name, hash| + formula_path = HOMEBREW_REPOSITORY/hash["formula"]["path"] + formula_version = Formulary.factory(formula_path).pkg_version + bottle_version = PkgVersion.parse hash["formula"]["pkg_version"] + next if formula_version == bottle_version + + odie "Bottles are for #{name} #{bottle_version} but formula is version #{formula_version}!" end end @@ -38,20 +51,23 @@ module Homebrew bintray_org = args.bintray_org || "homebrew" bintray = Bintray.new(org: bintray_org) + json_files = Dir["*.json"] + odie "No JSON files found in the current working directory" if json_files.empty? + bottle_args = ["bottle", "--merge", "--write"] bottle_args << "--verbose" if args.verbose? bottle_args << "--debug" if args.debug? bottle_args << "--keep-old" if args.keep_old? bottle_args << "--root-url=#{args.root_url}" if args.root_url - odie "No JSON files found in the current working directory" if Dir["*.json"].empty? - bottle_args += Dir["*.json"] + bottle_args += json_files if args.dry_run? puts "brew #{bottle_args.join " "}" - puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}" + puts "Upload bottles described by these JSON files to Bintray:\n #{json_files.join("\n ")}" else + check_bottled_formulae(json_files) safe_system HOMEBREW_BREW_FILE, *bottle_args - bintray.upload_bottle_json(Dir["*.json"], + bintray.upload_bottle_json(json_files, publish_package: !args.no_publish?, warn_on_error: args.warn_on_upload_failure?) end diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 19318c24e9..d35a42641a 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -37,8 +37,7 @@ module Homebrew description: "Do not warn if pulling to a branch besides master (useful for testing)." switch "--no-pbcopy", description: "Do not copy anything to the system clipboard." - switch :verbose - switch :debug + min_named 1 end end @@ -48,7 +47,7 @@ module Homebrew odie "You meant `git pull --rebase`." if ARGV[0] == "--rebase" - pull_args.parse + args = pull_args.parse # Passthrough Git environment variables for e.g. git am Utils.set_git_name_email!(author: false, committer: true) diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index fa537cf096..76266028c3 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -21,7 +21,7 @@ module Homebrew end def release_notes - release_notes_args.parse + args = release_notes_args.parse previous_tag = args.named.first previous_tag ||= Utils.popen_read( diff --git a/Library/Homebrew/dev-cmd/ruby.rb b/Library/Homebrew/dev-cmd/ruby.rb index 735fdb7c9a..8b8d8eecd3 100644 --- a/Library/Homebrew/dev-cmd/ruby.rb +++ b/Library/Homebrew/dev-cmd/ruby.rb @@ -13,23 +13,26 @@ module Homebrew Run a Ruby instance with Homebrew's libraries loaded, e.g. `brew ruby -e "puts :gcc.f.deps"` or `brew ruby script.rb`. EOS - switch "-r", - description: "Load a library using `require`." - switch "-e", - description: "Execute the given text string as a script." - switch :verbose - switch :debug + flag "-r=", + description: "Load a library using `require`." + flag "-e=", + description: "Execute the given text string as a script." end end def ruby - ruby_args.parse + args = ruby_args.parse + + ruby_sys_args = [] + ruby_sys_args << "-r#{args.r}" if args.r + ruby_sys_args << "-e #{args.e}" if args.e + ruby_sys_args += args.named begin safe_system RUBY_PATH, "-I", $LOAD_PATH.join(File::PATH_SEPARATOR), "-rglobal", "-rdev-cmd/irb", - *ARGV + *ruby_sys_args rescue ErrorDuringExecution => e exit e.status.exitstatus end diff --git a/Library/Homebrew/dev-cmd/sh.rb b/Library/Homebrew/dev-cmd/sh.rb index e1f103ec6b..5247cbea66 100644 --- a/Library/Homebrew/dev-cmd/sh.rb +++ b/Library/Homebrew/dev-cmd/sh.rb @@ -20,8 +20,7 @@ module Homebrew EOS flag "--env=", description: "Use the standard `PATH` instead of superenv's when `std` is passed." - switch :verbose - switch :debug + max_named 0 end end @@ -29,14 +28,14 @@ module Homebrew def sh args = sh_args.parse - ENV.activate_extensions!(args: args) + ENV.activate_extensions!(env: args.env) - if superenv?(args: args) + if superenv?(args.env) ENV.set_x11_env_if_installed ENV.deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? } end - ENV.setup_build_environment(args: args) - if superenv?(args: args) + ENV.setup_build_environment + if superenv?(args.env) # superenv stopped adding brew's bin but generally users will want it ENV["PATH"] = PATH.new(ENV["PATH"]).insert(1, HOMEBREW_PREFIX/"bin") end diff --git a/Library/Homebrew/dev-cmd/style.rb b/Library/Homebrew/dev-cmd/style.rb index 80ac45a233..7bb6fe8e75 100644 --- a/Library/Homebrew/dev-cmd/style.rb +++ b/Library/Homebrew/dev-cmd/style.rb @@ -29,14 +29,13 @@ module Homebrew comma_array "--except-cops", description: "Specify a comma-separated list to skip checking for violations of the "\ "listed RuboCop cops." - switch :verbose - switch :debug + conflicts "--only-cops", "--except-cops" end end def style - style_args.parse + args = style_args.parse target = if args.no_named? nil @@ -51,7 +50,7 @@ module Homebrew only_cops = args.only_cops except_cops = args.except_cops - options = { fix: args.fix? } + options = { fix: args.fix?, display_cop_names: args.display_cop_names? } if only_cops options[:only_cops] = only_cops elsif except_cops diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 2e75d05515..3506e55dbe 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -13,14 +13,13 @@ module Homebrew Generate the template files for a new tap. EOS - switch :verbose - switch :debug + named 1 end end def tap_new - tap_new_args.parse + args = tap_new_args.parse tap_name = args.named.first tap = Tap.fetch(args.named.first) diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index b05dbbd2fa..196652f9a5 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -25,15 +25,16 @@ module Homebrew description: "Test the head version of a formula." switch "--keep-tmp", description: "Retain the temporary files created for the test." - switch :verbose - switch :debug + switch "--retry", + description: "Retry if a testing fails." + conflicts "--devel", "--HEAD" min_named :formula end end def test - test_args.parse + args = test_args.parse require "formula_assertions" require "formula_free_port" @@ -70,7 +71,7 @@ module Homebrew next end - puts "Testing #{f.full_name}" + oh1 "Testing #{f.full_name}" env = ENV.to_hash @@ -108,6 +109,7 @@ module Homebrew end end rescue Exception => e # rubocop:disable Lint/RescueException + retry if retry_test?(f, args: args) ofail "#{f.full_name}: failed" puts e, e.backtrace ensure @@ -115,4 +117,16 @@ module Homebrew end end end + + def retry_test?(f, args:) + @test_failed ||= Set.new + if args.retry? && @test_failed.add?(f) + oh1 "Testing #{f.full_name} (again)" + f.clear_cache + true + else + Homebrew.failed = true + false + end + end end diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index e2facbfa5b..8025ffda3e 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -29,14 +29,13 @@ module Homebrew "specific line." flag "--seed=", description: "Randomise tests with the specified instead of a random seed." - switch :verbose - switch :debug + max_named 0 end end def tests - tests_args.parse + args = tests_args.parse Homebrew.install_bundler_gems! gem_user_dir = Gem.user_dir diff --git a/Library/Homebrew/dev-cmd/unpack.rb b/Library/Homebrew/dev-cmd/unpack.rb index 2aeaaf54ce..fbdd7c459e 100644 --- a/Library/Homebrew/dev-cmd/unpack.rb +++ b/Library/Homebrew/dev-cmd/unpack.rb @@ -22,16 +22,16 @@ module Homebrew switch "-g", "--git", description: "Initialise a Git repository in the unpacked source. This is useful for creating "\ "patches for the software." - switch :force - switch :verbose - switch :debug + switch "-f", "--force", + description: "Overwrite the destination directory if it already exists." + conflicts "--git", "--patch" min_named :formula end end def unpack - unpack_args.parse + args = unpack_args.parse formulae = args.formulae @@ -55,12 +55,13 @@ module Homebrew oh1 "Unpacking #{Formatter.identifier(f.full_name)} to: #{stage_dir}" - ENV["VERBOSE"] = "1" # show messages about tar - f.brew do - f.patch if args.patch? - cp_r getwd, stage_dir, preserve: true + # show messages about tar + with_env VERBOSE: "1" do + f.brew do + f.patch if args.patch? + cp_r getwd, stage_dir, preserve: true + end end - ENV["VERBOSE"] = nil next unless args.git? diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 456a7b38ec..40584b3b4b 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -26,7 +26,7 @@ module Homebrew end def update_license_data - update_license_data_args.parse + args = update_license_data_args.parse ohai "Updating SPDX license data..." latest_tag = GitHub.open_api(SPDX_API_URL)["tag_name"] diff --git a/Library/Homebrew/dev-cmd/update-python-resources.rb b/Library/Homebrew/dev-cmd/update-python-resources.rb new file mode 100644 index 0000000000..d41b77a72d --- /dev/null +++ b/Library/Homebrew/dev-cmd/update-python-resources.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require "cli/parser" +require "utils/pypi" + +module Homebrew + module_function + + def update_python_resources_args + Homebrew::CLI::Parser.new do + usage_banner <<~EOS + `update-python-resources` [] + + Update versions for PyPI resource blocks in . + EOS + switch "-p", "--print-only", + description: "Print the updated resource blocks instead of changing ." + switch "-s", "--silent", + description: "Suppress any output." + switch "--ignore-non-pypi-packages", + description: "Don't fail if is not a PyPI package." + flag "--version=", + description: "Use the specified when finding resources for . "\ + "If no version is specified, the current version for will be used." + min_named :formula + end + end + + def update_python_resources + args = update_python_resources_args.parse + + args.formulae.each do |formula| + PyPI.update_python_resources! formula, args.version, print_only: args.print_only?, silent: args.silent?, + ignore_non_pypi_packages: args.ignore_non_pypi_packages? + end + end +end diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index fdf208dd49..d05f445ea5 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -21,14 +21,13 @@ module Homebrew description: "Use the specified as the start commit." flag "--before=", description: "Use the commit at the specified as the start commit." - switch :verbose - switch :debug + max_named 0 end end def update_test - update_test_args.parse + args = update_test_args.parse ENV["HOMEBREW_UPDATE_TEST"] = "1" diff --git a/Library/Homebrew/dev-cmd/vendor-gems.rb b/Library/Homebrew/dev-cmd/vendor-gems.rb index 428223e38a..d702e7df69 100644 --- a/Library/Homebrew/dev-cmd/vendor-gems.rb +++ b/Library/Homebrew/dev-cmd/vendor-gems.rb @@ -13,7 +13,7 @@ module Homebrew Install and commit Homebrew's vendored gems. EOS - switch :debug + max_named 0 end end diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index f35099a448..29f5756994 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -5,24 +5,24 @@ require "extend/ENV/shared" require "extend/ENV/std" require "extend/ENV/super" -def superenv?(args:) - args&.env != "std" && Superenv.bin +def superenv?(env) + env != "std" && Superenv.bin end module EnvActivation - def activate_extensions!(args:) - if superenv?(args: args) + def activate_extensions!(env: nil) + if superenv?(env) extend(Superenv) else extend(Stdenv) end end - def with_build_environment(args:) + def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil) old_env = to_hash.dup tmp_env = to_hash.dup.extend(EnvActivation) - tmp_env.activate_extensions!(args: args) - tmp_env.setup_build_environment(args: args) + tmp_env.activate_extensions!(env: env) + tmp_env.setup_build_environment(cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch) replace(tmp_env) yield ensure diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index b3bae473d4..a4ed78a780 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -29,9 +29,11 @@ module SharedEnvExtension ].freeze # @private - def setup_build_environment(formula = nil, args: nil) + def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil) @formula = formula - @args = args + @cc = cc + @build_bottle = build_bottle + @bottle_arch = bottle_arch reset end @@ -163,7 +165,7 @@ module SharedEnvExtension # ENV.append_to_cflags "-I ./missing/includes" # end def compiler - @compiler ||= if (cc = @args.cc) + @compiler ||= if (cc = @cc) warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP fetch_compiler(cc, "--cc") elsif (cc = homebrew_cc) @@ -255,8 +257,8 @@ module SharedEnvExtension # @private def effective_arch - if @args&.build_bottle? && @args&.bottle_arch - @args.bottle_arch.to_sym + if @build_bottle && @bottle_arch + @bottle_arch.to_sym else Hardware.oldest_cpu end diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 6023114635..70e7656737 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -11,8 +11,8 @@ module Stdenv SAFE_CFLAGS_FLAGS = "-w -pipe" # @private - def setup_build_environment(formula = nil, args: nil) - super + def setup_build_environment(**options) + super(**options) self["HOMEBREW_ENV"] = "std" diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 3fc3be8f3b..ba3015a62f 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -36,8 +36,8 @@ module Superenv end # @private - def setup_build_environment(formula = nil, args: nil) - super + def setup_build_environment(**options) + super(**options) send(compiler) self["HOMEBREW_ENV"] = "super" @@ -64,7 +64,7 @@ module Superenv self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths self["HOMEBREW_DEPENDENCIES"] = determine_dependencies - self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix unless formula.nil? + self["HOMEBREW_FORMULA_PREFIX"] = @formula.prefix unless @formula.nil? # 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 diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb b/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb index e70ce40cce..b16178cac6 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb @@ -3,9 +3,9 @@ module SharedEnvExtension # @private def effective_arch - if @args&.build_bottle? && @args&.bottle_arch - @args.bottle_arch.to_sym - elsif @args&.build_bottle? + if @build_bottle && @bottle_arch + @bottle_arch.to_sym + elsif @build_bottle Hardware.oldest_cpu else :native diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/std.rb b/Library/Homebrew/extend/os/linux/extend/ENV/std.rb index ecaafb74a9..ddef1ee7ee 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/std.rb @@ -1,17 +1,18 @@ # frozen_string_literal: true module Stdenv - def setup_build_environment(formula = nil, args: nil) - generic_setup_build_environment(formula, args: args) + def setup_build_environment(**options) + generic_setup_build_environment(**options) prepend_path "CPATH", HOMEBREW_PREFIX/"include" prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib" prepend_path "LD_RUN_PATH", HOMEBREW_PREFIX/"lib" - return unless formula - prepend_path "CPATH", formula.include - prepend_path "LIBRARY_PATH", formula.lib - prepend_path "LD_RUN_PATH", formula.lib + return unless @formula + + prepend_path "CPATH", @formula.include + prepend_path "LIBRARY_PATH", @formula.lib + prepend_path "LD_RUN_PATH", @formula.lib end def libxml2 diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/super.rb b/Library/Homebrew/extend/os/linux/extend/ENV/super.rb index 45a92d6a39..965d7a2ce5 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/super.rb @@ -7,11 +7,11 @@ module Superenv end # @private - def setup_build_environment(formula = nil, args: nil) - generic_setup_build_environment(formula, args: args) + def setup_build_environment(**options) + generic_setup_build_environment(**options) self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2" self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path - self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(formula) + self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula) end def homebrew_extra_paths @@ -27,7 +27,7 @@ module Superenv def determine_rpath_paths(formula) PATH.new( - formula&.lib, + *formula&.lib, "#{HOMEBREW_PREFIX}/lib", PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing, ) diff --git a/Library/Homebrew/extend/os/linux/install.rb b/Library/Homebrew/extend/os/linux/install.rb index 7940896db0..073c0c813d 100644 --- a/Library/Homebrew/extend/os/linux/install.rb +++ b/Library/Homebrew/extend/os/linux/install.rb @@ -43,8 +43,8 @@ module Homebrew FileUtils.ln_sf ld_so, brew_ld_so end - def perform_preinstall_checks(all_fatal: false) - generic_perform_preinstall_checks(all_fatal: all_fatal) + def perform_preinstall_checks(all_fatal: false, cc: nil) + generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc) symlink_ld_so end end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index a3498e0e2b..5b017b19ce 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -372,19 +372,10 @@ module Homebrew "Xcode" end - all_sdks = locator.all_sdks - sdks_found_msg = unless all_sdks.empty? - <<~EOS - Homebrew found the following SDKs in the #{source} install: - #{locator.all_sdks.map(&:version).join("\n ")} - EOS - end - <<~EOS - Could not find an SDK that supports macOS #{MacOS.version}. - You may have have an outdated or incompatible #{source}. - #{sdks_found_msg} - Please update #{source} or uninstall it if no updates are available. + Your #{source} does not support macOS #{MacOS.version}. + It is either outdated or was modified. + Please update your #{source} or delete it if no updates are available. EOS end end diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index b59af01949..a83d9f3302 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -32,8 +32,8 @@ module Stdenv append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? end - def setup_build_environment(formula = nil, args: nil) - generic_setup_build_environment(formula, args: args) + def setup_build_environment(**options) + generic_setup_build_environment(**options) # sed is strict, and errors out when it encounters files with # mixed character sets @@ -41,7 +41,7 @@ module Stdenv self["LC_CTYPE"] = "C" # Add lib and include etc. from the current macosxsdk to compiler flags: - macosxsdk(formula: formula) + macosxsdk(formula: @formula) return unless MacOS::Xcode.without_clt? diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index 424d76c26f..f704e7dd13 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -106,7 +106,8 @@ module Superenv end # @private - def setup_build_environment(formula = nil, args: nil) + def setup_build_environment(**options) + formula = options[:formula] sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk if MacOS.sdk_root_needed? || sdk&.source == :xcode self["HOMEBREW_SDKROOT"] = sdk.path @@ -119,7 +120,7 @@ module Superenv self["HOMEBREW_SDKROOT"] = nil self["HOMEBREW_DEVELOPER_DIR"] = nil end - generic_setup_build_environment(formula, args: args) + generic_setup_build_environment(**options) # Filter out symbols known not to be defined since GNU Autotools can't # reliably figure this out with Xcode 8 and above. diff --git a/Library/Homebrew/fetch.rb b/Library/Homebrew/fetch.rb index 4db267aa72..7b0e76cd85 100644 --- a/Library/Homebrew/fetch.rb +++ b/Library/Homebrew/fetch.rb @@ -2,10 +2,10 @@ module Homebrew module Fetch - def fetch_bottle?(f) + def fetch_bottle?(f, args:) return true if args.force_bottle? && f.bottle return false unless f.bottle && f.pour_bottle? - return false if args.build_formula_from_source?(f) + return false if args.build_from_source_formulae.include?(f.full_name) return false unless f.bottle.compatible_cellar? true diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index a259e3ef0d..735f333424 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -101,6 +101,10 @@ class Formula # @private attr_reader :tap + # Whether or not to force the use of a bottle. + # @private + attr_reader :force_bottle + # The stable (and default) {SoftwareSpec} for this {Formula} # This contains all the attributes (e.g. URL, checksum) that apply to the # stable version of this formula. @@ -181,7 +185,7 @@ class Formula alias follow_installed_alias? follow_installed_alias # @private - def initialize(name, path, spec, alias_path: nil) + def initialize(name, path, spec, alias_path: nil, force_bottle: false) @name = name @path = path @alias_path = alias_path @@ -189,6 +193,8 @@ class Formula @revision = self.class.revision || 0 @version_scheme = self.class.version_scheme || 0 + @force_bottle = force_bottle + @tap = if path == Formulary.core_path(name) CoreTap.instance else @@ -1021,6 +1027,7 @@ class Formula TMPDIR: HOMEBREW_TEMP, TEMP: HOMEBREW_TEMP, TMP: HOMEBREW_TEMP, + _JAVA_OPTIONS: "-Djava.io.tmpdir=#{HOMEBREW_TEMP}", HOMEBREW_PATH: nil, PATH: ENV["HOMEBREW_PATH"], } @@ -1218,7 +1225,7 @@ class Formula def outdated_kegs(fetch_head: false) raise Migrator::MigrationNeededError, self if migration_needed? - cache_key = "#{name}-#{fetch_head}" + cache_key = "#{full_name}-#{fetch_head}" Formula.cache[:outdated_kegs] ||= {} Formula.cache[:outdated_kegs][cache_key] ||= begin all_kegs = [] @@ -1454,12 +1461,14 @@ class Formula # @private def self.each files.each do |file| - yield Formulary.factory(file) - rescue => e - # Don't let one broken formula break commands. But do complain. - onoe "Failed to import: #{file}" - puts e - next + yield begin + Formulary.factory(file) + rescue FormulaUnavailableError => e + # Don't let one broken formula break commands. But do complain. + onoe "Failed to import: #{file}" + puts e + next + end end end @@ -1594,7 +1603,7 @@ class Formula # @private def opt_or_installed_prefix_keg Formula.cache[:opt_or_installed_prefix_keg] ||= {} - Formula.cache[:opt_or_installed_prefix_keg][name] ||= if optlinked? && opt_prefix.exist? + Formula.cache[:opt_or_installed_prefix_keg][full_name] ||= if optlinked? && opt_prefix.exist? Keg.new(opt_prefix) elsif (latest_installed_prefix = installed_prefixes.last) Keg.new(latest_installed_prefix) @@ -1626,7 +1635,7 @@ class Formula # Returns a list of Formula objects that are required at runtime. # @private def runtime_formula_dependencies(read_from_tab: true, undeclared: true) - cache_key = "#{name}-#{read_from_tab}-#{undeclared}" + cache_key = "#{full_name}-#{read_from_tab}-#{undeclared}" Formula.cache[:runtime_formula_dependencies] ||= {} Formula.cache[:runtime_formula_dependencies][cache_key] ||= runtime_dependencies( @@ -1644,10 +1653,10 @@ class Formula # that we don't end up with something `Formula#runtime_dependencies` can't # read from a `Tab`. Formula.cache[:runtime_installed_formula_dependents] = {} - Formula.cache[:runtime_installed_formula_dependents][name] ||= Formula.installed - .select(&:opt_or_installed_prefix_keg) - .select(&:runtime_dependencies) - .select do |f| + Formula.cache[:runtime_installed_formula_dependents][full_name] ||= Formula.installed + .select(&:opt_or_installed_prefix_keg) + .select(&:runtime_dependencies) + .select do |f| f.runtime_formula_dependencies.any? do |dep| full_name == dep.full_name rescue @@ -1718,6 +1727,8 @@ class Formula "linked_keg" => linked_version&.to_s, "pinned" => pinned?, "outdated" => outdated?, + "deprecated" => deprecated?, + "disabled" => disabled?, } %w[stable devel].each do |spec_sym| @@ -1803,6 +1814,7 @@ class Formula PATH: PATH.new(ENV["PATH"], HOMEBREW_PREFIX/"bin"), HOMEBREW_PATH: nil, }.merge(common_stage_test_env) + test_env[:_JAVA_OPTIONS] += " -Djava.io.tmpdir=#{HOMEBREW_TEMP}" ENV.clear_sensitive_environment! Utils.set_git_name_email! @@ -2126,7 +2138,7 @@ class Formula # Common environment variables used at both build and test time def common_stage_test_env { - _JAVA_OPTIONS: "#{ENV["_JAVA_OPTIONS"]&.+(" ")}-Duser.home=#{HOMEBREW_CACHE}/java_cache", + _JAVA_OPTIONS: "-Duser.home=#{HOMEBREW_CACHE}/java_cache", GOCACHE: "#{HOMEBREW_CACHE}/go_cache", GOPATH: "#{HOMEBREW_CACHE}/go_mod_cache", CARGO_HOME: "#{HOMEBREW_CACHE}/cargo_cache", @@ -2206,9 +2218,16 @@ class Formula # @!attribute [w] # The SPDX ID of the open-source license that the formula uses. # Shows when running `brew info`. - # + # Multiple licenses means that the software is licensed under multiple licenses. + # Do not use multiple licenses if e.g. different parts are under different licenses. #
license "BSD-2-Clause"
- attr_rw :license + def license(args = nil) + if args.nil? + @licenses + else + @licenses = Array(args) + end + end # @!attribute [w] homepage # The homepage for the software. Used by users to get more information @@ -2363,6 +2382,16 @@ class Formula stable.build end + # Get the `BUILD_FLAGS` from the formula's namespace set in `Formulary::load_formula`. + # @private + def build_flags + namespace = to_s.split("::")[0..-2].join("::") + return [] if namespace.empty? + + mod = const_get(namespace) + mod.const_get(:BUILD_FLAGS) + end + # @!attribute [w] stable # Allows adding {.depends_on} and {Patch}es just to the {.stable} {SoftwareSpec}. # This is required instead of using a conditional. @@ -2376,7 +2405,7 @@ class Formula # depends_on "libffi" # end def stable(&block) - @stable ||= SoftwareSpec.new + @stable ||= SoftwareSpec.new(flags: build_flags) return @stable unless block_given? @stable.instance_eval(&block) @@ -2396,7 +2425,7 @@ class Formula # end # @private def devel(&block) - @devel ||= SoftwareSpec.new + @devel ||= SoftwareSpec.new(flags: build_flags) return @devel unless block_given? odeprecated "'devel' blocks in formulae", "'head' blocks or @-versioned formulae" @@ -2416,7 +2445,7 @@ class Formula # or (if autodetect fails): #
head "https://hg.is.awesome.but.git.has.won.example.com/", :using => :hg
def head(val = nil, specs = {}, &block) - @head ||= HeadSoftwareSpec.new + @head ||= HeadSoftwareSpec.new(flags: build_flags) if block_given? @head.instance_eval(&block) elsif val diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index 97b8b5e64b..0be15b4f88 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -134,7 +134,7 @@ module Homebrew # depends_on "cmake" => :build <% end %> - <% if mode == :perl || mode == :python %> + <% if mode == :perl %> # Additional dependency # resource "" do # url "" diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 5ac720ebee..d9b5e6d1c3 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -21,6 +21,7 @@ require "cmd/install" require "find" class FormulaInstaller + include Homebrew::Install include FormulaCellarChecks extend Predicable @@ -39,14 +40,18 @@ class FormulaInstaller attr_reader :formula attr_accessor :cc, :env, :options, :build_bottle, :bottle_arch, - :installed_as_dependency, :installed_on_request, :link_keg + :build_from_source_formulae, :include_test_formulae, + :installed_as_dependency, :installed_on_request, :link_keg, :other_installers mode_attr_accessor :show_summary_heading, :show_header - mode_attr_accessor :build_from_source, :force_bottle, :include_test - mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git, :force, :keep_tmp + mode_attr_accessor :force_bottle, :ignore_deps, :only_deps, :interactive, :git, :force, :keep_tmp mode_attr_accessor :verbose, :debug, :quiet - def initialize(formula, force_bottle: false, include_test: false, build_from_source: false, cc: nil) + def initialize(formula, + force_bottle: false, + include_test_formulae: [], + build_from_source_formulae: [], + cc: nil) @formula = formula @env = nil @force = false @@ -55,11 +60,11 @@ class FormulaInstaller @show_header = false @ignore_deps = false @only_deps = false - @build_from_source = build_from_source + @build_from_source_formulae = build_from_source_formulae @build_bottle = false @bottle_arch = nil @force_bottle = force_bottle - @include_test = include_test + @include_test_formulae = include_test_formulae @interactive = false @git = false @cc = cc @@ -93,15 +98,31 @@ class FormulaInstaller # When no build tools are available and build flags are passed through ARGV, # it's necessary to interrupt the user before any sort of installation - # can proceed. Only invoked when the user has no developer tools. - def self.prevent_build_flags - build_flags = Homebrew.args.collect_build_args + # can proceed. Only raises when the user has no developer tools. + def self.prevent_build_flags(args) + return if DevelopmentTools.installed? + + build_flags = [] + + build_flags << "--HEAD" if args.HEAD? + build_flags << "--universal" if args.universal? + build_flags << "--build-bottle" if args.build_bottle? + build_flags << "--build-from-source" if args.build_from_source? + return if build_flags.empty? - all_bottled = Homebrew.args.formulae.all?(&:bottled?) + all_bottled = args.formulae.all?(&:bottled?) raise BuildFlagsError.new(build_flags, bottled: all_bottled) end + def build_from_source? + build_from_source_formulae.include?(formula.full_name) + end + + def include_test? + include_test_formulae.include?(formula.full_name) + end + def build_bottle? return false unless @build_bottle @@ -144,7 +165,7 @@ class FormulaInstaller def install_bottle_for?(dep, build) return pour_bottle? if dep == formula - return false if Homebrew.args.build_formula_from_source?(dep) + return false if build_from_source_formulae.include?(dep.full_name) return false unless dep.bottle && dep.pour_bottle? return false unless build.used_options.empty? return false unless dep.bottle.compatible_cellar? @@ -239,9 +260,7 @@ class FormulaInstaller lock start_time = Time.now - if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed? - Homebrew::Install.perform_build_from_source_checks - end + perform_build_from_source_checks if !formula.bottle_unneeded? && !pour_bottle? && DevelopmentTools.installed? # not in initialize so upgrade can unlink the active keg before calling this # function but after instantiating this class so that it can avoid having to @@ -475,7 +494,7 @@ class FormulaInstaller if req.prune_from_option?(build) Requirement.prune - elsif req.satisfied?(args: Homebrew.args) + elsif req.satisfied?(env: env, cc: cc, build_bottle: @build_bottle, bottle_arch: bottle_arch) Requirement.prune elsif (req.build? || req.test?) && !keep_build_test Requirement.prune @@ -505,7 +524,7 @@ class FormulaInstaller ) keep_build_test = false - keep_build_test ||= dep.test? && include_test? && Homebrew.args.include_formula_test_deps?(dependent) + keep_build_test ||= dep.test? && include_test? && include_test_formulae.include?(dependent.full_name) keep_build_test ||= dep.build? && !install_bottle_for?(dependent, build) && !dependent.latest_version_installed? if dep.prune_from_option?(build) @@ -582,9 +601,9 @@ class FormulaInstaller def fetch_dependency(dep) df = dep.to_formula - fi = FormulaInstaller.new(df, force_bottle: false, - include_test: Homebrew.args.include_formula_test_deps?(df), - build_from_source: Homebrew.args.build_formula_from_source?(df)) + fi = FormulaInstaller.new(df, force_bottle: false, + include_test_formulae: include_test_formulae, + build_from_source_formulae: build_from_source_formulae) fi.force = force? fi.keep_tmp = keep_tmp? @@ -623,9 +642,9 @@ class FormulaInstaller EOS end - fi = FormulaInstaller.new(df, force_bottle: false, - include_test: Homebrew.args.include_formula_test_deps?(df), - build_from_source: Homebrew.args.build_formula_from_source?(df)) + fi = FormulaInstaller.new(df, force_bottle: false, + include_test_formulae: include_test_formulae, + build_from_source_formulae: build_from_source_formulae) fi.options |= tab.used_options fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) @@ -763,12 +782,6 @@ class FormulaInstaller args << "--devel" end - formula.options.each do |opt| - name = opt.name[/^([^=]+)=$/, 1] - value = Homebrew.args.value(name) if name - args << "--#{name}=#{value}" if value - end - args end @@ -1123,18 +1136,18 @@ class FormulaInstaller next if @ignore_deps dep_f = dep.to_formula - next unless forbidden_licenses.include? dep_f.license + next unless dep_f.license.all? { |license| forbidden_licenses.include? license } raise CannotInstallFormulaError, <<~EOS - The installation of #{formula.name} has a dependency on #{dep.name} with a forbidden license #{dep_f.license}. + The installation of #{formula.name} has a dependency on #{dep.name} where all its licenses are forbidden: #{dep_f.license}. EOS end return if @only_deps - return unless forbidden_licenses.include? formula.license + return unless formula.license.all? { |license| forbidden_licenses.include? license } raise CannotInstallFormulaError, <<~EOS - #{formula.name} has a forbidden license #{formula.license}. + #{formula.name}'s licenses are all forbidden: #{formula.license}. EOS end end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 336f34f757..80600d7e34 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -27,12 +27,16 @@ module Formulary cache.fetch(path) end - def self.load_formula(name, path, contents, namespace) + def self.load_formula(name, path, contents, namespace, flags:) raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula? mod = Module.new const_set(namespace, mod) + begin + # Set `BUILD_FLAGS` in the formula's namespace so we can + # access them from within the formula's class scope. + mod.const_set(:BUILD_FLAGS, flags) mod.module_eval(contents, path) rescue NameError, ArgumentError, ScriptError => e $stderr.puts e.backtrace if Homebrew::EnvConfig.developer? @@ -51,16 +55,16 @@ module Formulary end end - def self.load_formula_from_path(name, path) + def self.load_formula_from_path(name, path, flags:) contents = path.open("r") { |f| ensure_utf8_encoding(f).read } namespace = "FormulaNamespace#{Digest::MD5.hexdigest(path.to_s)}" - klass = load_formula(name, path, contents, namespace) + klass = load_formula(name, path, contents, namespace, flags: flags) cache[path] = klass end - def self.resolve(name, spec: nil) + def self.resolve(name, spec: nil, force_bottle: false, flags: []) if name.include?("/") || File.exist?(name) - f = factory(name, *spec) + f = factory(name, *spec, force_bottle: force_bottle, flags: flags) if f.any_version_installed? tab = Tab.for_formula(f) resolved_spec = spec || tab.spec @@ -73,8 +77,8 @@ module Formulary end else rack = to_rack(name) - alias_path = factory(name).alias_path - f = from_rack(rack, *spec, alias_path: alias_path) + alias_path = factory(name, force_bottle: force_bottle, flags: flags).alias_path + f = from_rack(rack, *spec, alias_path: alias_path, force_bottle: force_bottle, flags: flags) end # If this formula was installed with an alias that has since changed, @@ -121,22 +125,23 @@ module Formulary # # `alias_path` can be overridden here in case an alias was used to refer to # a formula that was loaded in another way. - def get_formula(spec, alias_path: nil) - klass.new(name, path, spec, alias_path: alias_path || self.alias_path) + def get_formula(spec, alias_path: nil, force_bottle: false, flags: []) + alias_path ||= self.alias_path + klass(flags: flags).new(name, path, spec, alias_path: alias_path, force_bottle: force_bottle) end - def klass - load_file unless Formulary.formula_class_defined?(path) + def klass(flags:) + load_file(flags: flags) unless Formulary.formula_class_defined?(path) Formulary.formula_class_get(path) end private - def load_file + def load_file(flags:) $stderr.puts "#{$PROGRAM_NAME} (#{self.class.name}): loading #{path}" if Homebrew.args.debug? raise FormulaUnavailableError, name unless path.file? - Formulary.load_formula_from_path(name, path) + Formulary.load_formula_from_path(name, path, flags: flags) end end @@ -161,10 +166,10 @@ module Formulary super name, Formulary.path(full_name) end - def get_formula(spec, **) + def get_formula(spec, force_bottle: false, flags: [], **) contents = Utils::Bottles.formula_contents @bottle_filename, name: name formula = begin - Formulary.from_contents name, @bottle_filename, contents, spec + Formulary.from_contents(name, @bottle_filename, contents, spec, force_bottle: force_bottle, flags: flags) rescue FormulaUnreadableError => e opoo <<~EOS Unreadable formula in #{@bottle_filename}: @@ -205,7 +210,7 @@ module Formulary super formula, HOMEBREW_CACHE_FORMULA/File.basename(uri.path) end - def load_file + def load_file(flags:) if url =~ %r{githubusercontent.com/[\w-]+/[\w-]+/[a-f0-9]{40}(/Formula)?/([\w+-.@]+).rb} formula_name = Regexp.last_match(2) odeprecated "Installation of #{formula_name} from a GitHub commit URL", @@ -270,7 +275,7 @@ module Formulary [name, path] end - def get_formula(spec, alias_path: nil) + def get_formula(spec, alias_path: nil, force_bottle: false, flags: []) super rescue FormulaUnreadableError => e raise TapFormulaUnreadableError.new(tap, name, e.formula_error), "", e.backtrace @@ -280,7 +285,7 @@ module Formulary raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace end - def load_file + def load_file(flags:) super rescue MethodDeprecatedError => e e.issues_url = tap.issues_url || tap.to_s @@ -308,10 +313,10 @@ module Formulary super name, path end - def klass + def klass(flags:) $stderr.puts "#{$PROGRAM_NAME} (#{self.class.name}): loading #{path}" if Homebrew.args.debug? - namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents)}" - Formulary.load_formula(name, path, contents, namespace) + namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents.to_s)}" + Formulary.load_formula(name, path, contents, namespace, flags: flags) end end @@ -322,7 +327,7 @@ module Formulary # * a formula pathname # * a formula URL # * a local bottle reference - def self.factory(ref, spec = :stable, alias_path: nil, from: nil) + def self.factory(ref, spec = :stable, alias_path: nil, from: nil, force_bottle: false, flags: []) raise ArgumentError, "Formulae must have a ref!" unless ref cache_key = "#{ref}-#{spec}-#{alias_path}-#{from}" @@ -331,7 +336,8 @@ module Formulary return cache[:formulary_factory][cache_key] end - formula = loader_for(ref, from: from).get_formula(spec, alias_path: alias_path) + formula = loader_for(ref, from: from).get_formula(spec, alias_path: alias_path, + force_bottle: force_bottle, flags: flags) if factory_cached? cache[:formulary_factory] ||= {} cache[:formulary_factory][cache_key] ||= formula @@ -345,14 +351,15 @@ module Formulary # The :alias_path option will be used if the formula is found not to be # installed, and discarded if it is installed because the alias_path used # to install the formula will be set instead. - def self.from_rack(rack, spec = nil, alias_path: nil) + def self.from_rack(rack, spec = nil, alias_path: nil, force_bottle: false, flags: []) kegs = rack.directory? ? rack.subdirs.map { |d| Keg.new(d) } : [] keg = kegs.find(&:linked?) || kegs.find(&:optlinked?) || kegs.max_by(&:version) if keg from_keg(keg, spec, alias_path: alias_path) else - factory(rack.basename.to_s, spec || :stable, alias_path: alias_path, from: :rack) + factory(rack.basename.to_s, spec || :stable, alias_path: alias_path, from: :rack, + force_bottle: force_bottle, flags: flags) end end @@ -365,19 +372,22 @@ module Formulary # Return a Formula instance for the given keg. # It will auto resolve formula's spec when requested spec is nil - def self.from_keg(keg, spec = nil, alias_path: nil) + def self.from_keg(keg, spec = nil, alias_path: nil, force_bottle: false, flags: []) tab = Tab.for_keg(keg) tap = tab.tap spec ||= tab.spec f = if tap.nil? - factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg) + factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg, + force_bottle: force_bottle, flags: flags) else begin - factory("#{tap}/#{keg.rack.basename}", spec, alias_path: alias_path, from: :keg) + factory("#{tap}/#{keg.rack.basename}", spec, alias_path: alias_path, from: :keg, + force_bottle: force_bottle, flags: flags) rescue FormulaUnavailableError # formula may be migrated to different tap. Try to search in core and all taps. - factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg) + factory(keg.rack.basename.to_s, spec, alias_path: alias_path, from: :keg, + force_bottle: force_bottle, flags: flags) end end f.build = tab @@ -387,8 +397,9 @@ module Formulary end # Return a Formula instance directly from contents - def self.from_contents(name, path, contents, spec = :stable) - FormulaContentsLoader.new(name, path, contents).get_formula(spec) + def self.from_contents(name, path, contents, spec = :stable, alias_path: nil, force_bottle: false, flags: []) + FormulaContentsLoader.new(name, path, contents) + .get_formula(spec, alias_path: alias_path, force_bottle: force_bottle, flags: flags) end def self.to_rack(ref) diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index dbdca9a57c..b100822fc0 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -82,7 +82,7 @@ module Homebrew end def args - @args ||= CLI::Args.new(set_default_args: true) + @args ||= CLI::Args.new end def messages diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index 57196edf7c..53c3e46d56 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -40,30 +40,30 @@ module Homebrew module Help module_function - def help(cmd = nil, flags = {}) - # Resolve command aliases and find file containing the implementation. - path = Commands.path(cmd) if cmd - - # Display command-specific (or generic) help in response to `UsageError`. - if (error_message = flags[:usage_error]) - $stderr.puts path ? command_help(cmd, path) : HOMEBREW_HELP - $stderr.puts - onoe error_message - exit 1 - end - - # Handle `brew` (no arguments). - if flags[:empty_argv] - $stderr.puts HOMEBREW_HELP - exit 1 - end - - # Handle `brew (-h|--help|--usage|-?|help)` (no other arguments). + def help(cmd = nil, empty_argv: false, usage_error: nil) if cmd.nil? + # Handle `brew` (no arguments). + if empty_argv + $stderr.puts HOMEBREW_HELP + exit 1 + end + + # Handle `brew (-h|--help|--usage|-?|help)` (no other arguments). puts HOMEBREW_HELP exit 0 end + # Resolve command aliases and find file containing the implementation. + path = Commands.path(cmd) + + # Display command-specific (or generic) help in response to `UsageError`. + if usage_error + $stderr.puts path ? command_help(cmd, path) : HOMEBREW_HELP + $stderr.puts + onoe usage_error + exit 1 + end + # Resume execution in `brew.rb` for unknown commands. return if path.nil? @@ -95,6 +95,8 @@ module Homebrew cmd_parser = CLI::Parser.from_cmd_path(path) return unless cmd_parser + # Try parsing arguments here in order to show formula options in help output. + cmd_parser.parse(Homebrew.args.remaining, ignore_invalid_options: true) cmd_parser.generate_help_text end diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index f68572df08..f858d8f9d8 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -39,20 +39,20 @@ module Homebrew end end - def check_cc_argv - return unless Homebrew.args.cc + def check_cc_argv(cc) + return unless cc @checks ||= Diagnostic::Checks.new opoo <<~EOS - You passed `--cc=#{Homebrew.args.cc}`. + You passed `--cc=#{cc}`. #{@checks.please_create_pull_requests} EOS end - def perform_preinstall_checks(all_fatal: false) + def perform_preinstall_checks(all_fatal: false, cc: nil) check_cpu attempt_directory_creation - check_cc_argv + check_cc_argv(cc) diagnostic_checks(:supported_configuration_checks, fatal: all_fatal) diagnostic_checks(:fatal_preinstall_checks) end diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index c56c939bf7..ccf250e6df 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -4,6 +4,7 @@ require "keg_relocate" require "language/python" require "lock_file" require "ostruct" +require "extend/cachable" class Keg extend Cachable diff --git a/Library/Homebrew/messages.rb b/Library/Homebrew/messages.rb index d0b371a2ec..18187a8447 100644 --- a/Library/Homebrew/messages.rb +++ b/Library/Homebrew/messages.rb @@ -20,9 +20,9 @@ class Messages @install_times.push(formula: f.name, time: elapsed_time) end - def display_messages + def display_messages(display_times: false) display_caveats - display_install_times if Homebrew.args.display_times? + display_install_times if display_times end def display_caveats diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 3329e164bc..30d0603b0e 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -97,18 +97,18 @@ class Migrator true end - def self.migrate_if_needed(formula) + def self.migrate_if_needed(formula, force:) return unless Migrator.needs_migration?(formula) begin - migrator = Migrator.new(formula) + migrator = Migrator.new(formula, force: force) migrator.migrate rescue => e onoe e end end - def initialize(formula, force: Homebrew.args.force?) + def initialize(formula, force: false) @oldname = formula.oldname @newname = formula.name raise MigratorNoOldnameError, formula unless oldname diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index 06baa117f1..0d6794d252 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -1,45 +1,7 @@ # frozen_string_literal: true -if HOMEBREW_PATCHELF_RB - require "utils/gems" - Homebrew.install_bundler_gems! - require "patchelf" - - module PatchELF - refine Patcher do - # patchelf.rb throws exception when the requested entry is missing in the ELF file. - # We prefer an API that returns nil. - - def rpath - super - rescue PatchELF::MissingTagError - nil - end - - def runpath - super - rescue PatchELF::MissingTagError - nil - end - - def soname - super - rescue PatchELF::MissingTagError - nil - end - - def interpreter - super - rescue PatchELF::MissingSegmentError - nil - end - end - end -end - # @see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header module ELFShim - using PatchELF if HOMEBREW_PATCHELF_RB MAGIC_NUMBER_OFFSET = 0 MAGIC_NUMBER_ASCII = "\x7fELF" @@ -252,7 +214,9 @@ module ELFShim def patchelf_patcher return unless HOMEBREW_PATCHELF_RB - @patchelf_patcher ||= PatchELF::Patcher.new to_s, logging: false + Homebrew.install_bundler_gems! + require "patchelf" + @patchelf_patcher ||= PatchELF::Patcher.new to_s, on_error: :silent end def metadata diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/expat.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/expat.pc deleted file mode 100644 index 7f611de4f3..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/expat.pc +++ /dev/null @@ -1,12 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: expat -Version: 2.2.8 -Description: expat XML parser -URL: http://www.libexpat.org -Libs: -L${libdir} -lexpat -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libcurl.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libcurl.pc deleted file mode 100644 index 5355350d97..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libcurl.pc +++ /dev/null @@ -1,40 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 2001 - 2018, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at https://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# This should most probably benefit from getting a "Requires:" field added -# dynamically by configure. -# -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include -supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP" -supported_features="AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO MultiSSL NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy" - -Name: libcurl -URL: https://curl.haxx.se/ -Description: Library to transfer files with ftp, http, etc. -Version: 7.64.1 -Libs: -L${libdir} -lcurl -Libs.private: -lldap -lz -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libedit.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libedit.pc deleted file mode 100644 index dcf7ce187a..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libedit.pc +++ /dev/null @@ -1,12 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libedit -Description: command line editor library provides generic line editing, history, and tokenization functions. -Version: 3.0 -Requires: -Libs: -L${libdir} -ledit -Cflags: -I${includedir}/editline diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libexslt.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libexslt.pc deleted file mode 100644 index 9e28e8c76d..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libexslt.pc +++ /dev/null @@ -1,13 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include - - -Name: libexslt -Version: 0.8.17 -Description: EXSLT Extension library -Requires: libxml-2.0 -Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libffi.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libffi.pc deleted file mode 100644 index 93bd99e9d2..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libffi.pc +++ /dev/null @@ -1,12 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -toolexeclibdir=${libdir} -includedir=${prefix}/include/ffi - -Name: libffi -Description: Library supporting Foreign Function Interfaces -Version: 3.3-rc0 -Libs: -L${toolexeclibdir} -lffi -Cflags: -I${includedir} diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libxml-2.0.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libxml-2.0.pc deleted file mode 100644 index 7ed00b1f27..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libxml-2.0.pc +++ /dev/null @@ -1,14 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include -modules=1 - -Name: libXML -Version: 2.9.4 -Description: libXML library version2. -Requires: -Libs: -L${libdir} -lxml2 -Libs.private: -lz -lpthread -licucore -lm -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/libxslt.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/libxslt.pc deleted file mode 100644 index 6d2458e3dd..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/libxslt.pc +++ /dev/null @@ -1,13 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include - - -Name: libxslt -Version: 1.1.29 -Description: XSLT library version 2. -Requires: libxml-2.0 -Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/ncurses.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/ncurses.pc deleted file mode 100644 index 19df0804d6..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/ncurses.pc +++ /dev/null @@ -1,14 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include -major_version=5 -version=5.7.20081102 - -Name: ncurses -Description: ncurses 5.7 library -Version: ${version} -Requires: -Libs: -L${libdir} -lncurses -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/ncursesw.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/ncursesw.pc deleted file mode 100644 index 85000fda6b..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/ncursesw.pc +++ /dev/null @@ -1,14 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include -major_version=5 -version=5.7.20081102 - -Name: ncursesw -Description: ncurses 5.7 library -Version: ${version} -Requires: -Libs: -L${libdir} -lncurses -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/sqlite3.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/sqlite3.pc deleted file mode 100644 index ccb697388d..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/sqlite3.pc +++ /dev/null @@ -1,12 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: SQLite -Description: SQL database engine -Version: 3.31.1 -Libs: -L${libdir} -lsqlite3 -Libs.private: -Cflags: diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/uuid.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/uuid.pc deleted file mode 100644 index f10358b624..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/uuid.pc +++ /dev/null @@ -1,14 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include/uuid - -Name: uuid -Description: Universally unique id library -Version: 1.0 - -Requires: -Libs: -Cflags: -I${includedir} diff --git a/Library/Homebrew/os/mac/pkgconfig/10.16/zlib.pc b/Library/Homebrew/os/mac/pkgconfig/10.16/zlib.pc deleted file mode 100644 index 1be09ff9de..0000000000 --- a/Library/Homebrew/os/mac/pkgconfig/10.16/zlib.pc +++ /dev/null @@ -1,14 +0,0 @@ -homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.16.sdk -prefix=${homebrew_sdkroot}/usr -exec_prefix=/usr -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: zlib -Description: zlib compression library -Version: 1.2.11 - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index f80c225744..2134637344 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -7,7 +7,7 @@ module OS module Mac class Version < ::Version SYMBOLS = { - big_sur: Hardware::CPU.arm? ? "11.0" : "10.16", + big_sur: "11.0", catalina: "10.15", mojave: "10.14", high_sierra: "10.13", diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 6190e267f4..5f1a23d663 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -15,7 +15,7 @@ module OS def latest_version latest_stable = "11.5" case MacOS.version - when "11.0", "10.16" then "12.0" + when "11.0" then "12.0" when "10.15" then latest_stable when "10.14" then "11.3.1" when "10.13" then "10.1" @@ -37,7 +37,7 @@ module OS # also in beta). def minimum_version case MacOS.version - when "11.0", "10.16" then "12.0" + when "11.0" then "12.0" when "10.15" then "11.0" when "10.14" then "10.2" when "10.13" then "9.0" @@ -257,7 +257,7 @@ module OS # and our CI systems have been updated. def latest_clang_version case MacOS.version - when "11.0", "10.16" then "1200.0.22.7" + when "11.0" then "1200.0.22.7" when "10.15" then "1103.0.32.59" when "10.14" then "1001.0.46.4" when "10.13" then "1000.10.44.2" @@ -273,7 +273,7 @@ module OS # that macOS version. def minimum_version case MacOS.version - when "11.0", "10.16" then "12.0.0" + when "11.0" then "12.0.0" when "10.15" then "11.0.0" when "10.14" then "10.0.0" when "10.13" then "9.0.0" diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index 03aea114e4..f2a92a0616 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -159,6 +159,10 @@ class ExternalPatch end end end + rescue ErrorDuringExecution => e + f = resource.owner.owner + cmd, *args = e.cmd + raise BuildError.new(f, cmd, args, ENV.to_hash) end def inspect diff --git a/Library/Homebrew/postinstall.rb b/Library/Homebrew/postinstall.rb index d35e3b886c..557fd3387a 100644 --- a/Library/Homebrew/postinstall.rb +++ b/Library/Homebrew/postinstall.rb @@ -10,13 +10,13 @@ require "cli/parser" require "cmd/postinstall" begin - Homebrew.postinstall_args.parse + args = Homebrew.postinstall_args.parse error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) trap("INT", old_trap) - formula = Homebrew.args.resolved_formulae.first + formula = args.resolved_formulae.first formula.extend(Debrew::Formula) if Homebrew.args.debug? formula.run_post_install rescue Exception => e # rubocop:disable Lint/RescueException diff --git a/Library/Homebrew/reinstall.rb b/Library/Homebrew/reinstall.rb index b7916a94a7..77645bf7c0 100644 --- a/Library/Homebrew/reinstall.rb +++ b/Library/Homebrew/reinstall.rb @@ -18,13 +18,13 @@ module Homebrew backup keg end - build_options = BuildOptions.new(Options.create(Homebrew.args.flags_only), f.options) + build_options = BuildOptions.new(Options.create(args.flags_only), f.options) options = build_options.used_options options |= f.build.used_options options &= f.options - fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, - build_from_source: args.build_from_source?) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, + build_from_source_formulae: args.build_from_source_formulae) fi.options = options fi.force = args.force? fi.keep_tmp = args.keep_tmp? diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 0c42c3721a..5a96adccce 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -53,11 +53,14 @@ class Requirement # Overriding {#satisfied?} is unsupported. # Pass a block or boolean to the satisfy DSL method instead. - def satisfied?(args: nil) + def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil) satisfy = self.class.satisfy return true unless satisfy - @satisfied_result = satisfy.yielder(args: args) { |p| instance_eval(&p) } + @satisfied_result = + satisfy.yielder(env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch) do |p| + instance_eval(&p) + end return false unless @satisfied_result true @@ -81,8 +84,8 @@ class Requirement # Overriding {#modify_build_environment} is unsupported. # Pass a block to the env DSL method instead. - def modify_build_environment(args:) - satisfied?(args: args) + def modify_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil) + satisfied?(env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch) instance_eval(&env_proc) if env_proc # XXX If the satisfy block returns a Pathname, then make sure that it @@ -135,7 +138,11 @@ class Requirement klass = self.class.name || self.class.to_s klass.sub!(/(Dependency|Requirement)$/, "") klass.sub!(/^(\w+::)*/, "") - klass.downcase + return klass.downcase if klass.present? + + return @cask if @cask.present? + + "" end def which(cmd) @@ -181,12 +188,16 @@ class Requirement @proc = block end - def yielder(args:) + def yielder(env: nil, cc: nil, build_bottle: false, bottle_arch: nil) if instance_variable_defined?(:@satisfied) @satisfied elsif @options[:build_env] require "extend/ENV" - ENV.with_build_environment(args: args) { yield @proc } + ENV.with_build_environment( + env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch, + ) do + yield @proc + end else yield @proc end diff --git a/Library/Homebrew/rubocops/cask/homepage_matches_url.rb b/Library/Homebrew/rubocops/cask/homepage_matches_url.rb index ca2bea9d6d..7d80c6405a 100644 --- a/Library/Homebrew/rubocops/cask/homepage_matches_url.rb +++ b/Library/Homebrew/rubocops/cask/homepage_matches_url.rb @@ -9,7 +9,7 @@ module RuboCop # or if it doesn't, checks if a comment in the form # `# example.com was verified as official when first introduced to the cask` # is present. - class HomepageMatchesUrl < Cop # rubocop:disable Metrics/ClassLength + class HomepageMatchesUrl < Cop extend Forwardable include CaskHelp @@ -134,7 +134,13 @@ module RuboCop def url_match_homepage?(stanza) host = extract_url(stanza).downcase - host_uri = URI(remove_non_ascii(host)) + host_uri = begin + URI(remove_non_ascii(host)) + rescue URI::InvalidURIError + # Can't check if we can't parse. + return true + end + host = if host.match?(/:\d/) && host_uri.port != 80 "#{host_uri.host}:#{host_uri.port}" else diff --git a/Library/Homebrew/rubocops/patches.rb b/Library/Homebrew/rubocops/patches.rb index 13cffc6dca..25afeb601c 100644 --- a/Library/Homebrew/rubocops/patches.rb +++ b/Library/Homebrew/rubocops/patches.rb @@ -38,6 +38,15 @@ module RuboCop def patch_problems(patch) patch_url = string_content(patch) + + if regex_match_group(patch, %r{https://github.com/[^/]*/[^/]*/pull}) + problem "Use a commit hash URL rather than an unstable pull request URL: #{patch_url}" + end + + if regex_match_group(patch, %r{.*gitlab.*/merge_request.*}) + problem "Use a commit hash URL rather than an unstable merge request URL: #{patch_url}" + end + gh_patch_param_pattern = %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)} if regex_match_group(patch, gh_patch_param_pattern) unless patch_url.match?(/\?full_index=\w+$/) @@ -64,13 +73,8 @@ module RuboCop gh_patch_diff_pattern = %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} - if match_obj = regex_match_group(patch, gh_patch_diff_pattern) - problem <<~EOS - use GitHub pull request URLs: - https://github.com/#{match_obj[1]}/#{match_obj[2]}/pull/#{match_obj[3]}.patch?full_index=1 - Rather than patch-diff: - #{patch_url} - EOS + if regex_match_group(patch, gh_patch_diff_pattern) + problem "Use a commit hash URL rather than patch-diff: #{patch_url}" end if regex_match_group(patch, %r{macports/trunk}) diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 130bbd456b..170b4e5d8f 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -28,14 +28,14 @@ class SoftwareSpec :cached_download, :clear_cache, :checksum, :mirrors, :specs, :using, :version, :mirror, :downloader, *Checksum::TYPES - def initialize + def initialize(flags: []) @resource = Resource.new @resources = {} @dependency_collector = DependencyCollector.new @bottle_specification = BottleSpecification.new @patches = [] @options = Options.new - @flags = Homebrew.args.flags_only + @flags = flags @deprecated_flags = [] @deprecated_options = [] @build = BuildOptions.new(Options.create(@flags), options) @@ -87,7 +87,7 @@ class SoftwareSpec def bottled? bottle_specification.tag?(Utils::Bottles.tag) && \ - (bottle_specification.compatible_cellar? || Homebrew.args.force_bottle?) + (bottle_specification.compatible_cellar? || owner.force_bottle) end def bottle(disable_type = nil, disable_reason = nil, &block) @@ -234,7 +234,7 @@ class SoftwareSpec end class HeadSoftwareSpec < SoftwareSpec - def initialize + def initialize(flags: []) super @resource.version = Version.create("HEAD") end diff --git a/Library/Homebrew/sorbet/files.yaml b/Library/Homebrew/sorbet/files.yaml index a1adf058a8..fcaf0f6018 100644 --- a/Library/Homebrew/sorbet/files.yaml +++ b/Library/Homebrew/sorbet/files.yaml @@ -39,7 +39,6 @@ false: - ./cask/cask.rb - ./cask/cask_loader.rb - ./cask/caskroom.rb - - ./cask/checkable.rb - ./cask/cmd.rb - ./cask/cmd/--cache.rb - ./cask/cmd/abstract_command.rb @@ -164,6 +163,7 @@ false: - ./dev-cmd/tests.rb - ./dev-cmd/unpack.rb - ./dev-cmd/update-license-data.rb + - ./dev-cmd/update-python-resources.rb - ./dev-cmd/update-test.rb - ./dev-cmd/vendor-gems.rb - ./development_tools.rb @@ -269,6 +269,7 @@ false: - ./test/ENV_spec.rb - ./test/bintray_spec.rb - ./test/bottle_publisher_spec.rb + - ./test/cask_dependent_spec.rb - ./test/cask/artifact/alt_target_spec.rb - ./test/cask/artifact/app_spec.rb - ./test/cask/artifact/binary_spec.rb @@ -824,11 +825,13 @@ false: - ./test/version_spec.rb - ./unpack_strategy/uncompressed.rb - ./utils/gems.rb + - ./utils/pypi.rb - ./version.rb true: - ./build_options.rb - ./cache_store.rb + - ./cask_dependent.rb - ./cask/cache.rb - ./cask/denylist.rb - ./cask/macos.rb diff --git a/Library/Homebrew/sorbet/rbi/cli.rbi b/Library/Homebrew/sorbet/rbi/cli.rbi index c9ec5b3cb0..c95e13e3c9 100644 --- a/Library/Homebrew/sorbet/rbi/cli.rbi +++ b/Library/Homebrew/sorbet/rbi/cli.rbi @@ -15,5 +15,7 @@ module Homebrew::CLI def build_from_source?; end def named_args; end + + def force_bottle?; end end end diff --git a/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.2.rbi b/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.2.rbi deleted file mode 100644 index 198c6b42fc..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.2.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# This file is autogenerated. Do not edit it by hand. Regenerate it with: -# tapioca sync --exclude json - -# typed: true - - diff --git a/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.3.rbi b/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.3.rbi new file mode 100644 index 0000000000..5ace243e13 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.3.rbi @@ -0,0 +1,7 @@ +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `codecov` gem. +# Please instead update this file by running `tapioca sync --exclude json`. + +# typed: true + + diff --git a/Library/Homebrew/sorbet/rbi/gems/commander@4.5.2.rbi b/Library/Homebrew/sorbet/rbi/gems/commander@4.5.2.rbi new file mode 100644 index 0000000000..bfbd3dd171 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/commander@4.5.2.rbi @@ -0,0 +1,7 @@ +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `commander` gem. +# Please instead update this file by running `tapioca sync --exclude json`. + +# typed: true + + diff --git a/Library/Homebrew/sorbet/rbi/gems/highline@2.0.3.rbi b/Library/Homebrew/sorbet/rbi/gems/highline@2.0.3.rbi new file mode 100644 index 0000000000..b6c0872fc5 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/highline@2.0.3.rbi @@ -0,0 +1,7 @@ +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `highline` gem. +# Please instead update this file by running `tapioca sync --exclude json`. + +# typed: true + + diff --git a/Library/Homebrew/sorbet/rbi/gems/parlour@4.0.0.rbi b/Library/Homebrew/sorbet/rbi/gems/parlour@4.0.0.rbi new file mode 100644 index 0000000000..11091f1f37 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/parlour@4.0.0.rbi @@ -0,0 +1,7 @@ +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `parlour` gem. +# Please instead update this file by running `tapioca sync --exclude json`. + +# typed: true + + diff --git a/Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi b/Library/Homebrew/sorbet/rbi/gems/patchelf@1.2.0.rbi similarity index 68% rename from Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/patchelf@1.2.0.rbi index be883d2256..1ca16ebbef 100644 --- a/Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/patchelf@1.2.0.rbi @@ -1,5 +1,6 @@ -# This file is autogenerated. Do not edit it by hand. Regenerate it with: -# tapioca sync --exclude json +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `patchelf` gem. +# Please instead update this file by running `tapioca sync --exclude json`. # typed: true @@ -10,15 +11,17 @@ module PatchELF::Helper private - def aligndown(val, align = _); end - def alignup(val, align = _); end + def aligndown(val, align = T.unsafe(nil)); end + def alignup(val, align = T.unsafe(nil)); end def color_enabled?; end def colorize(str, type); end - def self.aligndown(val, align = _); end - def self.alignup(val, align = _); end - def self.color_enabled?; end - def self.colorize(str, type); end + class << self + def aligndown(val, align = T.unsafe(nil)); end + def alignup(val, align = T.unsafe(nil)); end + def color_enabled?; end + def colorize(str, type); end + end end PatchELF::Helper::COLOR_CODE = T.let(T.unsafe(nil), Hash) @@ -33,9 +36,11 @@ module PatchELF::Logger def info(msg); end def warn(msg); end - def self.error(msg); end - def self.info(msg); end - def self.warn(msg); end + class << self + def error(msg); end + def info(msg); end + def warn(msg); end + end end class PatchELF::MM @@ -51,10 +56,10 @@ class PatchELF::MM private def abnormal_elf(msg); end - def extend_backward(seg, size = _); end - def extend_forward(seg, size = _); end + def extend_backward(seg, size = T.unsafe(nil)); end + def extend_forward(seg, size = T.unsafe(nil)); end def fgap_method; end - def find_gap(check_sz: _); end + def find_gap(check_sz: T.unsafe(nil)); end def invoke_callbacks(seg, start); end def load_segments; end def mgap_method; end @@ -73,7 +78,7 @@ class PatchELF::PatchError < ::ELFTools::ELFError end class PatchELF::Patcher - def initialize(filename, logging: _); end + def initialize(filename, on_error: T.unsafe(nil), logging: T.unsafe(nil)); end def add_needed(need); end def elf; end @@ -87,7 +92,7 @@ class PatchELF::Patcher def rpath=(rpath); end def runpath; end def runpath=(runpath); end - def save(out_file = _); end + def save(out_file = T.unsafe(nil)); end def soname; end def soname=(name); end def use_rpath!; end @@ -97,9 +102,9 @@ class PatchELF::Patcher def dirty?; end def dynamic_or_log; end def interpreter_; end - def log_or_raise(msg, exception = _); end + def log_or_raise(msg, exception = T.unsafe(nil)); end def needed_; end - def runpath_(rpath_sym = _); end + def runpath_(rpath_sym = T.unsafe(nil)); end def soname_; end def tag_name_or_log(type, log_msg); end end @@ -122,7 +127,7 @@ class PatchELF::Saver def patch_interpreter; end def patch_needed; end def patch_out(out_file); end - def patch_runpath(sym = _); end + def patch_runpath(sym = T.unsafe(nil)); end def patch_soname; end def reg_str_table(str, &block); end def section_header(name); end diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 555e26f550..010474a7cb 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -13549,6 +13549,94 @@ module ParallelTests WINDOWS = ::T.let(nil, ::T.untyped) end +class Parlour::ConflictResolver + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +module Parlour::Debugging::Tree + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +module Parlour::Debugging + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::DetachedRbiGenerator + def detached!(*args, &blk); end +end + +class Parlour::DetachedRbiGenerator +end + +class Parlour::ParseError + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::Plugin + extend ::T::Private::Abstract::Hooks + extend ::T::InterfaceWrapper::Helpers + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::RbiGenerator::Namespace + def create_attr(*args, &blk); end +end + +class Parlour::RbiGenerator::Options + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::RbiGenerator::Parameter + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::RbiGenerator::RbiObject + def add_comments(*args, &blk); end +end + +class Parlour::RbiGenerator::RbiObject + extend ::T::Private::Abstract::Hooks + extend ::T::InterfaceWrapper::Helpers + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::RbiGenerator::StructProp + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::RbiGenerator + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +module Parlour::TypeLoader + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::TypeParser::IntermediateSig + def self.inherited(s); end +end + +class Parlour::TypeParser::NodePath + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Parlour::TypeParser + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + ParseError = Racc::ParseError Parser::CurrentRuby = Parser::Ruby26 @@ -18883,14 +18971,6 @@ end module RSpec::Its end -class RSpec::Mocks::AnyInstance::Recorder - include ::T::CompatibilityPatches::RSpecCompatibility::RecorderExtensions -end - -class RSpec::Mocks::MethodDouble - include ::T::CompatibilityPatches::RSpecCompatibility::MethodDoubleExtensions -end - class RSpec::Retry def attempts(); end @@ -21598,7 +21678,6 @@ module Stdenv def O3(); end def Os(); end - end class String @@ -21895,7 +21974,6 @@ module Superenv def O3(); end def Os(); end - end class SynchronizedDelegator @@ -22566,12 +22644,16 @@ end class Tapioca::Cli include ::Thor::Actions + def dsl(*constants); end + def generate(*gems); end def generator(); end def init(); end + def require(); end + def sync(); end def todo(); end @@ -22583,6 +22665,64 @@ end module Tapioca::Compilers end +module Tapioca::Compilers::Dsl +end + +class Tapioca::Compilers::Dsl::Base + def decorate(*args, &blk); end + + def gather_constants(*args, &blk); end + + def handles?(*args, &blk); end + + def initialize(*args, &blk); end + + def processable_constants(*args, &blk); end + SPECIAL_METHOD_NAMES = ::T.let(nil, ::T.untyped) +end + +class Tapioca::Compilers::Dsl::Base + extend ::T::Sig + extend ::T::Helpers + extend ::T::Private::Abstract::Hooks + extend ::T::InterfaceWrapper::Helpers + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +module Tapioca::Compilers::Dsl +end + +class Tapioca::Compilers::DslCompiler + def error_handler(*args, &blk); end + + def generators(*args, &blk); end + + def initialize(*args, &blk); end + + def requested_constants(*args, &blk); end + + def run(*args, &blk); end +end + +class Tapioca::Compilers::DslCompiler + extend ::T::Sig + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + +class Tapioca::Compilers::RequiresCompiler + def compile(*args, &blk); end + + def initialize(*args, &blk); end +end + +class Tapioca::Compilers::RequiresCompiler + extend ::T::Sig + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + module Tapioca::Compilers::Sorbet SORBET = ::T.let(nil, ::T.untyped) end @@ -22607,6 +22747,7 @@ class Tapioca::Compilers::SymbolTable::SymbolGenerator def initialize(*args, &blk); end IGNORED_SYMBOLS = ::T.let(nil, ::T.untyped) SPECIAL_METHOD_NAMES = ::T.let(nil, ::T.untyped) + TYPE_PARAMETER_MATCHER = ::T.let(nil, ::T.untyped) end class Tapioca::Compilers::SymbolTable::SymbolGenerator @@ -22663,6 +22804,8 @@ class Tapioca::Config def generate_command(); end + def generators(); end + def initialize(*args, &blk); end def outdir(); end @@ -22676,13 +22819,16 @@ class Tapioca::Config def todos_path(); end def typed_overrides(); end - CONFIG_FILE_PATH = ::T.let(nil, ::T.untyped) - DEFAULT_OUTDIR = ::T.let(nil, ::T.untyped) + DEFAULT_DSLDIR = ::T.let(nil, ::T.untyped) + DEFAULT_GEMDIR = ::T.let(nil, ::T.untyped) DEFAULT_OVERRIDES = ::T.let(nil, ::T.untyped) DEFAULT_POSTREQUIRE = ::T.let(nil, ::T.untyped) DEFAULT_RBIDIR = ::T.let(nil, ::T.untyped) DEFAULT_TODOSPATH = ::T.let(nil, ::T.untyped) SORBET_CONFIG = ::T.let(nil, ::T.untyped) + SORBET_PATH = ::T.let(nil, ::T.untyped) + TAPIOCA_CONFIG = ::T.let(nil, ::T.untyped) + TAPIOCA_PATH = ::T.let(nil, ::T.untyped) end class Tapioca::Config @@ -22757,8 +22903,12 @@ class Tapioca::Gemfile end class Tapioca::Generator + def build_dsl(*args, &blk); end + def build_gem_rbis(*args, &blk); end + def build_requires(*args, &blk); end + def build_todos(*args, &blk); end def config(*args, &blk); end @@ -22778,6 +22928,8 @@ class Tapioca::Loader def initialize(*args, &blk); end def load_bundle(*args, &blk); end + + def load_rails(*args, &blk); end end class Tapioca::Loader @@ -22786,6 +22938,23 @@ class Tapioca::Loader extend ::T::Private::Methods::SingletonMethodHooks end +class Tapioca::SorbetConfig + def ignore(); end + + def initialize(*args, &blk); end + + def paths(*args, &blk); end +end + +class Tapioca::SorbetConfig + extend ::T::Sig + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks + def self.parse_file(*args, &blk); end + + def self.parse_string(*args, &blk); end +end + module Tapioca end diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index d36ebf37a6..c7a94df76b 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -16,7 +16,7 @@ module Homebrew check_style_impl(files, :json, **options) end - def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops: nil) + def check_style_impl(files, output_type, fix: false, except_cops: nil, only_cops: nil, display_cop_names: false) Homebrew.install_bundler_gems! require "rubocop" require "rubocops" @@ -78,7 +78,7 @@ module Homebrew case output_type when :print args << "--debug" if Homebrew.args.debug? - args << "--display-cop-names" if Homebrew.args.display_cop_names? + args << "--display-cop-names" if display_cop_names args << "--format" << "simple" if files.present? system(cache_env, "rubocop", *args) rubocop_success = $CHILD_STATUS.success? diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index 75fff1db24..a09d1a20fa 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -44,6 +44,10 @@ class SystemConfig CoreTap.instance.git_last_commit || "never" end + def core_tap_branch + CoreTap.instance.git_branch || "(none)" + end + def core_tap_origin CoreTap.instance.remote || "(none)" end @@ -116,6 +120,7 @@ class SystemConfig f.puts "Core tap ORIGIN: #{core_tap_origin}" f.puts "Core tap HEAD: #{core_tap_head}" f.puts "Core tap last commit: #{core_tap_last_commit}" + f.puts "Core tap branch: #{core_tap_branch}" else f.puts "Core tap: N/A" end diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb index 8f91b983e0..2936c20715 100644 --- a/Library/Homebrew/test.rb +++ b/Library/Homebrew/test.rb @@ -16,6 +16,8 @@ require "dev-cmd/test" TEST_TIMEOUT_SECONDS = 5 * 60 begin + Homebrew.args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) + args = Homebrew.test_args.parse error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) @@ -25,10 +27,10 @@ begin formula = args.resolved_formulae.first formula.extend(Homebrew::Assertions) formula.extend(Homebrew::FreePort) - formula.extend(Debrew::Formula) if Homebrew.args.debug? + formula.extend(Debrew::Formula) if args.debug? ENV.extend(Stdenv) - ENV.setup_build_environment(formula, args: args) + ENV.setup_build_environment(formula: formula) # tests can also return false to indicate failure Timeout.timeout TEST_TIMEOUT_SECONDS do diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb index 11e6df4196..9a91960363 100644 --- a/Library/Homebrew/test/ENV_spec.rb +++ b/Library/Homebrew/test/ENV_spec.rb @@ -15,12 +15,10 @@ shared_examples EnvActivation do end describe "#with_build_environment" do - let(:args) { Homebrew::CLI::Args.new } - it "restores the environment" do before = subject.dup - subject.with_build_environment(args: args) do + subject.with_build_environment do subject["foo"] = "bar" end @@ -32,7 +30,7 @@ shared_examples EnvActivation do before = subject.dup expect { - subject.with_build_environment(args: args) do + subject.with_build_environment do subject["foo"] = "bar" raise StandardError end @@ -43,13 +41,13 @@ shared_examples EnvActivation do end it "returns the value of the block" do - expect(subject.with_build_environment(args: args) { 1 }).to eq(1) + expect(subject.with_build_environment { 1 }).to eq(1) end it "does not mutate the interface" do expected = subject.methods - subject.with_build_environment(args: args) do + subject.with_build_environment do expect(subject.methods).to eq(expected) end diff --git a/Library/Homebrew/test/cask/cmd/audit_spec.rb b/Library/Homebrew/test/cask/cmd/audit_spec.rb index 0411531760..c9028ec3b7 100644 --- a/Library/Homebrew/test/cask/cmd/audit_spec.rb +++ b/Library/Homebrew/test/cask/cmd/audit_spec.rb @@ -4,6 +4,7 @@ require_relative "shared_examples/invalid_option" describe Cask::Cmd::Audit, :cask do let(:cask) { Cask::Cask.new("cask") } + let(:result) { { warnings: Set.new, errors: Set.new } } it_behaves_like "a command that handles invalid options" @@ -11,7 +12,7 @@ describe Cask::Cmd::Audit, :cask do it "audits all Casks if no tokens are given" do allow(Cask::Cask).to receive(:to_a).and_return([cask, cask]) - expect(Cask::Auditor).to receive(:audit).twice.and_return(true) + expect(Cask::Auditor).to receive(:audit).twice.and_return(result) described_class.run end @@ -28,7 +29,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run(cask_token) end @@ -45,7 +46,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken") end @@ -60,7 +61,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken", "--download") end @@ -77,7 +78,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken") end @@ -92,7 +93,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken", "--token-conflicts") end @@ -109,7 +110,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken") end @@ -124,7 +125,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: true, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken", "--strict") end @@ -141,7 +142,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken") end @@ -156,7 +157,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: true, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken", "--online") end @@ -173,7 +174,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: false, audit_strict: false, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken") end @@ -188,7 +189,7 @@ describe Cask::Cmd::Audit, :cask do audit_online: true, audit_strict: true, quarantine: true) - .and_return(true) + .and_return(result) described_class.run("casktoken", "--new-cask") end diff --git a/Library/Homebrew/test/cask/cmd/cat_spec.rb b/Library/Homebrew/test/cask/cmd/cat_spec.rb index 5c424e6e67..23dfa89f5b 100644 --- a/Library/Homebrew/test/cask/cmd/cat_spec.rb +++ b/Library/Homebrew/test/cask/cmd/cat_spec.rb @@ -10,14 +10,14 @@ describe Cask::Cmd::Cat, :cask do describe "given a basic Cask" do let(:basic_cask_content) { <<~RUBY - cask 'basic-cask' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' + cask "basic-cask" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/TestCask.dmg' - homepage 'https://brew.sh/' + url "https://brew.sh/TestCask.dmg" + homepage "https://brew.sh/" - app 'TestCask.app' + app "TestCask.app" end RUBY } diff --git a/Library/Homebrew/test/cask/cmd/style_spec.rb b/Library/Homebrew/test/cask/cmd/style_spec.rb index 5767740cb2..529e384c4f 100644 --- a/Library/Homebrew/test/cask/cmd/style_spec.rb +++ b/Library/Homebrew/test/cask/cmd/style_spec.rb @@ -15,14 +15,16 @@ describe Cask::Cmd::Style, :cask do around do |example| FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml" FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_cask.yml", HOMEBREW_LIBRARY/".rubocop_cask.yml" - FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_rspec.yml", HOMEBREW_LIBRARY/".rubocop_rspec.yml" example.run ensure FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" + FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml" FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_cask.yml" - FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml" + FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_rspec.yml" end before do diff --git a/Library/Homebrew/test/cask_dependent_spec.rb b/Library/Homebrew/test/cask_dependent_spec.rb new file mode 100644 index 0000000000..313a67a61b --- /dev/null +++ b/Library/Homebrew/test/cask_dependent_spec.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require "cask/cask_loader" +require "cask_dependent" + +describe CaskDependent, :needs_macos do + subject(:dependent) { described_class.new test_cask } + + let :test_cask do + Cask::CaskLoader.load(+<<-RUBY) + cask "testing" do + depends_on formula: "baz" + depends_on cask: "foo-cask" + depends_on macos: ">= :mojave" + depends_on x11: true + end + RUBY + end + + describe "#deps" do + it "is the formula dependencies of the cask" do + expect(dependent.deps.map(&:name)) + .to eq %w[baz] + end + end + + describe "#requirements" do + it "is the requirements of the cask" do + expect(dependent.requirements.map(&:name)) + .to eq %w[foo-cask macos x11] + end + end + + describe "#recursive_dependencies", :integration_test do + it "is all the dependencies of the cask" do + setup_test_formula "foo" + setup_test_formula "bar" + setup_test_formula "baz", <<-RUBY + url "https://brew.sh/baz-1.0" + depends_on "bar" + depends_on :osxfuse + RUBY + + expect(dependent.recursive_dependencies.map(&:name)) + .to eq(%w[foo bar baz]) + end + end + + describe "#recursive_requirements", :integration_test do + it "is all the dependencies of the cask" do + setup_test_formula "foo" + setup_test_formula "bar" + setup_test_formula "baz", <<-RUBY + url "https://brew.sh/baz-1.0" + depends_on "bar" + depends_on :osxfuse + RUBY + + expect(dependent.recursive_requirements.map(&:name)) + .to eq(%w[foo-cask macos x11 osxfuse]) + end + end +end diff --git a/Library/Homebrew/test/cli/parser_spec.rb b/Library/Homebrew/test/cli/parser_spec.rb index 0c3a90084d..c85a78d03b 100644 --- a/Library/Homebrew/test/cli/parser_spec.rb +++ b/Library/Homebrew/test/cli/parser_spec.rb @@ -6,7 +6,6 @@ describe Homebrew::CLI::Parser do describe "test switch options" do subject(:parser) { described_class.new do - switch :verbose, description: "Flag for verbosity" switch "--more-verbose", description: "Flag for higher verbosity" switch "--pry", env: :pry end @@ -16,27 +15,34 @@ describe Homebrew::CLI::Parser do allow(Homebrew::EnvConfig).to receive(:pry?).and_return(true) end + context "when `ignore_invalid_options` is true" do + it "passes through invalid options" do + args = parser.parse(["-v", "named-arg", "--not-a-valid-option"], ignore_invalid_options: true) + expect(args.remaining).to eq ["named-arg", "--not-a-valid-option"] + expect(args.named_args).to be_empty + end + end + it "parses short option" do - parser.parse(["-v"]) - expect(Homebrew.args).to be_verbose + args = parser.parse(["-v"]) + expect(args).to be_verbose end it "parses a single valid option" do - parser.parse(["--verbose"]) - expect(Homebrew.args).to be_verbose + args = parser.parse(["--verbose"]) + expect(args).to be_verbose end it "parses a valid option along with few unnamed args" do - args = %w[--verbose unnamed args] - parser.parse(args) - expect(Homebrew.args).to be_verbose - expect(args).to eq %w[--verbose unnamed args] + args = parser.parse(%w[--verbose unnamed args]) + expect(args).to be_verbose + expect(args.named).to eq %w[unnamed args] end it "parses a single option and checks other options to be nil" do - parser.parse(["--verbose"]) - expect(Homebrew.args).to be_verbose - expect(Homebrew.args.more_verbose?).to be nil + args = parser.parse(["--verbose"]) + expect(args).to be_verbose + expect(args.more_verbose?).to be nil end it "raises an exception and outputs help text when an invalid option is passed" do @@ -45,13 +51,8 @@ describe Homebrew::CLI::Parser do end it "maps environment var to an option" do - parser.parse([]) - expect(Homebrew.args.pry?).to be true - end - - it ":verbose with custom description" do - _, _, _, desc = parser.processed_options.find { |short, _| short == "-v" } - expect(desc).to eq "Flag for verbosity" + args = parser.parse([]) + expect(args.pry?).to be true end end @@ -64,8 +65,8 @@ describe Homebrew::CLI::Parser do } it "parses a long flag option with its argument" do - parser.parse(["--filename=random.txt"]) - expect(Homebrew.args.filename).to eq "random.txt" + args = parser.parse(["--filename=random.txt"]) + expect(args.filename).to eq "random.txt" end it "raises an exception when a flag's required value is not passed" do @@ -73,8 +74,8 @@ describe Homebrew::CLI::Parser do end it "parses a comma array flag option" do - parser.parse(["--files=random1.txt,random2.txt"]) - expect(Homebrew.args.files).to eq %w[random1.txt random2.txt] + args = parser.parse(["--files=random1.txt,random2.txt"]) + expect(args.files).to eq %w[random1.txt random2.txt] end end @@ -86,9 +87,9 @@ describe Homebrew::CLI::Parser do } it "parses a short flag option with its argument" do - parser.parse(["--filename=random.txt"]) - expect(Homebrew.args.filename).to eq "random.txt" - expect(Homebrew.args.f).to eq "random.txt" + args = parser.parse(["--filename=random.txt"]) + expect(args.filename).to eq "random.txt" + expect(args.f).to eq "random.txt" end end @@ -118,14 +119,14 @@ describe Homebrew::CLI::Parser do end it "raises no exception" do - parser.parse(["--flag1=flag1", "--flag2=flag2"]) - expect(Homebrew.args.flag1).to eq "flag1" - expect(Homebrew.args.flag2).to eq "flag2" + args = parser.parse(["--flag1=flag1", "--flag2=flag2"]) + expect(args.flag1).to eq "flag1" + expect(args.flag2).to eq "flag2" end it "raises no exception for optional dependency" do - parser.parse(["--flag3=flag3"]) - expect(Homebrew.args.flag3).to eq "flag3" + args = parser.parse(["--flag3=flag3"]) + expect(args.flag3).to eq "flag3" end end @@ -169,22 +170,22 @@ describe Homebrew::CLI::Parser do end it "raises no exception" do - parser.parse(["--switch-a", "--switch-c"]) - expect(Homebrew.args.switch_a?).to be true - expect(Homebrew.args.switch_c?).to be true + args = parser.parse(["--switch-a", "--switch-c"]) + expect(args.switch_a?).to be true + expect(args.switch_c?).to be true end it "raises no exception for optional dependency" do - parser.parse(["--switch-b"]) - expect(Homebrew.args.switch_b?).to be true + args = parser.parse(["--switch-b"]) + expect(args.switch_b?).to be true end it "prioritizes cli arguments over env vars when they conflict" do allow(Homebrew::EnvConfig).to receive(:switch_a?).and_return(true) allow(Homebrew::EnvConfig).to receive(:switch_b?).and_return(false) - parser.parse(["--switch-b"]) - expect(Homebrew.args.switch_a).to be_falsy - expect(Homebrew.args).to be_switch_b + args = parser.parse(["--switch-b"]) + expect(args.switch_a).to be_falsy + expect(args).to be_switch_b end it "raises an exception on constraint violation when both are env vars" do @@ -214,38 +215,32 @@ describe Homebrew::CLI::Parser do switch "--foo" flag "--bar" switch "-s" - switch :verbose end } it "#options_only" do - parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) - expect(Homebrew.args.options_only).to eq %w[--foo --bar=value -s --verbose] + args = parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) + expect(args.options_only).to eq %w[--verbose --foo --bar=value -s] end it "#flags_only" do - parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) - expect(Homebrew.args.flags_only).to eq %w[--foo --bar=value --verbose] - end - - it "#passthrough" do - parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) - expect(Homebrew.args.passthrough).to eq %w[--foo --bar=value -s] + args = parser.parse(["--foo", "--bar=value", "-v", "-s", "a", "b", "cdefg"]) + expect(args.flags_only).to eq %w[--verbose --foo --bar=value] end it "#formulae raises an error when a Formula is unavailable" do - parser.parse(["mxcl"]) - expect { Homebrew.args.formulae }.to raise_error FormulaUnavailableError + args = parser.parse(["mxcl"]) + expect { args.formulae }.to raise_error FormulaUnavailableError end it "#formulae returns an empty array when there are no Formulae" do - parser.parse([]) - expect(Homebrew.args.formulae).to be_empty + args = parser.parse([]) + expect(args.formulae).to be_empty end it "#casks returns an empty array when there are no matching casks" do - parser.parse([]) - expect(Homebrew.args.casks).to eq [] + args = parser.parse([]) + expect(args.casks).to eq [] end context "kegs" do @@ -255,24 +250,24 @@ describe Homebrew::CLI::Parser do end it "when there are matching kegs returns an array of Kegs" do - parser.parse(["mxcl"]) - expect(Homebrew.args.kegs.length).to eq 1 + args = parser.parse(["mxcl"]) + expect(args.kegs.length).to eq 1 end it "when there are no matching kegs returns an array of Kegs" do - parser.parse([]) - expect(Homebrew.args.kegs).to be_empty + args = parser.parse([]) + expect(args.kegs).to be_empty end end it "#named returns an array of non-option arguments" do - parser.parse(["foo", "-v", "-s"]) - expect(Homebrew.args.named).to eq ["foo"] + args = parser.parse(["foo", "-v", "-s"]) + expect(args.named).to eq ["foo"] end it "#named returns an empty array when there are no named arguments" do - parser.parse([]) - expect(Homebrew.args.named).to be_empty + args = parser.parse([]) + expect(args.named).to be_empty end end end diff --git a/Library/Homebrew/test/cmd/outdated_spec.rb b/Library/Homebrew/test/cmd/outdated_spec.rb index 54a6593285..bb594a1aae 100644 --- a/Library/Homebrew/test/cmd/outdated_spec.rb +++ b/Library/Homebrew/test/cmd/outdated_spec.rb @@ -23,7 +23,6 @@ describe "brew outdated", :integration_test do expect { brew "outdated", "--json=v1" } .to output(expected_json + "\n").to_stdout - .and not_to_output.to_stderr .and be_a_success end end diff --git a/Library/Homebrew/test/cmd/readall_spec.rb b/Library/Homebrew/test/cmd/readall_spec.rb index ad073df9ee..245f1fde68 100644 --- a/Library/Homebrew/test/cmd/readall_spec.rb +++ b/Library/Homebrew/test/cmd/readall_spec.rb @@ -6,7 +6,7 @@ describe "Homebrew.readall_args" do it_behaves_like "parseable arguments" end -describe "brew readall", :integration_test, timeout: 240 do +describe "brew readall", :integration_test do it "imports all Formulae for a given Tap" do formula_file = setup_test_formula "testball" @@ -15,7 +15,7 @@ describe "brew readall", :integration_test, timeout: 240 do FileUtils.ln_s formula_file, alias_file - expect { brew "readall", "--aliases", "--syntax" } + expect { brew "readall", "--aliases", "--syntax", CoreTap.instance.name } .to be_a_success .and not_to_output.to_stdout .and not_to_output.to_stderr diff --git a/Library/Homebrew/test/cmd/reinstall_spec.rb b/Library/Homebrew/test/cmd/reinstall_spec.rb index 45b5a48ffb..68c67a82dd 100644 --- a/Library/Homebrew/test/cmd/reinstall_spec.rb +++ b/Library/Homebrew/test/cmd/reinstall_spec.rb @@ -7,7 +7,7 @@ describe "Homebrew.reinstall_args" do it_behaves_like "parseable arguments" end -describe "brew reinstall", :integration_test do +describe "brew reinstall", :integration_test, timeout: 120 do it "reinstalls a Formula" do install_test_formula "testball" foo_dir = HOMEBREW_CELLAR/"testball/0.1/bin" diff --git a/Library/Homebrew/test/cmd/shared_examples/args_parse.rb b/Library/Homebrew/test/cmd/shared_examples/args_parse.rb index c9e8cc1d80..d8b7873b80 100644 --- a/Library/Homebrew/test/cmd/shared_examples/args_parse.rb +++ b/Library/Homebrew/test/cmd/shared_examples/args_parse.rb @@ -14,7 +14,8 @@ shared_examples "parseable arguments" do it "can parse arguments" do require "dev-cmd/#{command_name}" unless require? "cmd/#{command_name}" - expect { Homebrew.send(method_name).parse({}, allow_no_named_args: true) } - .not_to raise_error + parser = Homebrew.public_send(method_name) + + expect(parser).to respond_to(:parse) end end diff --git a/Library/Homebrew/test/cmd/uninstall_spec.rb b/Library/Homebrew/test/cmd/uninstall_spec.rb index 696be790e3..f27ff096bf 100644 --- a/Library/Homebrew/test/cmd/uninstall_spec.rb +++ b/Library/Homebrew/test/cmd/uninstall_spec.rb @@ -28,7 +28,7 @@ describe Homebrew do end end - let(:opts) { { dependency.rack => [Keg.new(dependency.installed_prefix)] } } + let(:kegs_by_rack) { { dependency.rack => [Keg.new(dependency.installed_prefix)] } } before do [dependency, dependent].each do |f| @@ -53,7 +53,7 @@ describe Homebrew do ENV["HOMEBREW_DEVELOPER"] = "1" expect { - described_class.handle_unsatisfied_dependents(opts) + described_class.handle_unsatisfied_dependents(kegs_by_rack) }.to output(/Warning/).to_stderr expect(described_class).not_to have_failed @@ -61,19 +61,15 @@ describe Homebrew do specify "when not developer" do expect { - described_class.handle_unsatisfied_dependents(opts) + described_class.handle_unsatisfied_dependents(kegs_by_rack) }.to output(/Error/).to_stderr expect(described_class).to have_failed end - specify "when not developer and --ignore-dependencies is specified" do - described_class.args = described_class.args.dup if described_class.args.frozen? - expect(described_class.args).to receive(:ignore_dependencies?).and_return(true) - described_class.args.freeze - + specify "when not developer and `ignore_dependencies` is true" do expect { - described_class.handle_unsatisfied_dependents(opts) + described_class.handle_unsatisfied_dependents(kegs_by_rack, ignore_dependencies: true) }.not_to output.to_stderr expect(described_class).not_to have_failed diff --git a/Library/Homebrew/test/dependencies_helpers_spec.rb b/Library/Homebrew/test/dependencies_helpers_spec.rb new file mode 100644 index 0000000000..4686084bce --- /dev/null +++ b/Library/Homebrew/test/dependencies_helpers_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require "dependencies_helpers" + +describe DependenciesHelpers do + specify "#dependents" do + foo = formula "foo" do + url "foo" + version "1.0" + end + + foo_cask = Cask::CaskLoader.load(+<<-RUBY) + cask "foo_cask" do + end + RUBY + + bar = formula "bar" do + url "bar-url" + version "1.0" + end + + bar_cask = Cask::CaskLoader.load(+<<-RUBY) + cask "bar-cask" do + end + RUBY + + methods = [ + :name, + :full_name, + :runtime_dependencies, + :deps, + :requirements, + :recursive_dependencies, + :recursive_requirements, + :any_version_installed?, + ] + + dependents = described_class.dependents([foo, foo_cask, bar, bar_cask]) + + dependents.each do |dependent| + methods.each do |method| + expect(dependent.respond_to?(method)) + .to be true + end + end + end +end diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 9c78bde60f..965f9f86e5 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -86,12 +86,14 @@ module Homebrew let(:custom_spdx_id) { "zzz" } let(:standard_mismatch_spdx_id) { "0BSD" } + let(:license_array) { ["0BSD", "GPL-3.0"] } + let(:license_array_mismatch) { ["0BSD", "MIT"] } + let(:license_array_nonstandard) { ["0BSD", "zzz", "MIT"] } it "does not check if the formula is not a new formula" do fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: false class Foo < Formula url "https://brew.sh/foo-1.0.tgz" - license "" end RUBY @@ -103,7 +105,6 @@ module Homebrew fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: true class Foo < Formula url "https://brew.sh/foo-1.0.tgz" - license "" end RUBY @@ -120,7 +121,19 @@ module Homebrew RUBY fa.audit_license - expect(fa.problems.first).to match "#{custom_spdx_id} is not a standard SPDX license." + expect(fa.problems.first).to match "Formula foo contains non-standard SPDX licenses: [\"zzz\"]." + end + + it "detects if license array contains a non-standard spdx-id" do + fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: true + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + license #{license_array_nonstandard} + end + RUBY + + fa.audit_license + expect(fa.problems.first).to match "Formula foo contains non-standard SPDX licenses: [\"zzz\"]." end it "verifies that a license info is a standard spdx id" do @@ -135,6 +148,18 @@ module Homebrew expect(fa.problems).to be_empty end + it "verifies that a license array contains only standard spdx id" do + fa = formula_auditor "foo", <<~RUBY, spdx_data: spdx_data, new_formula: true + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + license #{license_array} + end + RUBY + + fa.audit_license + expect(fa.problems).to be_empty + end + it "checks online and verifies that a standard license id is the same "\ "as what is indicated on its Github repo" do fa = formula_auditor "cask", <<~RUBY, spdx_data: spdx_data, online: true, core_tap: true, new_formula: true @@ -160,8 +185,37 @@ module Homebrew RUBY fa.audit_license - expect(fa.problems.first).to match "License mismatch - GitHub license is: GPL-3.0, "\ - "but Formulae license states: #{standard_mismatch_spdx_id}." + expect(fa.problems.first).to match "License mismatch - GitHub license is: [\"GPL-3.0\"], "\ + "but Formulae license states: #{Array(standard_mismatch_spdx_id)}." + end + + it "checks online and detects that an array of license does not contain "\ + "what is indicated on its Github repository" do + fa = formula_auditor "cask", <<~RUBY, online: true, spdx_data: spdx_data, core_tap: true, new_formula: true + class Cask < Formula + url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" + head "https://github.com/cask/cask.git" + license #{license_array_mismatch} + end + RUBY + + fa.audit_license + expect(fa.problems.first).to match "License mismatch - GitHub license is: [\"GPL-3.0\"], "\ + "but Formulae license states: #{Array(license_array_mismatch)}." + end + + it "checks online and verifies that an array of license contains "\ + "what is indicated on its Github repository" do + fa = formula_auditor "cask", <<~RUBY, online: true, spdx_data: spdx_data, core_tap: true, new_formula: true + class Cask < Formula + url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" + head "https://github.com/cask/cask.git" + license #{license_array} + end + RUBY + + fa.audit_license + expect(fa.problems).to be_empty end end @@ -289,7 +343,7 @@ module Homebrew subject { fa } let(:fa) do - formula_auditor "foo", <<~RUBY, new_formula: true + formula_auditor "foo", <<~RUBY, new_formula: true, core_tap: true class Foo < Formula url "https://brew.sh/foo-1.0.tgz" homepage "https://brew.sh" diff --git a/Library/Homebrew/test/dev-cmd/test_spec.rb b/Library/Homebrew/test/dev-cmd/test_spec.rb index 866230a703..b3bb257a39 100644 --- a/Library/Homebrew/test/dev-cmd/test_spec.rb +++ b/Library/Homebrew/test/dev-cmd/test_spec.rb @@ -7,7 +7,7 @@ describe "Homebrew.test_args" do end # randomly segfaults on Linux with portable-ruby. -describe "brew test", :integration_test, :needs_macos do +describe "brew test", :integration_test, :needs_macos, timeout: 120 do it "tests a given Formula" do install_test_formula "testball", <<~'RUBY' test do diff --git a/Library/Homebrew/test/formula_info_spec.rb b/Library/Homebrew/test/formula_info_spec.rb index c936dbef76..4e1f416529 100644 --- a/Library/Homebrew/test/formula_info_spec.rb +++ b/Library/Homebrew/test/formula_info_spec.rb @@ -7,41 +7,16 @@ describe FormulaInfo, :integration_test do it "tests the FormulaInfo class" do install_test_formula "testball" - expect( - described_class.lookup(Formula["testball"].path) - .revision, - ).to eq(0) + info = described_class.lookup(Formula["testball"].path) + expect(info).not_to be_nil + expect(info.revision).to eq(0) + expect(info.bottle_tags).to eq([]) + expect(info.bottle_info).to be_nil + expect(info.bottle_info_any).to be_nil + expect(info.any_bottle_tag).to be_nil + expect(info.version(:stable).to_s).to eq("0.1") - expect( - described_class.lookup(Formula["testball"].path) - .bottle_tags, - ).to eq([]) - - expect( - described_class.lookup(Formula["testball"].path) - .bottle_info, - ).to eq(nil) - - expect( - described_class.lookup(Formula["testball"].path) - .bottle_info_any, - ).to eq(nil) - - expect( - described_class.lookup(Formula["testball"].path) - .any_bottle_tag, - ).to eq(nil) - - expect( - described_class.lookup(Formula["testball"].path) - .version(:stable).to_s, - ).to eq("0.1") - - version = described_class.lookup(Formula["testball"].path) - .version(:stable) - expect( - described_class.lookup(Formula["testball"].path) - .pkg_version, - ).to eq(PkgVersion.new(version, 0)) + version = info.version(:stable) + expect(info.pkg_version).to eq(PkgVersion.new(version, 0)) end end diff --git a/Library/Homebrew/test/formula_installer_bottle_spec.rb b/Library/Homebrew/test/formula_installer_bottle_spec.rb index 87842ff27b..0a6aec0f0b 100644 --- a/Library/Homebrew/test/formula_installer_bottle_spec.rb +++ b/Library/Homebrew/test/formula_installer_bottle_spec.rb @@ -50,7 +50,7 @@ describe FormulaInstaller do specify "basic bottle install" do allow(DevelopmentTools).to receive(:installed?).and_return(false) - Homebrew.install_args.parse("testball_bottle") + Homebrew.install_args.parse(["testball_bottle"]) temporarily_install_bottle(TestballBottle.new) do |f| # Copied directly from formula_installer_spec.rb # as we expect the same behavior. diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index 5458fc6e02..bbd6aca88a 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -16,7 +16,7 @@ describe Formulary do bottle do cellar :any_skip_relocation root_url "file://#{bottle_dir}" - sha256 "d48bbbe583dcfbfa608579724fc6f0328b3cd316935c6ea22f134610aaf2952f" => :#{Utils::Bottles.tag} + sha256 "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" => :#{Utils::Bottles.tag} end def install diff --git a/Library/Homebrew/test/java_requirement_spec.rb b/Library/Homebrew/test/java_requirement_spec.rb index 694fe2f91d..590f27a1d0 100644 --- a/Library/Homebrew/test/java_requirement_spec.rb +++ b/Library/Homebrew/test/java_requirement_spec.rb @@ -41,16 +41,14 @@ describe JavaRequirement do describe "#satisfied?" do subject { described_class.new(%w[1.8]) } - let(:args) { Homebrew::CLI::Args.new } - it "returns false if no `java` executable can be found" do allow(File).to receive(:executable?).and_return(false) - expect(subject).not_to be_satisfied(args: args) + expect(subject).not_to be_satisfied end it "returns true if #preferred_java returns a path" do allow(subject).to receive(:preferred_java).and_return(Pathname.new("/usr/bin/java")) - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied end context "when #possible_javas contains paths" do @@ -74,17 +72,17 @@ describe JavaRequirement do it "returns false if all are lower" do setup_java_with_version "1.6.0_5" - expect(subject).not_to be_satisfied(args: args) + expect(subject).not_to be_satisfied end it "returns true if one is equal" do setup_java_with_version "1.7.0_5" - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied end it "returns false if all are higher" do setup_java_with_version "1.8.0_5" - expect(subject).not_to be_satisfied(args: args) + expect(subject).not_to be_satisfied end end @@ -93,17 +91,17 @@ describe JavaRequirement do it "returns false if all are lower" do setup_java_with_version "1.6.0_5" - expect(subject).not_to be_satisfied(args: args) + expect(subject).not_to be_satisfied end it "returns true if one is equal" do setup_java_with_version "1.7.0_5" - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied end it "returns true if one is higher" do setup_java_with_version "1.8.0_5" - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied end end end diff --git a/Library/Homebrew/test/messages_spec.rb b/Library/Homebrew/test/messages_spec.rb index 9bf48c58aa..fa97096d12 100644 --- a/Library/Homebrew/test/messages_spec.rb +++ b/Library/Homebrew/test/messages_spec.rb @@ -72,27 +72,20 @@ describe Messages do end end - # Homebrew.args OpenStruct usage cannot use verified doubles. - # rubocop:disable RSpec/VerifiedDoubles - context "when the --display-times argument is present" do - before do - allow(Homebrew).to receive(:args).and_return \ - double(display_times?: true, flags_only: ["--display-times"]) - end - - context "when install_times is empty" do - it "doesn't print any output" do - expect { messages.display_messages }.not_to output.to_stdout + context "when the `display_times` argument is true" do + context "when `install_times` is empty" do + it "doesn't print anything" do + expect { messages.display_messages(display_times: true) }.not_to output.to_stdout end end - context "when install_times is present" do + context "when `install_times` is present" do before do messages.formula_installed(test_formula, elapsed_time) end it "prints installation times" do - expect { messages.display_messages }.to output( + expect { messages.display_messages(display_times: true) }.to output( <<~EOS, ==> Installation times foo 1.100 s @@ -102,15 +95,10 @@ describe Messages do end end - context "when the --display-times argument isn't present" do - before do - allow(Homebrew).to receive(:args).and_return(double(display_times?: false)) - end - + context "when the `display_times` argument isn't specified" do it "doesn't print installation times" do expect { messages.display_messages }.not_to output.to_stdout end end - # rubocop:enable RSpec/VerifiedDoubles end end diff --git a/Library/Homebrew/test/os/mac/java_requirement_spec.rb b/Library/Homebrew/test/os/mac/java_requirement_spec.rb index 190b7c1aba..65729b23bc 100644 --- a/Library/Homebrew/test/os/mac/java_requirement_spec.rb +++ b/Library/Homebrew/test/os/mac/java_requirement_spec.rb @@ -9,8 +9,6 @@ describe JavaRequirement do let(:java_home) { mktmpdir } - let(:args) { Homebrew::CLI::Args.new } - before do FileUtils.mkdir java_home/"bin" FileUtils.touch java_home/"bin/java" @@ -18,23 +16,23 @@ describe JavaRequirement do end specify "Apple Java environment" do - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied expect(ENV).to receive(:prepend_path) expect(ENV).to receive(:append_to_cflags) - subject.modify_build_environment(args: args) + subject.modify_build_environment expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) end specify "Oracle Java environment" do - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied FileUtils.mkdir java_home/"include" expect(ENV).to receive(:prepend_path) expect(ENV).to receive(:append_to_cflags).twice - subject.modify_build_environment(args: args) + subject.modify_build_environment expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) end end diff --git a/Library/Homebrew/test/patching_spec.rb b/Library/Homebrew/test/patching_spec.rb index ffdf1027dc..737e140676 100644 --- a/Library/Homebrew/test/patching_spec.rb +++ b/Library/Homebrew/test/patching_spec.rb @@ -149,7 +149,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end specify "single_patch_dsl_with_incorrect_strip_with_apply" do @@ -163,7 +163,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end specify "patch_p0_dsl" do @@ -219,7 +219,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end end diff --git a/Library/Homebrew/test/requirement_spec.rb b/Library/Homebrew/test/requirement_spec.rb index 12a0e302b3..ffcb3a8de1 100644 --- a/Library/Homebrew/test/requirement_spec.rb +++ b/Library/Homebrew/test/requirement_spec.rb @@ -11,8 +11,6 @@ describe Requirement do let(:klass) { Class.new(described_class) } - let(:args) { Homebrew::CLI::Args.new } - describe "#tags" do subject { described_class.new(tags) } @@ -67,7 +65,7 @@ describe Requirement do end end - it { is_expected.to be_satisfied(args: args) } + it { is_expected.to be_satisfied } end describe "#satisfy with block and build_env returns false" do @@ -79,7 +77,7 @@ describe Requirement do end end - it { is_expected.not_to be_satisfied(args: args) } + it { is_expected.not_to be_satisfied } end describe "#satisfy returns true" do @@ -89,7 +87,7 @@ describe Requirement do end end - it { is_expected.to be_satisfied(args: args) } + it { is_expected.to be_satisfied } end describe "#satisfy returns false" do @@ -99,7 +97,7 @@ describe Requirement do end end - it { is_expected.not_to be_satisfied(args: args) } + it { is_expected.not_to be_satisfied } end describe "#satisfy with block returning true and without :build_env" do @@ -113,7 +111,7 @@ describe Requirement do it "sets up build environment" do expect(ENV).to receive(:with_build_environment).and_call_original - subject.satisfied?(args: args) + subject.satisfied? end end @@ -128,7 +126,7 @@ describe Requirement do it "skips setting up build environment" do expect(ENV).not_to receive(:with_build_environment) - subject.satisfied?(args: args) + subject.satisfied? end end @@ -143,8 +141,8 @@ describe Requirement do it "infers path from #satisfy result" do expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar")) - subject.satisfied?(args: args) - subject.modify_build_environment(args: args) + subject.satisfied? + subject.modify_build_environment end end end @@ -182,7 +180,7 @@ describe Requirement do let(:klass) { Class.new(described_class) } it "returns nil" do - expect(subject.modify_build_environment(args: args)).to be nil + expect(subject.modify_build_environment).to be nil end end end diff --git a/Library/Homebrew/test/requirements/linux_requirement_spec.rb b/Library/Homebrew/test/requirements/linux_requirement_spec.rb index a6857365df..f328579fa2 100644 --- a/Library/Homebrew/test/requirements/linux_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/linux_requirement_spec.rb @@ -7,10 +7,8 @@ describe LinuxRequirement do subject(:requirement) { described_class.new } describe "#satisfied?" do - let(:args) { Homebrew::CLI::Args.new } - it "returns true on Linux" do - expect(requirement.satisfied?(args: args)).to eq(OS.linux?) + expect(requirement.satisfied?).to eq(OS.linux?) end end end diff --git a/Library/Homebrew/test/requirements/macos_requirement_spec.rb b/Library/Homebrew/test/requirements/macos_requirement_spec.rb index ff160e560f..b966111262 100644 --- a/Library/Homebrew/test/requirements/macos_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/macos_requirement_spec.rb @@ -7,20 +7,18 @@ describe MacOSRequirement do subject(:requirement) { described_class.new } describe "#satisfied?" do - let(:args) { Homebrew::CLI::Args.new } - it "returns true on macOS" do - expect(requirement.satisfied?(args: args)).to eq OS.mac? + expect(requirement.satisfied?).to eq OS.mac? end it "supports version symbols", :needs_macos do requirement = described_class.new([MacOS.version.to_sym]) - expect(requirement).to be_satisfied(args: args) + expect(requirement).to be_satisfied end it "supports maximum versions", :needs_macos do requirement = described_class.new([:catalina], comparator: "<=") - expect(requirement.satisfied?(args: args)).to eq MacOS.version <= :catalina + expect(requirement.satisfied?).to eq MacOS.version <= :catalina end end end diff --git a/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb b/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb index a5ceb17909..8c38a45884 100644 --- a/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb @@ -22,23 +22,21 @@ describe OsxfuseRequirement do end describe "#modify_build_environment", :needs_macos do - let(:args) { Homebrew::CLI::Args.new } - it "adds the fuse directories to PKG_CONFIG_PATH" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment(args: args) + requirement.modify_build_environment expect(ENV).to have_received(:append_path).with("PKG_CONFIG_PATH", any_args) end it "adds the fuse directories to HOMEBREW_LIBRARY_PATHS" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment(args: args) + requirement.modify_build_environment expect(ENV).to have_received(:append_path).with("HOMEBREW_LIBRARY_PATHS", any_args) end it "adds the fuse directories to HOMEBREW_INCLUDE_PATHS" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment(args: args) + requirement.modify_build_environment expect(ENV).to have_received(:append_path).with("HOMEBREW_INCLUDE_PATHS", any_args) end end diff --git a/Library/Homebrew/test/rubocop_spec.rb b/Library/Homebrew/test/rubocop_spec.rb index 533df81076..a5750a430c 100644 --- a/Library/Homebrew/test/rubocop_spec.rb +++ b/Library/Homebrew/test/rubocop_spec.rb @@ -13,7 +13,8 @@ describe "RuboCop" do end it "loads all Formula cops without errors" do - _, _, status = Open3.capture3("rubocop", TEST_FIXTURE_DIR/"testball.rb") + stdout, _, status = Open3.capture3("rubocop", TEST_FIXTURE_DIR/"testball.rb") + expect(stdout).to include("no offenses detected") expect(status).to be_a_success end end diff --git a/Library/Homebrew/test/rubocops/patches_spec.rb b/Library/Homebrew/test/rubocops/patches_spec.rb index 0209a6a566..f1bbc3d37e 100644 --- a/Library/Homebrew/test/rubocops/patches_spec.rb +++ b/Library/Homebrew/test/rubocops/patches_spec.rb @@ -34,7 +34,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do "http://trac.macports.org/export/102865/trunk/dports/mail/uudeview/files/inews.c.patch", "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=patch-libunac1.txt;att=1;bug=623340", "https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch", - "https://github.com/dlang/dub/pull/1221.patch", + "https://github.com/dlang/dub/commit/2c916b1a7999a050ac4970c3415ff8f91cd487aa.patch", ] patch_urls.each do |patch_url| source = <<~EOS @@ -91,13 +91,7 @@ describe RuboCop::Cop::FormulaAudit::Patches do # rubocop:disable Layout/LineLength elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) # rubocop:enable Layout/LineLength - [{ message: - <<~EOS, - use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch?full_index=1 - Rather than patch-diff: - https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch - EOS + [{ message: "Use a commit hash URL rather than patch-diff: #{patch_url}", severity: :convention, line: 5, column: 5, @@ -218,6 +212,8 @@ describe RuboCop::Cop::FormulaAudit::Patches do "http://trac.macports.org/export/102865/trunk/dports/mail/uudeview/files/inews.c.patch", "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=patch-libunac1.txt;att=1;bug=623340", "https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch", + "https://github.com/uber/h3/pull/362.patch?full_index=1", + "https://gitlab.gnome.org/GNOME/gitg/-/merge_requests/142.diff", ] patch_urls.each do |patch_url| source = <<~RUBY @@ -272,16 +268,22 @@ describe RuboCop::Cop::FormulaAudit::Patches do line: 5, column: 9, source: source }] + elsif patch_url.match?(%r{https://github.com/[^/]*/[^/]*/pull}) + [{ message: "Use a commit hash URL rather than an unstable pull request URL: #{patch_url}", + severity: :convention, + line: 5, + column: 9, + source: source }] + elsif patch_url.match?(%r{.*gitlab.*/merge_request.*}) + [{ message: "Use a commit hash URL rather than an unstable merge request URL: #{patch_url}", + severity: :convention, + line: 5, + column: 9, + source: source }] # rubocop:disable Layout/LineLength elsif patch_url.match?(%r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)}) # rubocop:enable Layout/LineLength - [{ message: - <<~EOS, - use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch?full_index=1 - Rather than patch-diff: - https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch - EOS + [{ message: "Use a commit hash URL rather than patch-diff: #{patch_url}", severity: :convention, line: 5, column: 9, diff --git a/Library/Homebrew/test/style_spec.rb b/Library/Homebrew/test/style_spec.rb index cd5bcaefda..36f8a035e0 100644 --- a/Library/Homebrew/test/style_spec.rb +++ b/Library/Homebrew/test/style_spec.rb @@ -6,13 +6,11 @@ describe Homebrew::Style do around do |example| FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml" - FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml" example.run ensure FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml" - FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml" end before do diff --git a/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz b/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz index 62ea6c264b..ee5eb8b4b4 100644 Binary files a/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz and b/Library/Homebrew/test/support/fixtures/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz differ diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-air.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-air.rb index 39c7214180..87f3b46d2e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-air.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-air.rb @@ -1,10 +1,10 @@ -cask 'adobe-air' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "adobe-air" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/TestCask.dmg' - name 'Adobe Air' - homepage 'https://brew.sh/' + url "https://brew.sh/TestCask.dmg" + name "Adobe Air" + homepage "https://brew.sh/" - app 'TestCask.app' + app "TestCask.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-illustrator.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-illustrator.rb index afe643362a..982540f469 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-illustrator.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/adobe-illustrator.rb @@ -1,10 +1,10 @@ -cask 'adobe-illustrator' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "adobe-illustrator" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/TestCask.dmg' - name 'Adobe Illustrator' - homepage 'https://brew.sh/' + url "https://brew.sh/TestCask.dmg" + name "Adobe Illustrator" + homepage "https://brew.sh/" - app 'TestCask.app' + app "TestCask.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb index 9cfdd1f386..9ad8f2be4b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb @@ -1,9 +1,9 @@ -cask 'appdir-interpolation' do - version '2.61' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "appdir-interpolation" do + version "2.61" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://brew.sh/appdir-interpolation' + homepage "https://brew.sh/appdir-interpolation" binary "#{appdir}/some/path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb index b0264369f5..508b606709 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb @@ -1,11 +1,11 @@ -cask 'auto-updates' do - version '2.61' - sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d' +cask "auto-updates" do + version "2.61" + sha256 "5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/MyFancyApp' + homepage "https://brew.sh/MyFancyApp" auto_updates true - app 'MyFancyApp/MyFancyApp.app' + app "MyFancyApp/MyFancyApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb index 71c2161948..af3a4a98db 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb @@ -1,9 +1,9 @@ -cask 'bad-checksum' do - version '1.2.3' - sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb' +cask "bad-checksum" do + version "1.2.3" + sha256 "badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum2.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum2.rb index 6fe4729e47..0e99fb4243 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum2.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum2.rb @@ -1,9 +1,9 @@ -cask 'bad-checksum2' do - version '1.2.3' - sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb' +cask "bad-checksum2" do + version "1.2.3" + sha256 "badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb" url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz" - homepage 'https://brew.sh/container-tar-gz' + homepage "https://brew.sh/container-tar-gz" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb index 427b2dc0d2..08b1ea7723 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb @@ -1,9 +1,9 @@ -cask 'basic-cask' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "basic-cask" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/TestCask.dmg' - homepage 'https://brew.sh/' + url "https://brew.sh/TestCask.dmg" + homepage "https://brew.sh/" - app 'TestCask.app' + app "TestCask.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb index 9d3a6d3334..a720d5300f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/booby-trap.rb @@ -1,8 +1,8 @@ -cask 'booby-trap' do - version '0.0.7' +cask "booby-trap" do + version "0.0.7" url do # to be lazily evaluated - raise 'Boom' + raise "Boom" end end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/compat/with-depends-on-macos-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/compat/with-depends-on-macos-string.rb index 939b7713cc..0d33222c22 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/compat/with-depends-on-macos-string.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/compat/with-depends-on-macos-string.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-macos-string' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-macos-string" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-macos-string' + homepage "https://brew.sh/with-depends-on-macos-string" depends_on macos: MacOS.version.to_s - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb index f7f2d9f83f..8b2dca0b8a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb @@ -1,11 +1,11 @@ -cask 'container-7z' do - version '1.2.3' - sha256 '3f9542ace85ed5f88549e2d0ea82210f8ddc87e0defbb78469d3aed719b3c964' +cask "container-7z" do + version "1.2.3" + sha256 "3f9542ace85ed5f88549e2d0ea82210f8ddc87e0defbb78469d3aed719b3c964" url "file://#{TEST_FIXTURE_DIR}/cask/container.7z" - homepage 'https://brew.sh/container-7z' + homepage "https://brew.sh/container-7z" - depends_on formula: 'unar' + depends_on formula: "unar" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb index 7ef7b8c03e..49d54be605 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb @@ -1,9 +1,9 @@ -cask 'container-bzip2' do - version '1.2.3' - sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c' +cask "container-bzip2" do + version "1.2.3" + sha256 "eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c" url "file://#{TEST_FIXTURE_DIR}/cask/container.bz2" - homepage 'https://brew.sh/container-bzip2' + homepage "https://brew.sh/container-bzip2" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb index c09fc0545c..59082d7a63 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb @@ -1,11 +1,11 @@ -cask 'container-cab' do - version '1.2.3' - sha256 'c267f5cebb14814c8e612a8b7d2bda02aec913f869509b6f1d3883427c0f552b' +cask "container-cab" do + version "1.2.3" + sha256 "c267f5cebb14814c8e612a8b7d2bda02aec913f869509b6f1d3883427c0f552b" url "file://#{TEST_FIXTURE_DIR}/cask/container.cab" - homepage 'https://brew.sh/container-cab' + homepage "https://brew.sh/container-cab" - depends_on formula: 'cabextract' + depends_on formula: "cabextract" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb index 1d34c071ec..7b1ebb8fea 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb @@ -1,9 +1,9 @@ -cask 'container-dmg' do - version '1.2.3' - sha256 '74d89d4fa5cef175cf43666ce11fefa3741aa1522114042ac75e656be37141a1' +cask "container-dmg" do + version "1.2.3" + sha256 "74d89d4fa5cef175cf43666ce11fefa3741aa1522114042ac75e656be37141a1" url "file://#{TEST_FIXTURE_DIR}/cask/container.dmg" - homepage 'https://brew.sh/container-dmg' + homepage "https://brew.sh/container-dmg" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb index 2ccc6c5628..96f86f416f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb @@ -1,9 +1,9 @@ -cask 'container-gzip' do - version '1.2.3' - sha256 'fa4ebb5246583c4b6e62e1df4e3b71b4e38a1d7d91c025665827195d36214b20' +cask "container-gzip" do + version "1.2.3" + sha256 "fa4ebb5246583c4b6e62e1df4e3b71b4e38a1d7d91c025665827195d36214b20" url "file://#{TEST_FIXTURE_DIR}/cask/container.gz" - homepage 'https://brew.sh/container-gzip' + homepage "https://brew.sh/container-gzip" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb index 11250b9082..2dd02e2db3 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb @@ -1,7 +1,7 @@ -cask 'container-pkg' do - version '1.2.3' - sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b' +cask "container-pkg" do + version "1.2.3" + sha256 "611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b" url "file://#{TEST_FIXTURE_DIR}/cask/container.pkg" - homepage 'https://brew.sh/container-pkg' + homepage "https://brew.sh/container-pkg" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb index 81afa6155f..3a4a03f4e4 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb @@ -1,9 +1,9 @@ -cask 'container-tar-gz' do - version '1.2.3' - sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5' +cask "container-tar-gz" do + version "1.2.3" + sha256 "fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5" url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz" - homepage 'https://brew.sh/container-tar-gz' + homepage "https://brew.sh/container-tar-gz" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb index 38a205a24b..6da86517a0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb @@ -1,9 +1,9 @@ -cask 'container-xar' do - version '1.2.3' - sha256 '5bb8e09a6fc630ebeaf266b1fd2d15e2ae7d32d7e4da6668a8093426fa1ba509' +cask "container-xar" do + version "1.2.3" + sha256 "5bb8e09a6fc630ebeaf266b1fd2d15e2ae7d32d7e4da6668a8093426fa1ba509" url "file://#{TEST_FIXTURE_DIR}/cask/container.xar" - homepage 'https://brew.sh/container-xar' + homepage "https://brew.sh/container-xar" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-with-appcast.rb index ff6ce958b1..5a83a2b1ef 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-with-appcast.rb @@ -1,12 +1,12 @@ -cask 'devmate-with-appcast' do - version '1.0' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "devmate-with-appcast" do + version "1.0" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" # dl.devmate.com/com.my.fancyapp was verified as official when first introduced to the cask url "https://dl.devmate.com/com.my.fancyapp/app_#{version}.zip" - appcast 'https://updates.devmate.com/com.my.fancyapp.app.xml' - name 'DevMate' - homepage 'https://www.brew.sh/' + appcast "https://updates.devmate.com/com.my.fancyapp.app.xml" + name "DevMate" + homepage "https://www.brew.sh/" - app 'DevMate.app' + app "DevMate.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-without-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-without-appcast.rb index 0d9b101167..fc3f177721 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-without-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/devmate-without-appcast.rb @@ -1,11 +1,11 @@ -cask 'devmate-without-appcast' do - version '1.0' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "devmate-without-appcast" do + version "1.0" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" # dl.devmate.com/com.my.fancyapp was verified as official when first introduced to the cask url "https://dl.devmate.com/com.my.fancyapp/app_#{version}.zip" - name 'DevMate' - homepage 'https://www.brew.sh/' + name "DevMate" + homepage "https://www.brew.sh/" - app 'DevMate.app' + app "DevMate.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb index 362bdd22d6..d35cf81382 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb @@ -1,3 +1,3 @@ -cask 'generic-artifact-absolute-target' do - artifact 'Caffeine.app', target: "#{appdir}/Caffeine.app" +cask "generic-artifact-absolute-target" do + artifact "Caffeine.app", target: "#{appdir}/Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb index eb521e35aa..576f4de472 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb @@ -1,3 +1,3 @@ -cask 'generic-artifact-relative-target' do - artifact 'Caffeine.app', target: 'Caffeine.app' +cask "generic-artifact-relative-target" do + artifact "Caffeine.app", target: "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/github-with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/github-with-appcast.rb index 5017b4f501..5f679fb8f2 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/github-with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/github-with-appcast.rb @@ -1,13 +1,13 @@ -cask 'github-with-appcast' do - version '1.0' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "github-with-appcast" do + version "1.0" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" url "https://github.com/user/project/releases/download/#{version}/github.pkg" - appcast 'https://github.com/user/project/releases.atom' - name 'github' - homepage 'https://github.com/user/project' + appcast "https://github.com/user/project/releases.atom" + name "github" + homepage "https://github.com/user/project" - pkg 'github.pkg' + pkg "github.pkg" - uninstall pkgutil: 'com.github' + uninstall pkgutil: "com.github" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/github-without-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/github-without-appcast.rb index 9e7e17864d..3637fda875 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/github-without-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/github-without-appcast.rb @@ -1,12 +1,12 @@ -cask 'github-without-appcast' do - version '1.0' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "github-without-appcast" do + version "1.0" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" url "https://github.com/user/project/releases/download/#{version}/github.pkg" - name 'github' - homepage 'https://github.com/user/project' + name "github" + homepage "https://github.com/user/project" - pkg 'github.pkg' + pkg "github.pkg" - uninstall pkgutil: 'com.github' + uninstall pkgutil: "com.github" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-with-appcast.rb index 6d1b89a737..48385f356a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-with-appcast.rb @@ -1,12 +1,12 @@ -cask 'hockeyapp-with-appcast' do - version '1.0,123' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "hockeyapp-with-appcast" do + version "1.0,123" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" # rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1 was verified as official when first introduced to the cask url "https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1/app_versions/#{version.after_comma}?format=zip" - appcast 'https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1' - name 'HockeyApp' - homepage 'https://www.brew.sh/' + appcast "https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1" + name "HockeyApp" + homepage "https://www.brew.sh/" - app 'HockeyApp.app' + app "HockeyApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-without-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-without-appcast.rb index 717f6ebf48..c4000dac81 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-without-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/hockeyapp-without-appcast.rb @@ -1,11 +1,11 @@ -cask 'hockeyapp-without-appcast' do - version '1.0,123' - sha256 'a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9' +cask "hockeyapp-without-appcast" do + version "1.0,123" + sha256 "a69e7357bea014f4c14ac9699274f559086844ffa46563c4619bf1addfd72ad9" # rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1 was verified as official when first introduced to the cask url "https://rink.hockeyapp.net/api/2/apps/67503a7926431872c4b6c1549f5bd6b1/app_versions/#{version.after_comma}?format=zip" - name 'HockeyApp' - homepage 'https://www.brew.sh/' + name "HockeyApp" + homepage "https://www.brew.sh/" - app 'HockeyApp.app' + app "HockeyApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb index ce2296af4a..4d1893d44b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/installer-with-uninstall.rb @@ -1,11 +1,11 @@ -cask 'installer-with-uninstall' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "installer-with-uninstall" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - installer manual: 'Caffeine.app' + installer manual: "Caffeine.app" - uninstall delete: '/Applications/Caffeine.app' + uninstall delete: "/Applications/Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb index 2804da7c39..d2c6809eec 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb @@ -1,4 +1,4 @@ -cask 'invalid-sha256' do - version '1.2.3' - sha256 'not a valid shasum' +cask "invalid-sha256" do + version "1.2.3" + sha256 "not a valid shasum" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb index beb52b42f7..69d7f8f4a5 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb @@ -1,11 +1,11 @@ -cask 'invalid-appcast-multiple' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-appcast-multiple" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast 'https://brew.sh/appcast1.xml' - appcast 'https://brew.sh/appcast2.xml' - homepage 'https://brew.sh/invalid-appcast-multiple' + appcast "https://brew.sh/appcast1.xml" + appcast "https://brew.sh/appcast2.xml" + homepage "https://brew.sh/invalid-appcast-multiple" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb index 1aa85a693e..b5fa78e0f0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb @@ -1,10 +1,10 @@ -cask 'invalid-appcast-url' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-appcast-url" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" appcast 1 - homepage 'https://brew.sh/invalid-appcast-url' + homepage "https://brew.sh/invalid-appcast-url" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb index 03b5e74ce9..9a8974d725 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb @@ -1,11 +1,11 @@ -cask 'invalid-conflicts-with-key' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-conflicts-with-key" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/invalid-conflicts-with-key' + homepage "https://brew.sh/invalid-conflicts-with-key" - conflicts_with no_such_key: 'unar' + conflicts_with no_such_key: "unar" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb index 4a5e12857b..dc9bfdc835 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb @@ -1,11 +1,11 @@ -cask 'invalid-depends-on-arch-value' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-depends-on-arch-value" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/invalid-depends-on-arch-value' + homepage "https://brew.sh/invalid-depends-on-arch-value" depends_on arch: :no_such_arch - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb index 1b653ed61e..346bed45d8 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb @@ -1,11 +1,11 @@ -cask 'invalid-depends-on-key' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-depends-on-key" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/invalid-depends-on-key' + homepage "https://brew.sh/invalid-depends-on-key" - depends_on no_such_key: 'unar' + depends_on no_such_key: "unar" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb index 4d553bffa3..cc1cb02870 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb @@ -1,11 +1,11 @@ -cask 'invalid-depends-on-macos-bad-release' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-depends-on-macos-bad-release" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/invalid-depends-on-macos-bad-release' + homepage "https://brew.sh/invalid-depends-on-macos-bad-release" depends_on macos: :no_such_release - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb index 5ebc910357..780b00135d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb @@ -1,11 +1,11 @@ -cask 'invalid-depends-on-x11-value' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-depends-on-x11-value" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/invalid-depends-on-x11-value' + homepage "https://brew.sh/invalid-depends-on-x11-value" depends_on x11: :no_such_value - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-generic-artifact-no-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-generic-artifact-no-target.rb index b0dab8a0ec..91c6318f76 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-generic-artifact-no-target.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-generic-artifact-no-target.rb @@ -1,9 +1,9 @@ -cask 'invalid-generic-artifact-no-target' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-generic-artifact-no-target" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-generic-artifact' + homepage "https://brew.sh/with-generic-artifact" - artifact 'Caffeine.app' + artifact "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb index 20896b4566..91f77d9e2b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb @@ -1,9 +1,9 @@ -cask 'invalid-header-format', :invalid do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-header-format", :invalid do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb index f459c13a26..9e46d590c0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb @@ -1,9 +1,9 @@ -cask 'invalid-header-token-mismatch-this-text-does-not-belong' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-header-token-mismatch-this-text-does-not-belong" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb index 36907fb57a..6bcc927db6 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb @@ -1,9 +1,9 @@ -cask 'invalid-header-version' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-header-version" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-manpage-no-section.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-manpage-no-section.rb index 6dd3148756..32d5ee74d0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-manpage-no-section.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-manpage-no-section.rb @@ -1,9 +1,9 @@ -cask 'invalid-manpage-no-section' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-manpage-no-section" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithManpage.zip" - homepage 'https://brew.sh/with-generic-artifact' + homepage "https://brew.sh/with-generic-artifact" - manpage 'manpage' + manpage "manpage" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb index eed2dc356d..e94969fbe9 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb @@ -1,10 +1,10 @@ -cask 'invalid-stage-only-conflict' do - version '2.61' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "invalid-stage-only-conflict" do + version "2.61" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://brew.sh/invalid-stage-only-conflict' + homepage "https://brew.sh/invalid-stage-only-conflict" - app 'Transmission.app' + app "Transmission.app" stage_only true end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb index 670df6aef6..b7325149a5 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb @@ -1,10 +1,10 @@ -cask 'invalid-two-homepage' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-two-homepage" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' - homepage 'https://www.brew.sh/local-caffeine' + homepage "https://brew.sh/" + homepage "https://www.brew.sh/local-caffeine" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb index 47e0918d95..b8b4e731cc 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb @@ -1,10 +1,10 @@ -cask 'invalid-two-url' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-two-url" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - url 'https://brew.sh/caffeine.zip' - homepage 'https://brew.sh/' + url "https://brew.sh/caffeine.zip" + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb index b806c401f1..f952d94e60 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb @@ -1,10 +1,10 @@ -cask 'invalid-two-version' do - version '1.2.3' - version '2.0' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "invalid-two-version" do + version "1.2.3" + version "2.0" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-appcast.rb index df7572e8f8..ad893cf7a6 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-appcast.rb @@ -1,10 +1,10 @@ -cask 'latest-with-appcast' do +cask "latest-with-appcast" do version :latest sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast 'https://brew.sh/appcast.xml' - homepage 'https://brew.sh/with-appcast' + appcast "https://brew.sh/appcast.xml" + homepage "https://brew.sh/with-appcast" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-auto-updates.rb index a4fa9c2016..e02a7f5aaa 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-auto-updates.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/latest-with-auto-updates.rb @@ -1,11 +1,11 @@ -cask 'latest-with-auto-updates' do +cask "latest-with-auto-updates" do version :latest sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/latest-with-auto-updates' + homepage "https://brew.sh/latest-with-auto-updates" auto_updates true - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb index 8954b938fc..c467ca45ac 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb @@ -1,9 +1,9 @@ -cask 'local-caffeine' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "local-caffeine" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb index 8ce49a20db..eada3e74c0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb @@ -1,10 +1,10 @@ -cask 'local-transmission' do - version '2.61' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "local-transmission" do + version "2.61" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - name 'Transmission' - homepage 'https://brew.sh/' + name "Transmission" + homepage "https://brew.sh/" - app 'Transmission.app' + app "Transmission.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb index bfa15821a8..8bfee251e1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb @@ -1,8 +1,8 @@ -cask 'missing-checksum' do - version '1.2.3' +cask "missing-checksum" do + version "1.2.3" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb index dce0784720..6701d8515a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb @@ -1,5 +1,5 @@ -cask 'missing-homepage' do - version '1.2.3' +cask "missing-homepage" do + version "1.2.3" - url 'https://localhost/something.dmg' + url "https://localhost/something.dmg" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb index f2946745f3..594ea29228 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-name.rb @@ -1,5 +1,5 @@ -cask 'missing-name' do - version '1.2.3' +cask "missing-name" do + version "1.2.3" - url 'https://localhost/something.dmg' + url "https://localhost/something.dmg" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb index 8c7567ba60..7694834727 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-sha256.rb @@ -1,5 +1,5 @@ -cask 'missing-sha256' do - version '1.2.3' +cask "missing-sha256" do + version "1.2.3" - url 'https://localhost/something.dmg' + url "https://localhost/something.dmg" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb index 65a44012b0..2febb8a9c1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-url.rb @@ -1,5 +1,5 @@ -cask 'missing-url' do - version '1.2.3' +cask "missing-url" do + version "1.2.3" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb index 3ba32d4f7b..d87e40df29 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/missing-version.rb @@ -1,4 +1,4 @@ -cask 'missing-version' do - url 'https://brew.sh/TestCask.dmg' - homepage 'https://brew.sh/' +cask "missing-version" do + url "https://brew.sh/TestCask.dmg" + homepage "https://brew.sh/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb index 7b5be8080b..bb27d403d6 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/naked-executable.rb @@ -1,9 +1,9 @@ -cask 'naked-executable' do - version '1.2.3' - sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb' +cask "naked-executable" do + version "1.2.3" + sha256 "306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb" url "file://#{TEST_FIXTURE_DIR}/cask/naked_executable" - homepage 'https://brew.sh/naked-executable' + homepage "https://brew.sh/naked-executable" container type: :naked end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb index 5b96c367b6..95915be6c0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/nested-app.rb @@ -1,11 +1,11 @@ -cask 'nested-app' do - version '1.2.3' - sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216' +cask "nested-app" do + version "1.2.3" + sha256 "1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216" url "file://#{TEST_FIXTURE_DIR}/cask/NestedApp.dmg.zip" - homepage 'https://brew.sh/nested-app' + homepage "https://brew.sh/nested-app" - container nested: 'NestedApp.dmg' + container nested: "NestedApp.dmg" - app 'MyNestedApp.app' + app "MyNestedApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb index d563137b54..151e9e04f5 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/no-checksum.rb @@ -1,9 +1,9 @@ -cask 'no-checksum' do - version '1.2.3' +cask "no-checksum" do + version "1.2.3" sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb index 4b9a721b93..26a5e2f66e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/no-dsl-version.rb @@ -1,9 +1,9 @@ -cask 'no-dsl-version' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "no-dsl-version" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/TestCask.dmg' - homepage 'https://brew.sh/' + url "https://brew.sh/TestCask.dmg" + homepage "https://brew.sh/" - app 'TestCask.app' + app "TestCask.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb index 2a16272bd6..c80bdacf6d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-correct-url-format.rb @@ -1,6 +1,6 @@ -cask 'osdn-correct-url-format' do - version '1.2.3' +cask "osdn-correct-url-format" do + version "1.2.3" - url 'https://user.dl.osdn.jp/something/id/Something-1.2.3.dmg' - homepage 'https://osdn.jp/projects/something/' + url "https://user.dl.osdn.jp/something/id/Something-1.2.3.dmg" + homepage "https://osdn.jp/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb index ec5ae464b1..10a36d10cc 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/osdn-incorrect-url-format.rb @@ -1,6 +1,6 @@ -cask 'osdn-incorrect-url-format' do - version '1.2.3' +cask "osdn-incorrect-url-format" do + version "1.2.3" - url 'https://osdn.jp/projects/something/files/Something-1.2.3.dmg/download' - homepage 'https://osdn.jp/projects/something/' + url "https://osdn.jp/projects/something/files/Something-1.2.3.dmg/download" + homepage "https://osdn.jp/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/auto-updates.rb index b78323b075..c2863c3e4f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/auto-updates.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/auto-updates.rb @@ -1,11 +1,11 @@ -cask 'auto-updates' do - version '2.57' - sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d' +cask "auto-updates" do + version "2.57" + sha256 "5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/MyFancyApp' + homepage "https://brew.sh/MyFancyApp" auto_updates true - app 'MyFancyApp/MyFancyApp.app' + app "MyFancyApp/MyFancyApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb index 8b223262ca..40b91ce422 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum.rb @@ -1,9 +1,9 @@ -cask 'bad-checksum' do - version '1.2.2' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "bad-checksum" do + version "1.2.2" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum2.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum2.rb index efeb1e32ad..6bbdb259a4 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum2.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/bad-checksum2.rb @@ -1,9 +1,9 @@ -cask 'bad-checksum2' do - version '1.2.2' - sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5' +cask "bad-checksum2" do + version "1.2.2" + sha256 "fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5" url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz" - homepage 'https://brew.sh/container-tar-gz' + homepage "https://brew.sh/container-tar-gz" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb index 97a7372597..e6801eb984 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-caffeine.rb @@ -1,9 +1,9 @@ -cask 'local-caffeine' do - version '1.2.2' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "local-caffeine" do + version "1.2.2" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb index a3f5377ee9..aeb9941479 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/local-transmission.rb @@ -1,9 +1,9 @@ -cask 'local-transmission' do - version '2.60' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "local-transmission" do + version "2.60" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Transmission.app' + app "Transmission.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb index 72664ce456..c4389c4253 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/version-latest.rb @@ -1,10 +1,10 @@ -cask 'version-latest' do +cask "version-latest" do version :latest sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine Mini.app' - app 'Caffeine Pro.app' + app "Caffeine Mini.app" + app "Caffeine Pro.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/will-fail-if-upgraded.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/will-fail-if-upgraded.rb index f617c33f3d..6cb17a6cfc 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/will-fail-if-upgraded.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/outdated/will-fail-if-upgraded.rb @@ -1,9 +1,9 @@ -cask 'will-fail-if-upgraded' do - version '1.2.2' - sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5' +cask "will-fail-if-upgraded" do + version "1.2.2" + sha256 "fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5" url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.gz" - homepage 'https://brew.sh/container-tar-gz' + homepage "https://brew.sh/container-tar-gz" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/pkg-without-uninstall.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/pkg-without-uninstall.rb index 8c9fc68879..a51c8ec886 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/pkg-without-uninstall.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/pkg-without-uninstall.rb @@ -1,9 +1,9 @@ -cask 'pkg-without-uninstall' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "pkg-without-uninstall" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb index 0bf3ee9b5a..a3daf6eb9b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sha256-for-empty-string.rb @@ -1,4 +1,4 @@ -cask 'sha256-for-empty-string' do - version '1.2.3' - sha256 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' +cask "sha256-for-empty-string" do + version "1.2.3" + sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb index 439eb8998d..8546dfb751 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-correct-url-format.rb @@ -1,6 +1,6 @@ -cask 'sourceforge-correct-url-format' do - version '1.2.3' +cask "sourceforge-correct-url-format" do + version "1.2.3" - url 'https://downloads.sourceforge.net/something/Something-1.2.3.dmg' - homepage 'https://sourceforge.net/projects/something/' + url "https://downloads.sourceforge.net/something/Something-1.2.3.dmg" + homepage "https://sourceforge.net/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb index e70c41ea7c..365db0fe83 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-incorrect-url-format.rb @@ -1,6 +1,6 @@ -cask 'sourceforge-incorrect-url-format' do - version '1.2.3' +cask "sourceforge-incorrect-url-format" do + version "1.2.3" - url 'https://sourceforge.net/projects/something/files/Something-1.2.3.dmg/download' - homepage 'https://sourceforge.net/projects/something/' + url "https://sourceforge.net/projects/something/files/Something-1.2.3.dmg/download" + homepage "https://sourceforge.net/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb index 07b068f707..49801ce2a0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-version-latest-correct-url-format.rb @@ -1,6 +1,6 @@ -cask 'sourceforge-version-latest-correct-url-format' do +cask "sourceforge-version-latest-correct-url-format" do version :latest - url 'https://sourceforge.net/projects/something/files/latest/download' - homepage 'https://sourceforge.net/projects/something/' + url "https://sourceforge.net/projects/something/files/latest/download" + homepage "https://sourceforge.net/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-with-appcast.rb index 2e3b221614..ad813becfa 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/sourceforge-with-appcast.rb @@ -1,7 +1,7 @@ -cask 'sourceforge-with-appcast' do - version '1.2.3' +cask "sourceforge-with-appcast" do + version "1.2.3" - url 'https://downloads.sourceforge.net/something/Something-1.2.3.dmg' - appcast 'https://sourceforge.net/projects/something/rss' - homepage 'https://sourceforge.net/projects/something/' + url "https://downloads.sourceforge.net/something/Something-1.2.3.dmg" + appcast "https://sourceforge.net/projects/something/rss" + homepage "https://sourceforge.net/projects/something/" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb index 27eb3a4095..5c29e7a75e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/stage-only.rb @@ -1,9 +1,9 @@ -cask 'stage-only' do - version '2.61' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "stage-only" do + version "2.61" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://brew.sh/stage-only' + homepage "https://brew.sh/stage-only" stage_only true end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb index aea8e71280..6c005620e0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera-mail.rb @@ -1,9 +1,9 @@ -cask 'test-opera-mail' do - version '1.0' - sha256 'afd192e308f8ea8ddb3d426fd6663d97078570417ee78b8e1fa15f515ae3d677' +cask "test-opera-mail" do + version "1.0" + sha256 "afd192e308f8ea8ddb3d426fd6663d97078570417ee78b8e1fa15f515ae3d677" - url 'https://get-ash-1.opera.com/pub/opera/mail/1.0/mac/Opera-Mail-1.0-1040.i386.dmg' - homepage 'https://www.opera.com/computer/mail' + url "https://get-ash-1.opera.com/pub/opera/mail/1.0/mac/Opera-Mail-1.0-1040.i386.dmg" + homepage "https://www.opera.com/computer/mail" - app 'Opera Mail.app' + app "Opera Mail.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb index 8d34cb8b7a..4c3888c6d2 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/test-opera.rb @@ -1,9 +1,9 @@ -cask 'test-opera' do - version '19.0.1326.47' - sha256 '7b91f20ab754f7b3fef8dc346e0393917e11676b74c8f577408841619f76040a' +cask "test-opera" do + version "19.0.1326.47" + sha256 "7b91f20ab754f7b3fef8dc346e0393917e11676b74c8f577408841619f76040a" - url 'https://get.geo.opera.com/pub/opera/desktop/19.0.1326.47/mac/Opera_19.0.1326.47_Setup.dmg' - homepage 'https://www.opera.com/' + url "https://get.geo.opera.com/pub/opera/desktop/19.0.1326.47/mac/Opera_19.0.1326.47_Setup.dmg" + homepage "https://www.opera.com/" - app 'Opera.app' + app "Opera.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb index 6bd090c281..1b2d6c401d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-string.rb @@ -1,4 +1,4 @@ -cask 'version-latest-string' do - version 'latest' +cask "version-latest-string" do + version "latest" sha256 :no_check end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb index 040cfc76e6..4d2f35957f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest-with-checksum.rb @@ -1,4 +1,4 @@ -cask 'version-latest-with-checksum' do +cask "version-latest-with-checksum" do version :latest - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb index 72664ce456..c4389c4253 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb @@ -1,10 +1,10 @@ -cask 'version-latest' do +cask "version-latest" do version :latest sha256 :no_check url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine Mini.app' - app 'Caffeine Pro.app' + app "Caffeine Mini.app" + app "Caffeine Pro.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb index 06f4049c37..0ad4b91a8f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/will-fail-if-upgraded.rb @@ -1,9 +1,9 @@ -cask 'will-fail-if-upgraded' do - version '1.2.3' - sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68' +cask "will-fail-if-upgraded" do + version "1.2.3" + sha256 "e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68" url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'container' + app "container" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-allow-untrusted.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-allow-untrusted.rb index cf4d08fb8c..1d688a170c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-allow-untrusted.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-allow-untrusted.rb @@ -1,11 +1,11 @@ -cask 'with-allow-untrusted' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-allow-untrusted" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg', allow_untrusted: true + pkg "Fancy.pkg", allow_untrusted: true - uninstall pkgutil: 'my.fancy.package.*' + uninstall pkgutil: "my.fancy.package.*" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb index 099cb28fe7..15af2b4c83 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-alt-target.rb @@ -1,9 +1,9 @@ -cask 'with-alt-target' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-alt-target" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app', target: 'AnotherName.app' + app "Caffeine.app", target: "AnotherName.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb index b99bd53126..c26b429354 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb @@ -1,10 +1,10 @@ -cask 'with-appcast' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-appcast" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast 'https://brew.sh/appcast.xml' - homepage 'https://brew.sh/with-appcast' + appcast "https://brew.sh/appcast.xml" + homepage "https://brew.sh/with-appcast" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb index 60b16314ba..308751bf6b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb @@ -1,12 +1,12 @@ -cask 'with-auto-updates' do - version '1.0' - sha256 'e5be907a51cd0d5b128532284afe1c913608c584936a5e55d94c75a9f48c4322' +cask "with-auto-updates" do + version "1.0" + sha256 "e5be907a51cd0d5b128532284afe1c913608c584936a5e55d94c75a9f48c4322" url "https://brew.sh/autoupdates_#{version}.zip" - name 'AutoUpdates' - homepage 'https://brew.sh/autoupdates' + name "AutoUpdates" + homepage "https://brew.sh/autoupdates" auto_updates true - app 'AutoUpdates.app' + app "AutoUpdates.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb index a92b9be233..b330074da7 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-autodetected-manpage-section.rb @@ -1,9 +1,9 @@ -cask 'with-autodetected-manpage-section' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-autodetected-manpage-section" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithManpage.zip" - homepage 'https://brew.sh/with-autodetected-manpage-section' + homepage "https://brew.sh/with-autodetected-manpage-section" - manpage 'manpage.1' + manpage "manpage.1" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb index daf42f6b05..6915314edd 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-binary.rb @@ -1,10 +1,10 @@ -cask 'with-binary' do - version '1.2.3' - sha256 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2' +cask "with-binary" do + version "1.2.3" + sha256 "d5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithBinary.zip" - homepage 'https://brew.sh/with-binary' + homepage "https://brew.sh/with-binary" - app 'App.app' - binary 'binary' + app "App.app" + binary "binary" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb index ca516484bc..9df2be5119 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-caveats.rb @@ -1,11 +1,11 @@ -cask 'with-caveats' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-caveats" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" # simple string is evaluated at compile-time caveats <<~EOS @@ -17,7 +17,7 @@ cask 'with-caveats' do end # a do block may print and use a DSL caveats do - puts 'Custom text via puts followed by DSL-generated text:' - path_environment_variable('/custom/path/bin') + puts "Custom text via puts followed by DSL-generated text:" + path_environment_variable("/custom/path/bin") end end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb index 1cd69050f9..15832738e1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-choices.rb @@ -1,16 +1,16 @@ -cask 'with-choices' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-choices" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg', + pkg "MyFancyPkg/Fancy.pkg", choices: [ - { - 'choiceIdentifier' => 'choice1', - 'choiceAttribute' => 'selected', - 'attributeSetting' => 1, - }, - ] + { + "choiceIdentifier" => "choice1", + "choiceAttribute" => "selected", + "attributeSetting" => 1, + }, + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb index 441b93e5a1..265bd7757d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conditional-caveats.rb @@ -1,14 +1,14 @@ -cask 'with-conditional-caveats' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-conditional-caveats" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" # a do block may print and use a DSL caveats do - puts 'This caveat is conditional' if false # rubocop:disable Lint/LiteralAsCondition + puts "This caveat is conditional" if false # rubocop:disable Lint/LiteralAsCondition end end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb index 7b09976da1..9986a5d039 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-conflicts-with.rb @@ -1,11 +1,11 @@ -cask 'with-conflicts-with' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-conflicts-with" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-conflicts-with' + homepage "https://brew.sh/with-conflicts-with" - conflicts_with cask: 'local-caffeine' + conflicts_with cask: "local-caffeine" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb index 1770d526e1..13fa517d6c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-arch.rb @@ -1,12 +1,12 @@ -cask 'with-depends-on-arch' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-arch" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-arch' + homepage "https://brew.sh/with-depends-on-arch" # covers all known hardware; always succeeds depends_on arch: :intel - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb index ce3f00615b..8e7986fa76 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic-helper.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-cask-cyclic-helper' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-cask-cyclic-helper" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-cask-cyclic-helper' + homepage "https://brew.sh/with-depends-on-cask-cyclic-helper" - depends_on cask: 'with-depends-on-cask-cyclic' + depends_on cask: "with-depends-on-cask-cyclic" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb index 824e2fa5fe..e1c324567c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-cyclic.rb @@ -1,12 +1,12 @@ -cask 'with-depends-on-cask-cyclic' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-cask-cyclic" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-cask-cyclic' + homepage "https://brew.sh/with-depends-on-cask-cyclic" - depends_on cask: 'local-caffeine' - depends_on cask: 'with-depends-on-cask-cyclic-helper' + depends_on cask: "local-caffeine" + depends_on cask: "with-depends-on-cask-cyclic-helper" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb index de3f3391b1..e67ecb5cb6 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask-multiple.rb @@ -1,12 +1,12 @@ -cask 'with-depends-on-cask-multiple' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-cask-multiple" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-cask-multiple' + homepage "https://brew.sh/with-depends-on-cask-multiple" - depends_on cask: 'local-caffeine' - depends_on cask: 'local-transmission' + depends_on cask: "local-caffeine" + depends_on cask: "local-transmission" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb index 2bc3989340..a7af1f4203 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-cask.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-cask' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-cask" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-cask' + homepage "https://brew.sh/with-depends-on-cask" - depends_on cask: 'local-transmission' + depends_on cask: "local-transmission" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb index 8ef79374be..c3ce42aa7c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula-multiple.rb @@ -1,12 +1,12 @@ -cask 'with-depends-on-formula-multiple' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-formula-multiple" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-formula-multiple' + homepage "https://brew.sh/with-depends-on-formula-multiple" - depends_on formula: 'unar' - depends_on formula: 'fileutils' + depends_on formula: "unar" + depends_on formula: "fileutils" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb index 41f2df5a47..3d3be94474 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-formula.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-formula' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-formula" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-formula' + homepage "https://brew.sh/with-depends-on-formula" - depends_on formula: 'unar' + depends_on formula: "unar" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb index 195edfae4c..652ac08b8e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-failure.rb @@ -1,12 +1,12 @@ -cask 'with-depends-on-macos-failure' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-macos-failure" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-macos-failure' + homepage "https://brew.sh/with-depends-on-macos-failure" # guarantee a mismatched release depends_on macos: MacOS.version == :catalina ? :mojave : :catalina - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb index cc0be4dc41..048419cd9e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-macos-symbol.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-macos-symbol' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-macos-symbol" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-macos-symbol' + homepage "https://brew.sh/with-depends-on-macos-symbol" depends_on macos: MacOS.version.to_sym - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb index 0ac78dea2e..fed80ab8a1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11-false.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-x11-false' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-x11-false" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-x11-false' + homepage "https://brew.sh/with-depends-on-x11-false" depends_on x11: false - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb index 50e17d10d7..3df71437ee 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-depends-on-x11.rb @@ -1,11 +1,11 @@ -cask 'with-depends-on-x11' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-depends-on-x11" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-depends-on-x11' + homepage "https://brew.sh/with-depends-on-x11" depends_on x11: true - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb index 0421291aba..69a1ac2d1a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-embedded-binary.rb @@ -1,10 +1,10 @@ -cask 'with-embedded-binary' do - version '1.2.3' - sha256 'fe052d3e77d92676775fd916ddb8942e72a565b844ea7f6d055474c99bb4e47b' +cask "with-embedded-binary" do + version "1.2.3" + sha256 "fe052d3e77d92676775fd916ddb8942e72a565b844ea7f6d055474c99bb4e47b" url "file://#{TEST_FIXTURE_DIR}/cask/AppWithEmbeddedBinary.zip" - homepage 'https://brew.sh/with-binary' + homepage "https://brew.sh/with-binary" - app 'App.app' + app "App.app" binary "#{appdir}/App.app/Contents/MacOS/App/binary" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb index 379dcc7676..d4840107c0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-generic-artifact.rb @@ -1,9 +1,9 @@ -cask 'with-generic-artifact' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-generic-artifact" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-generic-artifact' + homepage "https://brew.sh/with-generic-artifact" - artifact 'Caffeine.app', target: "#{appdir}/Caffeine.app" + artifact "Caffeine.app", target: "#{appdir}/Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb index ec0e22e6c0..fe7cd83008 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installable.rb @@ -1,21 +1,21 @@ -cask 'with-installable' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-installable" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: ['--please'] }, - quit: 'my.fancy.package.app', - login_item: 'Fancy', + uninstall script: { executable: "MyFancyPkg/FancyUninstaller.tool", args: ["--please"] }, + quit: "my.fancy.package.app", + login_item: "Fancy", delete: [ - "#{TEST_TMPDIR}/absolute_path", - '~/path_with_tilde', - "#{TEST_TMPDIR}/glob_path*", - 'impermissible/relative/path', - '/another/impermissible/../relative/path', - ], + "#{TEST_TMPDIR}/absolute_path", + "~/path_with_tilde", + "#{TEST_TMPDIR}/glob_path*", + "impermissible/relative/path", + "/another/impermissible/../relative/path", + ], rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb index bda4edd871..7f7e9192ea 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-manual.rb @@ -1,9 +1,9 @@ -cask 'with-installer-manual' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-installer-manual" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - installer manual: 'Caffeine.app' + installer manual: "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb index 0e6bf65121..42b933787b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-installer-script.rb @@ -1,15 +1,15 @@ -cask 'with-installer-script' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "with-installer-script" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/with-install-script' + homepage "https://brew.sh/with-install-script" - installer script: '/usr/bin/true', - args: ['--flag'] + installer script: "/usr/bin/true", + args: ["--flag"] # acceptable alternate form installer script: { - executable: '/usr/bin/false', - args: ['--flag'], - } + executable: "/usr/bin/false", + args: ["--flag"], + } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb index b8b57727be..2bbafea7a1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-languages.rb @@ -1,18 +1,18 @@ -cask 'with-languages' do - version '1.2.3' +cask "with-languages" do + version "1.2.3" - language 'zh' do - sha256 'abc123' - 'zh-CN' + language "zh" do + sha256 "abc123" + "zh-CN" end - language 'en-US', default: true do - sha256 'xyz789' - 'en-US' + language "en-US", default: true do + sha256 "xyz789" + "en-US" end url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb index b0f29815dd..b02e74e98d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-macosx-dir.rb @@ -1,9 +1,9 @@ -cask 'with-macosx-dir' do - version '1.2.3' - sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d' +cask "with-macosx-dir" do + version "1.2.3" + sha256 "5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/MyFancyApp' + homepage "https://brew.sh/MyFancyApp" - app 'MyFancyApp/MyFancyApp.app' + app "MyFancyApp/MyFancyApp.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-non-executable-binary.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-non-executable-binary.rb index 7893acfe74..0ed70fff27 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-non-executable-binary.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-non-executable-binary.rb @@ -1,9 +1,9 @@ -cask 'with-non-executable-binary' do - version '1.2.3' - sha256 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2' +cask "with-non-executable-binary" do + version "1.2.3" + sha256 "d5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2" url "file://#{TEST_FIXTURE_DIR}/cask/naked_non_executable" - homepage 'https://brew.sh/with-binary' + homepage "https://brew.sh/with-binary" - binary 'naked_non_executable' + binary "naked_non_executable" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb index d7ce43aae4..b19a54de04 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-pkgutil-zap.rb @@ -1,13 +1,13 @@ -cask 'with-pkgutil-zap' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-pkgutil-zap" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" - zap pkgutil: 'my.fancy.package.*', - kext: 'my.fancy.package.kernelextension', - launchctl: 'my.fancy.package.service' + zap pkgutil: "my.fancy.package.*", + kext: "my.fancy.package.kernelextension", + launchctl: "my.fancy.package.service" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb index 57989676df..f0b82d4716 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight-multi.rb @@ -1,11 +1,11 @@ -cask 'with-postflight-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-postflight-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" postflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb index a12ed6b5b9..b14223ccbd 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-postflight.rb @@ -1,11 +1,11 @@ -cask 'with-postflight' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-postflight" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" postflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb index a84021dde0..c62bfdcebc 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight-multi.rb @@ -1,11 +1,11 @@ -cask 'with-preflight-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-preflight-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" preflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb index af3ce7d205..29bc0b0c16 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-preflight.rb @@ -1,11 +1,11 @@ -cask 'with-preflight' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-preflight" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" preflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb index ed20338127..0a976d1970 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-suite.rb @@ -1,10 +1,10 @@ -cask 'with-suite' do - version '1.2.3' - sha256 'd95dcc12d4e5be0bc3cb9793c4b7e7f69a25f0b3c7418494b0c883957e6eeae4' +cask "with-suite" do + version "1.2.3" + sha256 "d95dcc12d4e5be0bc3cb9793c4b7e7f69a25f0b3c7418494b0c883957e6eeae4" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine-suite.zip" - name 'Caffeine' - homepage 'https://brew.sh/with-suite' + name "Caffeine" + homepage "https://brew.sh/with-suite" - suite 'Caffeine' + suite "Caffeine" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb index 819b21233a..31093c90c0 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-correct.rb @@ -1,10 +1,10 @@ -cask 'with-two-apps-correct' do - version '1.2.3' - sha256 '3178fbfd1ea5d87a2a0662a4eb599ebc9a03888e73f37538d9f3f6ee69d2368e' +cask "with-two-apps-correct" do + version "1.2.3" + sha256 "3178fbfd1ea5d87a2a0662a4eb599ebc9a03888e73f37538d9f3f6ee69d2368e" url "file://#{TEST_FIXTURE_DIR}/cask/caffeines.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine Mini.app' - app 'Caffeine Pro.app' + app "Caffeine Mini.app" + app "Caffeine Pro.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb index 8ebf136057..5f273e6ac7 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-two-apps-subdir.rb @@ -1,10 +1,10 @@ -cask 'with-two-apps-subdir' do - version '1.2.3' - sha256 'd687c22a21c02bd8f07da9302c8292b93a04df9a929e3f04d09aea6c76f75c65' +cask "with-two-apps-subdir" do + version "1.2.3" + sha256 "d687c22a21c02bd8f07da9302c8292b93a04df9a929e3f04d09aea6c76f75c65" url "file://#{TEST_FIXTURE_DIR}/cask/caffeines-subdir.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeines/Caffeine Mini.app' - app 'Caffeines/Caffeine Pro.app' + app "Caffeines/Caffeine Mini.app" + app "Caffeines/Caffeine Pro.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb index 550eb9009e..f40775872e 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-delete.rb @@ -1,17 +1,17 @@ -cask 'with-uninstall-delete' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-delete" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" uninstall delete: [ - "#{TEST_TMPDIR}/absolute_path", - '~/path_with_tilde', - "#{TEST_TMPDIR}/glob_path*", - 'impermissible/relative/path', - '/another/impermissible/../relative/path', - ] + "#{TEST_TMPDIR}/absolute_path", + "~/path_with_tilde", + "#{TEST_TMPDIR}/glob_path*", + "impermissible/relative/path", + "/another/impermissible/../relative/path", + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb index 07759f6f40..8795d86c69 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-early-script.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-early-script' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-early-script" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: ['--please'] } + uninstall early_script: { executable: "MyFancyPkg/FancyUninstaller.tool", args: ["--please"] } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb index f3646cae00..ea2a12cb29 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-kext.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-kext' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-kext" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" - uninstall kext: 'my.fancy.package.kernelextension' + uninstall kext: "my.fancy.package.kernelextension" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb index 739655ae61..f30cfb4ac4 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-launchctl.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-launchctl' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-launchctl" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/fancy' + homepage "https://brew.sh/fancy" - app 'Fancy.app' + app "Fancy.app" - uninstall launchctl: 'my.fancy.package.service' + uninstall launchctl: "my.fancy.package.service" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb index e297a209fc..14c52cab6d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-login-item.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-login-item' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-login-item" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall login_item: 'Fancy' + uninstall login_item: "Fancy" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb index f1e40b36a9..e7b34bed96 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-multi.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path" uninstall delete: "#{TEST_TMPDIR}/empty_directory_path" diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb index f83bf30eac..85565cbd8d 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-pkgutil.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-pkgutil' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-pkgutil" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" - uninstall pkgutil: 'my.fancy.package.*' + uninstall pkgutil: "my.fancy.package.*" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb index 0c92463ad2..52e5e6420b 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight-multi.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-postflight-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-postflight-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall_postflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb index d9d4ac11cb..c400a7edd1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-postflight.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-postflight' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-postflight" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall_postflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb index 4d7aeae65a..d743984fde 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight-multi.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-preflight-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-preflight-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall_preflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb index 7174a2f340..b4d73a0e6c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-preflight.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-preflight' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-preflight" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall_preflight do end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb index e479f6ba43..bb19722e61 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-quit.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-quit' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-quit" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall quit: 'my.fancy.package.app' + uninstall quit: "my.fancy.package.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb index 58f04db79a..b7135a6fe5 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-rmdir.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-rmdir' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-rmdir" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb index 8428462b59..1b768b25da 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script-app.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-script-app' do - version '1.2.3' - sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d' +cask "with-uninstall-script-app" do + version "1.2.3" + sha256 "5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/MyFancyApp' + homepage "https://brew.sh/MyFancyApp" - app 'MyFancyApp/MyFancyApp.app' + app "MyFancyApp/MyFancyApp.app" postflight do IO.write "#{appdir}/MyFancyApp.app/uninstall.sh", <<~SH @@ -15,7 +15,7 @@ cask 'with-uninstall-script-app' do end uninstall script: { - executable: "#{appdir}/MyFancyApp.app/uninstall.sh", - sudo: false, - } + executable: "#{appdir}/MyFancyApp.app/uninstall.sh", + sudo: false, + } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb index c72493defb..f9463bd82c 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-script.rb @@ -1,11 +1,11 @@ -cask 'with-uninstall-script' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-script" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: ['--please'] } + uninstall script: { executable: "MyFancyPkg/FancyUninstaller.tool", args: ["--please"] } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb index 9e897d5596..fabb158e70 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-signal.rb @@ -1,14 +1,14 @@ -cask 'with-uninstall-signal' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-signal" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" uninstall signal: [ - ['TERM', 'my.fancy.package.app'], - ['KILL', 'my.fancy.package.app'], - ] + ["TERM", "my.fancy.package.app"], + ["KILL", "my.fancy.package.app"], + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb index 836fe4c23a..4f3fac0313 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-uninstall-trash.rb @@ -1,17 +1,17 @@ -cask 'with-uninstall-trash' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-uninstall-trash" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" uninstall trash: [ - "#{TEST_TMPDIR}/absolute_path", - '~/path_with_tilde', - "#{TEST_TMPDIR}/glob_path*", - 'impermissible/relative/path', - '/another/impermissible/../relative/path', - ] + "#{TEST_TMPDIR}/absolute_path", + "~/path_with_tilde", + "#{TEST_TMPDIR}/glob_path*", + "impermissible/relative/path", + "/another/impermissible/../relative/path", + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb index 3f3278222f..706ca7a2f1 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-delete.rb @@ -1,17 +1,17 @@ -cask 'with-zap-delete' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-delete" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" zap delete: [ - "#{TEST_TMPDIR}/absolute_path", - '~/path_with_tilde', - "#{TEST_TMPDIR}/glob_path*", - 'impermissible/relative/path', - '/another/impermissible/../relative/path', - ] + "#{TEST_TMPDIR}/absolute_path", + "~/path_with_tilde", + "#{TEST_TMPDIR}/glob_path*", + "impermissible/relative/path", + "/another/impermissible/../relative/path", + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb index e6fe3e8417..b49500faee 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-early-script.rb @@ -1,11 +1,11 @@ -cask 'with-zap-early-script' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-early-script" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - zap early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: ['--please'] } + zap early_script: { executable: "MyFancyPkg/FancyUninstaller.tool", args: ["--please"] } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb index d1cdbdd0a5..ba90728b3a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-kext.rb @@ -1,11 +1,11 @@ -cask 'with-zap-kext' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-kext" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" - zap kext: 'my.fancy.package.kernelextension' + zap kext: "my.fancy.package.kernelextension" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb index 83799a73dc..44a792bb0a 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-launchctl.rb @@ -1,11 +1,11 @@ -cask 'with-zap-launchctl' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-launchctl" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyApp.zip" - homepage 'https://brew.sh/fancy' + homepage "https://brew.sh/fancy" - app 'Fancy.app' + app "Fancy.app" - zap launchctl: 'my.fancy.package.service' + zap launchctl: "my.fancy.package.service" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb index 70d5e385b9..7e6678af80 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-login-item.rb @@ -1,11 +1,11 @@ -cask 'with-zap-login-item' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-login-item" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - zap login_item: 'Fancy' + zap login_item: "Fancy" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb index d6c1acda0d..68fe837d45 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-multi.rb @@ -1,11 +1,11 @@ -cask 'with-zap-multi' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-multi" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" zap rmdir: "#{TEST_TMPDIR}/empty_directory_path" zap delete: "#{TEST_TMPDIR}/empty_directory_path" diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb index 29d90e8e81..cf89e2c943 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-pkgutil.rb @@ -1,11 +1,11 @@ -cask 'with-zap-pkgutil' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-pkgutil" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" - zap pkgutil: 'my.fancy.package.*' + zap pkgutil: "my.fancy.package.*" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb index 8286fe3a3f..1d7ac6b8d8 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-quit.rb @@ -1,11 +1,11 @@ -cask 'with-zap-quit' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-quit" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - zap quit: 'my.fancy.package.app' + zap quit: "my.fancy.package.app" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb index 70e18cbb09..0c7a72cecc 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-rmdir.rb @@ -1,11 +1,11 @@ -cask 'with-zap-rmdir' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-rmdir" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" zap rmdir: "#{TEST_TMPDIR}/empty_directory_path" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb index 44d499dc1b..de0b55e9de 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-script.rb @@ -1,11 +1,11 @@ -cask 'with-zap-script' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-script" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - zap script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: ['--please'] } + zap script: { executable: "MyFancyPkg/FancyUninstaller.tool", args: ["--please"] } end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb index 4d6f4dd6d6..86aa943f39 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-signal.rb @@ -1,14 +1,14 @@ -cask 'with-zap-signal' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-signal" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" zap signal: [ - ['TERM', 'my.fancy.package.app'], - ['KILL', 'my.fancy.package.app'], - ] + ["TERM", "my.fancy.package.app"], + ["KILL", "my.fancy.package.app"], + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb index 7a55d061af..11651a4f2f 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap-trash.rb @@ -1,17 +1,17 @@ -cask 'with-zap-trash' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap-trash" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'Fancy.pkg' + pkg "Fancy.pkg" zap trash: [ - "#{TEST_TMPDIR}/absolute_path", - '~/path_with_tilde', - "#{TEST_TMPDIR}/glob_path*", - 'impermissible/relative/path', - '/another/impermissible/../relative/path', - ] + "#{TEST_TMPDIR}/absolute_path", + "~/path_with_tilde", + "#{TEST_TMPDIR}/glob_path*", + "impermissible/relative/path", + "/another/impermissible/../relative/path", + ] end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb index 8fb9ee9227..ab0bd7b2f8 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-zap.rb @@ -1,19 +1,19 @@ -cask 'with-zap' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "with-zap" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" - homepage 'https://brew.sh/fancy-pkg' + homepage "https://brew.sh/fancy-pkg" - pkg 'MyFancyPkg/Fancy.pkg' + pkg "MyFancyPkg/Fancy.pkg" - uninstall quit: 'my.fancy.package.app.from.uninstall' + uninstall quit: "my.fancy.package.app.from.uninstall" zap script: { - executable: 'MyFancyPkg/FancyUninstaller.tool', - args: ['--please'], - }, - quit: 'my.fancy.package.app', - login_item: 'Fancy', - delete: '~/Library/Preferences/my.fancy.app.plist' + executable: "MyFancyPkg/FancyUninstaller.tool", + args: ["--please"], + }, + quit: "my.fancy.package.app", + login_item: "Fancy", + delete: "~/Library/Preferences/my.fancy.app.plist" end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb index b6a1426c9b..6d3ae3a0e3 100644 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/without-languages.rb @@ -1,9 +1,9 @@ -cask 'without-languages' do - version '1.2.3' - sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' +cask "without-languages" do + version "1.2.3" + sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage 'https://brew.sh/' + homepage "https://brew.sh/" - app 'Caffeine.app' + app "Caffeine.app" end diff --git a/Library/Homebrew/test/support/fixtures/failball.rb b/Library/Homebrew/test/support/fixtures/failball.rb index 439645df26..5ba1692eff 100644 --- a/Library/Homebrew/test/support/fixtures/failball.rb +++ b/Library/Homebrew/test/support/fixtures/failball.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true class Failball < Formula - def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) + def initialize(name = "failball", path = Pathname.new(__FILE__).expand_path, spec = :stable, + alias_path: nil, force_bottle: false) self.class.instance_eval do stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 diff --git a/Library/Homebrew/test/support/fixtures/testball.rb b/Library/Homebrew/test/support/fixtures/testball.rb index c2d4aa2bbc..27ff8dafc0 100644 --- a/Library/Homebrew/test/support/fixtures/testball.rb +++ b/Library/Homebrew/test/support/fixtures/testball.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true class Testball < Formula - def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) + def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, + alias_path: nil, force_bottle: false) self.class.instance_eval do stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 diff --git a/Library/Homebrew/test/support/fixtures/testball_bottle.rb b/Library/Homebrew/test/support/fixtures/testball_bottle.rb index f6268ed4fc..76d8d7e7c0 100644 --- a/Library/Homebrew/test/support/fixtures/testball_bottle.rb +++ b/Library/Homebrew/test/support/fixtures/testball_bottle.rb @@ -1,14 +1,15 @@ # frozen_string_literal: true class TestballBottle < Formula - def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) + def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, + alias_path: nil, force_bottle: false) self.class.instance_eval do stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 stable.bottle do cellar :any_skip_relocation root_url "file://#{TEST_FIXTURE_DIR}/bottles" - sha256 "d48bbbe583dcfbfa608579724fc6f0328b3cd316935c6ea22f134610aaf2952f" => Utils::Bottles.tag + sha256 "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149" => Utils::Bottles.tag end cxxstdlib_check :skip end diff --git a/Library/Homebrew/test/support/fixtures/third-party/Casks/pharo.rb b/Library/Homebrew/test/support/fixtures/third-party/Casks/pharo.rb index 8918c6565f..e6b6fef803 100644 --- a/Library/Homebrew/test/support/fixtures/third-party/Casks/pharo.rb +++ b/Library/Homebrew/test/support/fixtures/third-party/Casks/pharo.rb @@ -1,10 +1,10 @@ -cask 'pharo' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "pharo" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/ThirdParty.dmg' - name 'Pharo' - homepage 'https://brew.sh/' + url "https://brew.sh/ThirdParty.dmg" + name "Pharo" + homepage "https://brew.sh/" - app 'ThirdParty.app' + app "ThirdParty.app" end diff --git a/Library/Homebrew/test/support/fixtures/third-party/Casks/third-party-cask.rb b/Library/Homebrew/test/support/fixtures/third-party/Casks/third-party-cask.rb index efe803bd8b..2979305a29 100644 --- a/Library/Homebrew/test/support/fixtures/third-party/Casks/third-party-cask.rb +++ b/Library/Homebrew/test/support/fixtures/third-party/Casks/third-party-cask.rb @@ -1,9 +1,9 @@ -cask 'third-party-cask' do - version '1.2.3' - sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' +cask "third-party-cask" do + version "1.2.3" + sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - url 'https://brew.sh/ThirdParty.dmg' - homepage 'https://brew.sh/' + url "https://brew.sh/ThirdParty.dmg" + homepage "https://brew.sh/" - app 'ThirdParty.app' + app "ThirdParty.app" end diff --git a/Library/Homebrew/test/x11_requirement_spec.rb b/Library/Homebrew/test/x11_requirement_spec.rb index 133135eb0b..436e0c15ef 100644 --- a/Library/Homebrew/test/x11_requirement_spec.rb +++ b/Library/Homebrew/test/x11_requirement_spec.rb @@ -6,8 +6,6 @@ require "requirements/x11_requirement" describe X11Requirement do let(:default_name) { "x11" } - let(:args) { Homebrew::CLI::Args.new } - describe "#name" do it "defaults to x11" do expect(subject.name).to eq(default_name) @@ -25,7 +23,7 @@ describe X11Requirement do it "calls ENV#x11" do allow(subject).to receive(:satisfied?).and_return(true) expect(ENV).to receive(:x11) - subject.modify_build_environment(args: args) + subject.modify_build_environment end end @@ -33,12 +31,12 @@ describe X11Requirement do it "returns true if X11 is installed" do expect(MacOS::XQuartz).to receive(:version).and_return("2.7.5") expect(MacOS::XQuartz).to receive(:installed?).and_return(true) - expect(subject).to be_satisfied(args: args) + expect(subject).to be_satisfied end it "returns false if X11 is not installed" do expect(MacOS::XQuartz).to receive(:installed?).and_return(false) - expect(subject).not_to be_satisfied(args: args) + expect(subject).not_to be_satisfied end end end diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 2e4ccb8d58..d447331884 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -26,7 +26,7 @@ module Homebrew end formulae_to_install.each do |f| - Migrator.migrate_if_needed(f) + Migrator.migrate_if_needed(f, force: args.force?) begin upgrade_formula(f, args: args) Cleanup.install_formula_clean!(f) @@ -63,8 +63,9 @@ module Homebrew options |= f.build.used_options options &= f.options - fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, - build_from_source: args.build_from_source?) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, + include_test_formulae: args.include_test_formulae, + build_from_source_formulae: args.build_from_source_formulae) fi.options = options fi.force = args.force? fi.keep_tmp = args.keep_tmp? diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index cb944b5a73..e28265867e 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -127,8 +127,6 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false, return "The URL #{url} is not reachable" end - return "#{url} permanently redirects to #{details[:permanent_redirect]}" if url != details[:permanent_redirect] - unless http_status_ok?(details[:status]) return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" end @@ -205,23 +203,20 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent: status_code = headers[%r{HTTP/.* (\d+)}, 1] location = headers[/^Location:\s*(.*)$/i, 1] final_url = location.chomp if location - permanent_redirect = location.chomp if status_code == "301" end output_hash = Digest::SHA256.file(file.path) if hash_needed final_url ||= url - permanent_redirect ||= url { - url: url, - final_url: final_url, - permanent_redirect: permanent_redirect, - status: status_code, - etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2], - content_length: headers[/Content-Length: (\d+)/, 1], - file_hash: output_hash, - file: output, + url: url, + final_url: final_url, + status: status_code, + etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2], + content_length: headers[/Content-Length: (\d+)/, 1], + file_hash: output_hash, + file: output, } ensure file.unlink diff --git a/Library/Homebrew/utils/pypi.rb b/Library/Homebrew/utils/pypi.rb new file mode 100644 index 0000000000..4393d8d217 --- /dev/null +++ b/Library/Homebrew/utils/pypi.rb @@ -0,0 +1,138 @@ +# frozen_string_literal: true + +module PyPI + module_function + + PYTHONHOSTED_URL_PREFIX = "https://files.pythonhosted.org/packages/" + + @pipgrip_installed = nil + + def url_to_pypi_package_name(url) + return unless url.start_with? PYTHONHOSTED_URL_PREFIX + + File.basename(url).match(/^(.+)-[a-z\d.]+$/)[1] + end + + def update_pypi_url(url, version) + package = url_to_pypi_package_name url + return if package.nil? + + _, url = get_pypi_info(package, version) + url + end + + # Get name, url and sha256 for a given pypi package + def get_pypi_info(package, version) + metadata_url = "https://pypi.org/pypi/#{package}/#{version}/json" + out, _, status = curl_output metadata_url, "--location" + + return unless status.success? + + begin + json = JSON.parse out + rescue JSON::ParserError + return + end + + sdist = json["urls"].find { |url| url["packagetype"] == "sdist" } + return json["info"]["name"] if sdist.nil? + + [json["info"]["name"], sdist["url"], sdist["digests"]["sha256"]] + end + + def update_python_resources!(formula, version = nil, print_only: false, silent: false, + ignore_non_pypi_packages: false) + + # PyPI package name isn't always the same as the formula name. Try to infer from the URL. + pypi_name = if formula.stable.url.start_with?(PYTHONHOSTED_URL_PREFIX) + url_to_pypi_package_name formula.stable.url + else + formula.name + end + + version ||= formula.version + + if get_pypi_info(pypi_name, version).blank? + odie "\"#{pypi_name}\" at version #{version} is not available on PyPI." unless ignore_non_pypi_packages + return + end + + non_pypi_resources = formula.resources.reject do |resource| + resource.url.start_with? PYTHONHOSTED_URL_PREFIX + end + + if non_pypi_resources.present? && !print_only + odie "\"#{formula.name}\" contains non-PyPI resources. Please update the resources manually." + end + + @pipgrip_installed ||= Formula["pipgrip"].any_version_installed? + odie '"pipgrip" must be installed (`brew install pipgrip`)' unless @pipgrip_installed + + ohai "Retrieving PyPI dependencies for \"#{pypi_name}==#{version}\"" if !print_only && !silent + pipgrip_output = Utils.popen_read Formula["pipgrip"].bin/"pipgrip", "--json", "--no-cache-dir", + "#{pypi_name}==#{version}" + unless $CHILD_STATUS.success? + odie <<~EOS + Unable to determine dependencies for \"#{pypi_name}\" because of a failure when running + `pipgrip --json --no-cache-dir #{pypi_name}==#{version}`. + Please update the resources for \"#{formula.name}\" manually. + EOS + end + + packages = JSON.parse(pipgrip_output).sort.to_h + + # Remove extra packages that may be included in pipgrip output + exclude_list = %W[#{pypi_name} argparse pip setuptools wheel wsgiref] + packages.delete_if do |package| + exclude_list.include? package + end + + new_resource_blocks = "" + packages.each do |package, package_version| + name, url, checksum = get_pypi_info package, package_version + # Fail if unable to find name, url or checksum for any resource + if name.blank? + odie "Unable to resolve some dependencies. Please update the resources for \"#{formula.name}\" manually." + elsif url.blank? || checksum.blank? + odie <<~EOS + Unable to find the URL and/or sha256 for the \"#{name}\" resource. + Please update the resources for \"#{formula.name}\" manually. + EOS + end + + # Append indented resource block + new_resource_blocks += <<-EOS + resource "#{name}" do + url "#{url}" + sha256 "#{checksum}" + end + + EOS + end + + if print_only + puts new_resource_blocks.chomp + return + end + + # Check whether resources already exist (excluding homebrew-virtualenv) + if formula.resources.blank? || + (formula.resources.length == 1 && formula.resources.first.name == "homebrew-virtualenv") + # Place resources above install method + inreplace_regex = / def install/ + new_resource_blocks += " def install" + else + # Replace existing resource blocks with new resource blocks + inreplace_regex = / (resource .* do\s+url .*\s+sha256 .*\s+ end\s*)+/ + new_resource_blocks += " " + end + + ohai "Updating resource blocks" unless silent + Utils::Inreplace.inreplace formula.path do |s| + if s.inreplace_string.scan(inreplace_regex).length > 1 + odie "Unable to update resource blocks for \"#{formula.name}\" automatically. Please update them manually." + end + s.sub! inreplace_regex, new_resource_blocks + end + end +end diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 275c99f6e9..3a385f0868 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -57,7 +57,7 @@ class Version NULL_TOKEN = NullToken.new.freeze class StringToken < Token - PATTERN = /[a-z]+[0-9]*/i.freeze + PATTERN = /[a-z]+/i.freeze def initialize(value) @value = value.to_s diff --git a/completions/internal_commands_list.txt b/completions/internal_commands_list.txt index efdf978359..fe29d6ec39 100644 --- a/completions/internal_commands_list.txt +++ b/completions/internal_commands_list.txt @@ -89,6 +89,7 @@ untap up update update-license-data +update-python-resources update-report update-reset update-test diff --git a/docs/Manpage.md b/docs/Manpage.md index f1f6ae2f8a..dbcf6fa4e7 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -312,8 +312,10 @@ no formula is provided. Also print diffstat from commit. * `--oneline`: Print only one line per commit. -* `-1`, `--max-count`: - Print only one or a specified number of commits. +* `-1`: + Print only one commit. +* `-n`, `--max-count`: + Print only a specified number of commits. ### `migrate` [*`options`*] *`formula`* @@ -356,9 +358,15 @@ otherwise. * `-v`, `--verbose`: Include detailed version information. * `--json`: - Print output in JSON format. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: + Print output in JSON format. There are two versions: v1 and v2. v1 is deprecated and is currently the default if no version is specified. v2 prints outdated formulae and casks. * `--fetch-HEAD`: Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will only be checked for updates when a new stable or development version has been released. +* `--greedy`: + Print outdated casks with `auto_updates` or `version :latest`. +* `--formula`: + Treat all arguments as formulae. +* `--cask`: + Treat all arguments as casks. ### `pin` *`formula`* @@ -379,7 +387,7 @@ items or checking if any current formulae/casks have Ruby issues. * `--aliases`: Verify any alias symlinks in each tap. * `--syntax`: - Syntax-check all of Homebrew's Ruby files. + Syntax-check all of Homebrew's Ruby files (if no `*`tap`*` is passed). ### `reinstall` [*`options`*] *`formula`* @@ -511,12 +519,16 @@ also `pin`. Remove a tapped formula repository. -### `update`, `up` [*`options`*] +### `update` [*`options`*] Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations. * `--merge`: Use `git merge` to apply updates (rather than `git rebase`). +* `--preinstall`: + Run on auto-updates (e.g. before `brew install`). Skips some slower steps. +* `-f`, `--force`: + Always do a slower, full update check (even if unnecessary). ### `update-reset` [*`repository`*] @@ -556,6 +568,8 @@ the upgraded formulae or, every 30 days, for all formulae. Print install times for each formula at the end of the run. * `-n`, `--dry-run`: Show what would be upgraded, but do not actually upgrade anything. +* `--greedy`: + Upgrade casks with `auto_updates` or `version :latest` ### `uses` [*`options`*] *`formula`* @@ -755,6 +769,8 @@ uses. Specify the new git commit *`tag`* for the formula. * `--revision`: Specify the new git commit *`revision`* corresponding to the specified *`tag`*. +* `-f`, `--force`: + Ignore duplicate open PRs. Remove all mirrors if --mirror= was not specified. ### `bump-revision` [*`options`*] *`formula`* @@ -813,6 +829,8 @@ a simple example. For the complete API, see: Explicitly set the *`license`* of the new formula. * `--tap`: Generate the new formula within the given tap, specified as *`user`*`/`*`repo`*. +* `-f`, `--force`: + Ignore errors for disallowed formula names and named that shadow aliases. ### `diy` [*`options`*] @@ -840,6 +858,8 @@ formula from a tap that is not `homebrew/core` use its fully-qualified form of * `--version`: Extract the specified *`version`* of *`formula`* instead of the most recent. +* `-f`, `--force`: + Overwrite the destination formula if it already exists. ### `formula` *`formula`* @@ -899,7 +919,12 @@ Find pull requests that can be automatically merged using `brew pr-publish`. ### `pr-publish` [*`options`*] *`pull_request`* [*`pull_request`* ...] Publish bottles for a pull request with GitHub Actions. Requires write access to -the `homebrew/core` repository. +the repository. + +* `--tap`: + Target tap repository (default: `homebrew/core`). +* `--workflow`: + Target workflow filename (default: `publish-commit-bottles.yml`). ### `pr-pull` [*`options`*] *`pull_request`* [*`pull_request`* ...] @@ -1025,6 +1050,8 @@ wrong with the installed formula. Test the head version of a formula. * `--keep-tmp`: Retain the temporary files created for the test. +* `--retry`: + Retry if a testing fails. ### `tests` [*`options`*] @@ -1056,6 +1083,8 @@ directory. Patches for *`formula`* will be applied to the unpacked source. * `-g`, `--git`: Initialise a Git repository in the unpacked source. This is useful for creating patches for the software. +* `-f`, `--force`: + Overwrite the destination directory if it already exists. ### `update-license-data` [*`options`*] @@ -1066,6 +1095,19 @@ directory. * `--commit`: Commit changes to the SPDX license data. +### `update-python-resources` [*`options`*] *`formula`* + +Update versions for PyPI resource blocks in *`formula`*. + +* `-p`, `--print-only`: + Print the updated resource blocks instead of changing *`formula`*. +* `-s`, `--silent`: + Suppress any output. +* `--ignore-non-pypi-packages`: + Don't fail if *`formula`* is not a PyPI package. +* `--version`: + Use the specified *`version`* when finding resources for *`formula`*. If no version is specified, the current version for *`formula`* will be used. + ### `update-test` [*`options`*] Run a test of `brew update` with a new repository clone. If no options are @@ -1097,9 +1139,6 @@ These options are applicable across multiple subcommands. * `-d`, `--debug`: Display any debugging information. -* `-f`, `--force`: - Override warnings and enable potentially unsafe operations. - ## OFFICIAL EXTERNAL COMMANDS ### `cask` *`subcommand`* diff --git a/docs/README.md b/docs/README.md index 8e68784ef0..7d81c0ba77 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,6 +3,7 @@ ## Users - [`brew` man-page (command documentation)](Manpage.md) +- [Homebrew Blog (news on major updates)](https://brew.sh/blog/) - [Troubleshooting](Troubleshooting.md) - [Installation](Installation.md) - [Frequently Asked Questions](FAQ.md) diff --git a/manpages/brew.1 b/manpages/brew.1 index 6a93973012..cb97a2266f 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -428,8 +428,12 @@ Also print diffstat from commit\. Print only one line per commit\. . .TP -\fB\-1\fR, \fB\-\-max\-count\fR -Print only one or a specified number of commits\. +\fB\-1\fR +Print only one commit\. +. +.TP +\fB\-n\fR, \fB\-\-max\-count\fR +Print only a specified number of commits\. . .SS "\fBmigrate\fR [\fIoptions\fR] \fIformula\fR" Migrate renamed packages to new names, where \fIformula\fR are old names of packages\. @@ -477,12 +481,24 @@ Include detailed version information\. . .TP \fB\-\-json\fR -Print output in JSON format\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR +Print output in JSON format\. There are two versions: v1 and v2\. v1 is deprecated and is currently the default if no version is specified\. v2 prints outdated formulae and casks\. . .TP \fB\-\-fetch\-HEAD\fR Fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will only be checked for updates when a new stable or development version has been released\. . +.TP +\fB\-\-greedy\fR +Print outdated casks with \fBauto_updates\fR or \fBversion :latest\fR\. +. +.TP +\fB\-\-formula\fR +Treat all arguments as formulae\. +. +.TP +\fB\-\-cask\fR +Treat all arguments as casks\. +. .SS "\fBpin\fR \fIformula\fR" Pin the specified \fIformula\fR, preventing them from being upgraded when issuing the \fBbrew upgrade\fR \fIformula\fR command\. See also \fBunpin\fR\. . @@ -498,7 +514,7 @@ Verify any alias symlinks in each tap\. . .TP \fB\-\-syntax\fR -Syntax\-check all of Homebrew\'s Ruby files\. +Syntax\-check all of Homebrew\'s Ruby files (if no \fB\fR is passed)\. . .SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR" Uninstall and then install \fIformula\fR using the same options it was originally installed with, plus any appended brew formula options\. @@ -659,13 +675,21 @@ Unpin \fIformula\fR, allowing them to be upgraded by \fBbrew upgrade\fR \fIformu .SS "\fBuntap\fR \fItap\fR" Remove a tapped formula repository\. . -.SS "\fBupdate\fR, \fBup\fR [\fIoptions\fR]" +.SS "\fBupdate\fR [\fIoptions\fR]" Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\fR(1) and perform any necessary migrations\. . .TP \fB\-\-merge\fR Use \fBgit merge\fR to apply updates (rather than \fBgit rebase\fR)\. . +.TP +\fB\-\-preinstall\fR +Run on auto\-updates (e\.g\. before \fBbrew install\fR)\. Skips some slower steps\. +. +.TP +\fB\-f\fR, \fB\-\-force\fR +Always do a slower, full update check (even if unnecessary)\. +. .SS "\fBupdate\-reset\fR [\fIrepository\fR]" Fetch and reset Homebrew and all tap repositories (or any specified \fIrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. . @@ -722,6 +746,10 @@ Print install times for each formula at the end of the run\. \fB\-n\fR, \fB\-\-dry\-run\fR Show what would be upgraded, but do not actually upgrade anything\. . +.TP +\fB\-\-greedy\fR +Upgrade casks with \fBauto_updates\fR or \fBversion :latest\fR +. .SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR" Show formulae that specify \fIformula\fR as a dependency (i\.e\. show dependents of \fIformula\fR)\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency for their stable builds\. . @@ -988,6 +1016,10 @@ Specify the new git commit \fItag\fR for the formula\. \fB\-\-revision\fR Specify the new git commit \fIrevision\fR corresponding to the specified \fItag\fR\. . +.TP +\fB\-f\fR, \fB\-\-force\fR +Ignore duplicate open PRs\. Remove all mirrors if \-\-mirror= was not specified\. +. .SS "\fBbump\-revision\fR [\fIoptions\fR] \fIformula\fR" Create a commit to increment the revision of \fIformula\fR\. If no revision is present, "revision 1" will be added\. . @@ -1072,6 +1104,10 @@ Explicitly set the \fIlicense\fR of the new formula\. \fB\-\-tap\fR Generate the new formula within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\. . +.TP +\fB\-f\fR, \fB\-\-force\fR +Ignore errors for disallowed formula names and named that shadow aliases\. +. .SS "\fBdiy\fR [\fIoptions\fR]" Automatically determine the installation prefix for non\-Homebrew software\. Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\. . @@ -1093,6 +1129,10 @@ Look through repository history to find the most recent version of \fIformula\fR \fB\-\-version\fR Extract the specified \fIversion\fR of \fIformula\fR instead of the most recent\. . +.TP +\fB\-f\fR, \fB\-\-force\fR +Overwrite the destination formula if it already exists\. +. .SS "\fBformula\fR \fIformula\fR" Display the path where \fIformula\fR is located\. . @@ -1164,7 +1204,15 @@ Run \fBbrew pr\-publish\fR on matching pull requests\. Include pull requests that have failing status checks\. . .SS "\fBpr\-publish\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]" -Publish bottles for a pull request with GitHub Actions\. Requires write access to the \fBhomebrew/core\fR repository\. +Publish bottles for a pull request with GitHub Actions\. Requires write access to the repository\. +. +.TP +\fB\-\-tap\fR +Target tap repository (default: \fBhomebrew/core\fR)\. +. +.TP +\fB\-\-workflow\fR +Target workflow filename (default: \fBpublish\-commit\-bottles\.yml\fR)\. . .SS "\fBpr\-pull\fR [\fIoptions\fR] \fIpull_request\fR [\fIpull_request\fR \.\.\.]" Download and publish bottles, and apply the bottle commit from a pull request with artifacts generated by GitHub Actions\. Requires write access to the repository\. @@ -1322,6 +1370,10 @@ Test the head version of a formula\. \fB\-\-keep\-tmp\fR Retain the temporary files created for the test\. . +.TP +\fB\-\-retry\fR +Retry if a testing fails\. +. .SS "\fBtests\fR [\fIoptions\fR]" Run Homebrew\'s unit and integration tests\. . @@ -1368,6 +1420,10 @@ Patches for \fIformula\fR will be applied to the unpacked source\. \fB\-g\fR, \fB\-\-git\fR Initialise a Git repository in the unpacked source\. This is useful for creating patches for the software\. . +.TP +\fB\-f\fR, \fB\-\-force\fR +Overwrite the destination directory if it already exists\. +. .SS "\fBupdate\-license\-data\fR [\fIoptions\fR]" Update SPDX license data in the Homebrew repository\. . @@ -1379,6 +1435,25 @@ Return a failing status code if current license data\'s version is the same as t \fB\-\-commit\fR Commit changes to the SPDX license data\. . +.SS "\fBupdate\-python\-resources\fR [\fIoptions\fR] \fIformula\fR" +Update versions for PyPI resource blocks in \fIformula\fR\. +. +.TP +\fB\-p\fR, \fB\-\-print\-only\fR +Print the updated resource blocks instead of changing \fIformula\fR\. +. +.TP +\fB\-s\fR, \fB\-\-silent\fR +Suppress any output\. +. +.TP +\fB\-\-ignore\-non\-pypi\-packages\fR +Don\'t fail if \fIformula\fR is not a PyPI package\. +. +.TP +\fB\-\-version\fR +Use the specified \fIversion\fR when finding resources for \fIformula\fR\. If no version is specified, the current version for \fIformula\fR will be used\. +. .SS "\fBupdate\-test\fR [\fIoptions\fR]" Run a test of \fBbrew update\fR with a new repository clone\. If no options are passed, use \fBorigin/master\fR as the start commit\. . @@ -1416,10 +1491,6 @@ Make some output more verbose\. \fB\-d\fR, \fB\-\-debug\fR Display any debugging information\. . -.TP -\fB\-f\fR, \fB\-\-force\fR -Override warnings and enable potentially unsafe operations\. -. .SH "OFFICIAL EXTERNAL COMMANDS" . .SS "\fBcask\fR \fIsubcommand\fR"