From d6957a3acb9b524d84c377028867aea2d7d1f0af Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 25 Jan 2021 09:18:10 +0000 Subject: [PATCH] Homebrew 3.0.0 deprecations/disables --- Library/Homebrew/brew.rb | 4 +- Library/Homebrew/cask/cmd.rb | 224 +----------------- Library/Homebrew/cask/cmd/--cache.rb | 41 ---- Library/Homebrew/cask/cmd/abstract_command.rb | 42 +--- .../cask/cmd/abstract_internal_command.rb | 23 -- Library/Homebrew/cask/cmd/audit.rb | 12 +- Library/Homebrew/cask/cmd/cat.rb | 35 --- Library/Homebrew/cask/cmd/create.rb | 64 ----- Library/Homebrew/cask/cmd/doctor.rb | 42 ---- Library/Homebrew/cask/cmd/edit.rb | 54 ----- Library/Homebrew/cask/cmd/fetch.rb | 12 +- Library/Homebrew/cask/cmd/help.rb | 42 ---- Library/Homebrew/cask/cmd/home.rb | 35 --- Library/Homebrew/cask/cmd/info.rb | 12 +- Library/Homebrew/cask/cmd/install.rb | 12 +- Library/Homebrew/cask/cmd/internal_help.rb | 35 --- Library/Homebrew/cask/cmd/internal_stanza.rb | 127 ---------- Library/Homebrew/cask/cmd/list.rb | 7 +- Library/Homebrew/cask/cmd/outdated.rb | 40 ---- Library/Homebrew/cask/cmd/reinstall.rb | 7 +- Library/Homebrew/cask/cmd/style.rb | 49 ---- Library/Homebrew/cask/cmd/uninstall.rb | 12 +- Library/Homebrew/cask/cmd/upgrade.rb | 7 +- Library/Homebrew/cask/cmd/zap.rb | 16 +- Library/Homebrew/cask/dsl/depends_on.rb | 4 +- Library/Homebrew/cli/parser.rb | 15 +- Library/Homebrew/cmd/cask.rb | 17 -- Library/Homebrew/cmd/commands.rb | 2 - Library/Homebrew/cmd/install.rb | 4 +- Library/Homebrew/cmd/list.rb | 8 +- Library/Homebrew/cmd/outdated.rb | 4 +- Library/Homebrew/cmd/search.rb | 4 +- Library/Homebrew/cmd/switch.rb | 30 --- Library/Homebrew/commands.rb | 42 +--- Library/Homebrew/dependency_collector.rb | 5 - Library/Homebrew/dev-cmd/diy.rb | 35 --- Library/Homebrew/dev-cmd/man.rb | 2 +- Library/Homebrew/dev-cmd/pr-pull.rb | 11 +- Library/Homebrew/dev-cmd/release-notes.rb | 5 +- Library/Homebrew/extend/ENV/shared.rb | 9 +- Library/Homebrew/extend/ENV/std.rb | 12 +- Library/Homebrew/extend/ENV/super.rb | 12 +- .../extend/os/dependency_collector.rb | 6 +- Library/Homebrew/extend/os/language/java.rb | 4 - .../extend/os/linux/dependency_collector.rb | 17 -- .../os/linux/requirements/java_requirement.rb | 17 -- .../linux/requirements/osxfuse_requirement.rb | 2 +- .../Homebrew/extend/os/mac/language/java.rb | 30 --- .../os/mac/requirements/java_requirement.rb | 36 --- .../mac/requirements/osxfuse_requirement.rb | 2 +- .../Homebrew/extend/os/mac/system_config.rb | 12 +- .../os/requirements/java_requirement.rb | 8 - Library/Homebrew/language/java.rb | 10 +- Library/Homebrew/requirements.rb | 1 - .../Homebrew/requirements/java_requirement.rb | 169 ------------- .../requirements/tuntap_requirement.rb | 2 +- .../Homebrew/requirements/x11_requirement.rb | 2 +- Library/Homebrew/rubocops/lines.rb | 19 +- Library/Homebrew/software_spec.rb | 2 +- Library/Homebrew/test/.rubocop_todo.yml | 1 - Library/Homebrew/test/cask/cmd/audit_spec.rb | 3 - Library/Homebrew/test/cask/cmd/cache_spec.rb | 34 --- Library/Homebrew/test/cask/cmd/cat_spec.rb | 58 ----- Library/Homebrew/test/cask/cmd/create_spec.rb | 64 ----- Library/Homebrew/test/cask/cmd/doctor_spec.rb | 20 -- Library/Homebrew/test/cask/cmd/edit_spec.rb | 32 --- Library/Homebrew/test/cask/cmd/fetch_spec.rb | 6 - Library/Homebrew/test/cask/cmd/home_spec.rb | 12 - Library/Homebrew/test/cask/cmd/info_spec.rb | 5 - .../Homebrew/test/cask/cmd/install_spec.rb | 6 - .../test/cask/cmd/internal_stanza_spec.rb | 45 ---- Library/Homebrew/test/cask/cmd/list_spec.rb | 4 - .../Homebrew/test/cask/cmd/outdated_spec.rb | 197 --------------- .../Homebrew/test/cask/cmd/reinstall_spec.rb | 4 - .../cmd/shared_examples/invalid_option.rb | 18 -- .../shared_examples/requires_cask_token.rb | 12 - Library/Homebrew/test/cask/cmd/style_spec.rb | 86 ------- .../Homebrew/test/cask/cmd/uninstall_spec.rb | 6 - .../Homebrew/test/cask/cmd/upgrade_spec.rb | 4 - Library/Homebrew/test/cask/cmd/zap_spec.rb | 6 - Library/Homebrew/test/cask/cmd_spec.rb | 31 --- .../Homebrew/test/cask/dsl/appcast_spec.rb | 2 - Library/Homebrew/test/cli/parser_spec.rb | 69 ------ Library/Homebrew/test/cmd/switch_spec.rb | 8 - Library/Homebrew/test/dev-cmd/diy_spec.rb | 8 - Library/Homebrew/test/language/java_spec.rb | 49 ++-- Library/Homebrew/test/spec_helper.rb | 8 +- Library/Homebrew/utils/git.rb | 12 - completions/bash/brew | 83 ------- completions/fish/brew.fish | 47 ---- completions/internal_commands_list.txt | 3 - completions/zsh/_brew | 58 ----- docs/Manpage.md | 13 - manpages/brew.1 | 10 - 94 files changed, 98 insertions(+), 2440 deletions(-) delete mode 100644 Library/Homebrew/cask/cmd/--cache.rb delete mode 100644 Library/Homebrew/cask/cmd/abstract_internal_command.rb delete mode 100644 Library/Homebrew/cask/cmd/cat.rb delete mode 100644 Library/Homebrew/cask/cmd/create.rb delete mode 100644 Library/Homebrew/cask/cmd/doctor.rb delete mode 100644 Library/Homebrew/cask/cmd/edit.rb delete mode 100644 Library/Homebrew/cask/cmd/help.rb delete mode 100644 Library/Homebrew/cask/cmd/home.rb delete mode 100644 Library/Homebrew/cask/cmd/internal_help.rb delete mode 100644 Library/Homebrew/cask/cmd/internal_stanza.rb delete mode 100644 Library/Homebrew/cask/cmd/outdated.rb delete mode 100644 Library/Homebrew/cask/cmd/style.rb delete mode 100644 Library/Homebrew/cmd/cask.rb delete mode 100644 Library/Homebrew/cmd/switch.rb delete mode 100644 Library/Homebrew/dev-cmd/diy.rb delete mode 100644 Library/Homebrew/extend/os/language/java.rb delete mode 100644 Library/Homebrew/extend/os/linux/dependency_collector.rb delete mode 100644 Library/Homebrew/extend/os/linux/requirements/java_requirement.rb delete mode 100644 Library/Homebrew/extend/os/mac/language/java.rb delete mode 100644 Library/Homebrew/extend/os/mac/requirements/java_requirement.rb delete mode 100644 Library/Homebrew/extend/os/requirements/java_requirement.rb delete mode 100644 Library/Homebrew/requirements/java_requirement.rb delete mode 100644 Library/Homebrew/test/cask/cmd/cache_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/cat_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/create_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/doctor_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/edit_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/home_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/outdated_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd/shared_examples/invalid_option.rb delete mode 100644 Library/Homebrew/test/cask/cmd/shared_examples/requires_cask_token.rb delete mode 100644 Library/Homebrew/test/cask/cmd/style_spec.rb delete mode 100644 Library/Homebrew/test/cask/cmd_spec.rb delete mode 100644 Library/Homebrew/test/cmd/switch_spec.rb delete mode 100644 Library/Homebrew/test/dev-cmd/diy_spec.rb diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 4edc7d5a2a..b9306e7ee4 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -72,6 +72,7 @@ begin ARGV.delete_at(help_cmd_index) if help_cmd_index + require "cli/parser" args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) Context.current = args.context @@ -111,8 +112,7 @@ begin # - a help flag is passed AND a command is matched # - a help flag is passed AND there is no command specified # - no arguments are passed - # - if cmd is Cask, let Cask handle the help command instead - if (empty_argv || help_flag) && cmd != "cask" + if empty_argv || help_flag require "help" Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv: empty_argv # `Homebrew::Help.help` never returns, except for unknown commands. diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 5a66b23caf..0aba27727d 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -10,29 +10,16 @@ require "extend/optparse" require "cask/config" require "cask/cmd/abstract_command" -require "cask/cmd/--cache" require "cask/cmd/audit" -require "cask/cmd/cat" -require "cask/cmd/create" -require "cask/cmd/doctor" -require "cask/cmd/edit" require "cask/cmd/fetch" -require "cask/cmd/help" -require "cask/cmd/home" require "cask/cmd/info" require "cask/cmd/install" require "cask/cmd/list" -require "cask/cmd/outdated" require "cask/cmd/reinstall" -require "cask/cmd/style" require "cask/cmd/uninstall" require "cask/cmd/upgrade" require "cask/cmd/zap" -require "cask/cmd/abstract_internal_command" -require "cask/cmd/internal_help" -require "cask/cmd/internal_stanza" - module Cask # Implementation of the `brew cask` command-line interface. # @@ -42,221 +29,12 @@ module Cask include Context - ALIASES = { - "ls" => "list", - "homepage" => "home", - "instal" => "install", # gem does the same - "uninstal" => "uninstall", - "rm" => "uninstall", - "remove" => "uninstall", - "abv" => "info", - "dr" => "doctor", - }.freeze - - DEPRECATED_COMMANDS = { - Cmd::Cache => "brew --cache [--cask]", - Cmd::Audit => "brew audit [--cask]", - Cmd::Cat => "brew cat [--cask]", - Cmd::Create => "brew create --cask --set-name ", - Cmd::Doctor => "brew doctor --verbose", - Cmd::Edit => "brew edit [--cask]", - Cmd::Fetch => "brew fetch [--cask]", - Cmd::Help => "brew help", - Cmd::Home => "brew home", - Cmd::Info => "brew info [--cask]", - Cmd::Install => "brew install [--cask]", - Cmd::List => "brew list [--cask]", - Cmd::Outdated => "brew outdated [--cask]", - Cmd::Reinstall => "brew reinstall [--cask]", - Cmd::Style => "brew style", - Cmd::Uninstall => "brew uninstall [--cask]", - Cmd::Upgrade => "brew upgrade [--cask]", - Cmd::Zap => "brew uninstall --zap [--cask]", - }.freeze - def self.parser(&block) Homebrew::CLI::Parser.new do - if block - instance_eval(&block) - else - usage_banner <<~EOS - `cask` [] [] - - Homebrew Cask provides a friendly CLI workflow for the administration of macOS applications distributed as binaries. - - See also: `man brew` - EOS - end + instance_eval(&block) if block cask_options end end - - def self.command_classes - @command_classes ||= constants.map(&method(:const_get)) - .select { |klass| klass.is_a?(Class) && klass < AbstractCommand } - .reject(&:abstract?) - .sort_by(&:command_name) - end - - def self.commands - @commands ||= command_classes.map(&:command_name) - end - - def self.lookup_command(command_name) - @lookup ||= Hash[commands.zip(command_classes)] - command_name = ALIASES.fetch(command_name, command_name) - @lookup.fetch(command_name, nil) - end - - def self.aliases - ALIASES - end - - def self.run(*args) - new(*args).run - end - - def initialize(*args) - @argv = args - end - - def find_external_command(command) - @tap_cmd_directories ||= Tap.cmd_directories - @path ||= PATH.new(@tap_cmd_directories, ENV["HOMEBREW_PATH"]) - - external_ruby_cmd = @tap_cmd_directories.map { |d| d/"brewcask-#{command}.rb" } - .find(&:file?) - external_ruby_cmd ||= which("brewcask-#{command}.rb", @path) - - if external_ruby_cmd - ExternalRubyCommand.new(command, external_ruby_cmd) - elsif external_command = which("brewcask-#{command}", @path) - ExternalCommand.new(external_command) - end - end - - def detect_internal_command(*args) - args.each_with_index do |arg, i| - if command = self.class.lookup_command(arg) - args.delete_at(i) - return [command, args] - elsif !arg.start_with?("-") - break - end - end - - nil - end - - def detect_external_command(*args) - args.each_with_index do |arg, i| - if command = find_external_command(arg) - args.delete_at(i) - return [command, args] - elsif !arg.start_with?("-") - break - end - end - - nil - end - - def run - argv = @argv - - args = self.class.parser.parse(argv, ignore_invalid_options: true) - - Tap.install_default_cask_tap_if_necessary - - command, argv = detect_internal_command(*argv) || - detect_external_command(*argv) || - [args.remaining.empty? ? NullCommand : UnknownSubcommand.new(args.remaining.first), argv] - - if (replacement = DEPRECATED_COMMANDS[command]) - odisabled "`brew cask #{command.command_name}`", replacement - end - - if args.help? - puts command.help - else - command.run(*argv) - end - rescue CaskError, MethodDeprecatedError, ArgumentError => e - onoe e.message - $stderr.puts e.backtrace if args.debug? - exit 1 - end - - # Wrapper class for running an external Ruby command. - class ExternalRubyCommand - def initialize(command, path) - @command_name = command.to_s.capitalize.to_sym - @path = path - end - - def run(*args) - command_class&.run(*args) - end - - def help - command_class&.help - end - - private - - def command_class - return @command_class if defined?(@command_class) - - require @path - - @command_class = begin - Cmd.const_get(@command_name) - rescue NameError - nil - end - end - end - - # Wrapper class for running an external command. - class ExternalCommand - def initialize(path) - @path = path - end - - def run(*argv) - exec @path, *argv - end - - def help - exec @path, "--help" - end - end - - # Helper class for showing help for unknown subcommands. - class UnknownSubcommand - def initialize(command_name) - @command_name = command_name - end - - def run(*) - raise UsageError, "Subcommand `#{@command_name}` does not exist." - end - - def help - run - end - end - - # Helper class for showing help when no subcommand is given. - class NullCommand - def self.run(*) - raise UsageError, "No subcommand given." - end - - def self.help - Cmd.parser.generate_help_text - end - end end end diff --git a/Library/Homebrew/cask/cmd/--cache.rb b/Library/Homebrew/cask/cmd/--cache.rb deleted file mode 100644 index 8a85ba5a85..0000000000 --- a/Library/Homebrew/cask/cmd/--cache.rb +++ /dev/null @@ -1,41 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask --cache` command. - # - # @api private - class Cache < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - "Display the file used to cache a ." - end - - sig { returns(String) } - def self.command_name - "--cache" - end - - sig { void } - def run - casks.each do |cask| - puts self.class.cached_location(cask) - end - end - - def self.cached_location(cask) - require "cask/download" - - Download.new(cask).downloader.cached_location - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/abstract_command.rb b/Library/Homebrew/cask/cmd/abstract_command.rb index 334fb69ebf..6c93a9e49f 100644 --- a/Library/Homebrew/cask/cmd/abstract_command.rb +++ b/Library/Homebrew/cask/cmd/abstract_command.rb @@ -5,7 +5,7 @@ require "search" module Cask class Cmd - # Abstract superclass for all `brew cask` commands. + # Abstract superclass for all Cask implementations of commands. # # @api private class AbstractCommand @@ -14,32 +14,6 @@ module Cask include Homebrew::Search - sig { returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - nil - end - - sig { returns(T.nilable(Integer)) } - def self.max_named - nil - end - - sig { returns(String) } - def self.banner_args - if min_named == :cask && max_named != 1 - " " - elsif max_named&.zero? - "" - else - " []" - end - end - - sig { returns(String) } - def self.banner_headline - "`#{command_name}` []#{banner_args}" - end - OPTIONS = [ [:switch, "--[no-]binaries", { description: "Disable/enable linking of helper executables (default: enabled).", @@ -56,26 +30,12 @@ module Cask ].freeze def self.parser(&block) - banner = <<~EOS - `cask` #{banner_headline} - - #{description} - EOS - - min_n = min_named - max_n = max_named - Cmd.parser do - usage_banner banner - instance_eval(&block) if block OPTIONS.each do |option| send(*option) end - - min_named min_n unless min_n.nil? - max_named max_n unless max_n.nil? end end diff --git a/Library/Homebrew/cask/cmd/abstract_internal_command.rb b/Library/Homebrew/cask/cmd/abstract_internal_command.rb deleted file mode 100644 index 0fb1e2152c..0000000000 --- a/Library/Homebrew/cask/cmd/abstract_internal_command.rb +++ /dev/null @@ -1,23 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module Cask - class Cmd - # Abstract superclass for all internal `brew cask` commands. - # - # @api private - class AbstractInternalCommand < AbstractCommand - extend T::Sig - - sig { returns(String) } - def self.command_name - super.sub(/^internal_/i, "_") - end - - sig { returns(T::Boolean) } - def self.visible? - false - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/audit.rb b/Library/Homebrew/cask/cmd/audit.rb index acb72e1387..c614241353 100644 --- a/Library/Homebrew/cask/cmd/audit.rb +++ b/Library/Homebrew/cask/cmd/audit.rb @@ -5,22 +5,12 @@ require "utils/github/actions" module Cask class Cmd - # Implementation of the `brew cask audit` command. + # Cask implementation of the `brew audit` command. # # @api private class Audit < AbstractCommand extend T::Sig - sig { returns(String) } - def self.description - <<~EOS - Check for Homebrew coding style violations. This should be run before - submitting a new cask. If no is provided, checks all locally - available casks. Will exit with a non-zero status if any errors are - found, which can be useful for implementing pre-commit hooks. - EOS - end - def self.parser super do switch "--download", diff --git a/Library/Homebrew/cask/cmd/cat.rb b/Library/Homebrew/cask/cmd/cat.rb deleted file mode 100644 index bb741992ea..0000000000 --- a/Library/Homebrew/cask/cmd/cat.rb +++ /dev/null @@ -1,35 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask cat` command. - # - # @api private - class Cat < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - "Dump raw source of a to the standard output." - end - - sig { void } - def run - casks.each do |cask| - if Homebrew::EnvConfig.bat? - ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path - safe_system "#{HOMEBREW_PREFIX}/bin/bat", cask.sourcefile_path - else - puts File.open(cask.sourcefile_path, &:read) - end - end - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/create.rb b/Library/Homebrew/cask/cmd/create.rb deleted file mode 100644 index c03b1611ff..0000000000 --- a/Library/Homebrew/cask/cmd/create.rb +++ /dev/null @@ -1,64 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask create` command. - # - # @api private - class Create < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { override.returns(T.nilable(Integer)) } - def self.max_named - 1 - end - - sig { returns(String) } - def self.description - "Creates the given and opens it in an editor." - end - - def initialize(*) - super - rescue Homebrew::CLI::MaxNamedArgumentsError - raise UsageError, "Only one cask can be created at a time." - end - - sig { void } - def run - cask_token = args.named.first - cask_path = CaskLoader.path(cask_token) - raise CaskAlreadyCreatedError, cask_token if cask_path.exist? - - odebug "Creating Cask #{cask_token}" - File.open(cask_path, "w") do |f| - f.write self.class.template(cask_token) - end - - exec_editor cask_path - end - - def self.template(cask_token) - <<~RUBY - cask "#{cask_token}" do - version "" - sha256 "" - - url "https://" - name "" - desc "" - homepage "" - - app "" - end - RUBY - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/doctor.rb b/Library/Homebrew/cask/cmd/doctor.rb deleted file mode 100644 index d0d5cb0ba1..0000000000 --- a/Library/Homebrew/cask/cmd/doctor.rb +++ /dev/null @@ -1,42 +0,0 @@ -# typed: false -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask doctor` command. - # - # @api private - class Doctor < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(Integer)) } - def self.max_named - 0 - end - - sig { returns(String) } - def self.description - "Checks for configuration issues." - end - - sig { void } - def run - require "diagnostic" - - success = T.let(true, T::Boolean) - - checks = Homebrew::Diagnostic::Checks.new(verbose: true) - checks.cask_checks.each do |check| - out = checks.send(check) - - if out.present? - success = false - puts out - end - end - - raise CaskError, "There are some problems with your setup." unless success - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/edit.rb b/Library/Homebrew/cask/cmd/edit.rb deleted file mode 100644 index 8036352a31..0000000000 --- a/Library/Homebrew/cask/cmd/edit.rb +++ /dev/null @@ -1,54 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask edit` command. - # - # @api private - class Edit < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { override.returns(T.nilable(Integer)) } - def self.max_named - 1 - end - - sig { returns(String) } - def self.description - "Open the given for editing." - end - - def initialize(*) - super - rescue Homebrew::CLI::MaxNamedArgumentsError - raise UsageError, "Only one cask can be edited at a time." - end - - sig { void } - def run - exec_editor cask_path - rescue CaskUnavailableError => e - reason = e.reason.empty? ? +"" : +"#{e.reason} " - reason.concat( - "Run #{Formatter.identifier("brew create --cask --set-name #{e.token} ")} to create a new Cask.", - ) - raise e.class.new(e.token, reason.freeze) - end - - def cask_path - casks.first.sourcefile_path - rescue CaskInvalidError, CaskUnreadableError, MethodDeprecatedError - path = CaskLoader.path(args.first) - return path if path.file? - - raise - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/fetch.rb b/Library/Homebrew/cask/cmd/fetch.rb index b9239216ae..da0eb66295 100644 --- a/Library/Homebrew/cask/cmd/fetch.rb +++ b/Library/Homebrew/cask/cmd/fetch.rb @@ -3,17 +3,12 @@ module Cask class Cmd - # Implementation of the `brew cask fetch` command. + # Cask implementation of the `brew fetch` command. # # @api private class Fetch < AbstractCommand extend T::Sig - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - def self.parser super do switch "--force", @@ -21,11 +16,6 @@ module Cask end end - sig { returns(String) } - def self.description - "Downloads remote application files to local cache." - end - sig { void } def run require "cask/download" diff --git a/Library/Homebrew/cask/cmd/help.rb b/Library/Homebrew/cask/cmd/help.rb deleted file mode 100644 index df5fcf3c97..0000000000 --- a/Library/Homebrew/cask/cmd/help.rb +++ /dev/null @@ -1,42 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask help` command. - # - # @api private - class Help < AbstractCommand - extend T::Sig - - sig { override.returns(T.nilable(Integer)) } - def self.max_named - 1 - end - - sig { returns(String) } - def self.description - "Print help for `cask` commands." - end - - sig { void } - def run - if args.named.empty? - puts Cmd.parser.generate_help_text - else - command_name = args.named.first - - unless command = self.class.commands[command_name] - raise "No help information found for command '#{command_name}'." - end - - puts command.help - end - end - - def self.commands - Cmd.command_classes.select(&:visible?).index_by(&:command_name) - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/home.rb b/Library/Homebrew/cask/cmd/home.rb deleted file mode 100644 index 6beaf0ac2c..0000000000 --- a/Library/Homebrew/cask/cmd/home.rb +++ /dev/null @@ -1,35 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask home` command. - # - # @api private - class Home < AbstractCommand - extend T::Sig - - sig { returns(String) } - def self.description - "Opens the homepage of the given . If no cask is given, opens the Homebrew homepage." - end - - sig { void } - def run - if casks.none? - odebug "Opening project homepage" - self.class.open_url "https://brew.sh/" - else - casks.each do |cask| - odebug "Opening homepage for Cask #{cask}" - self.class.open_url cask.homepage - end - end - end - - def self.open_url(url) - SystemCommand.run!(OS::PATH_OPEN, args: ["--", url]) - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index 1ffebfa177..a2408f87c3 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -5,22 +5,12 @@ require "json" module Cask class Cmd - # Implementation of the `brew cask info` command. + # Cask implementation of the `brew info` command. # # @api private class Info < AbstractCommand extend T::Sig - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - "Displays information about the given ." - end - def self.parser super do flag "--json=", diff --git a/Library/Homebrew/cask/cmd/install.rb b/Library/Homebrew/cask/cmd/install.rb index c2dc60105f..0e3b740e3b 100644 --- a/Library/Homebrew/cask/cmd/install.rb +++ b/Library/Homebrew/cask/cmd/install.rb @@ -3,22 +3,12 @@ module Cask class Cmd - # Implementation of the `brew cask install` command. + # Cask implementation of the `brew install` command. # # @api private class Install < AbstractCommand extend T::Sig - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - "Installs the given ." - end - OPTIONS = [ [:switch, "--skip-cask-deps", { description: "Skip installing cask dependencies.", diff --git a/Library/Homebrew/cask/cmd/internal_help.rb b/Library/Homebrew/cask/cmd/internal_help.rb deleted file mode 100644 index 98f1011d4c..0000000000 --- a/Library/Homebrew/cask/cmd/internal_help.rb +++ /dev/null @@ -1,35 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask _help` command. - # - # @api private - class InternalHelp < AbstractInternalCommand - extend T::Sig - - sig { override.returns(T.nilable(Integer)) } - def self.max_named - 0 - end - - sig { returns(String) } - def self.description - "Print help for unstable internal-use commands." - end - - sig { void } - def run - max_command_len = Cmd.commands.map(&:length).max - puts "Unstable Internal-use Commands:\n\n" - Cmd.command_classes.each do |klass| - next if klass.visible? - - puts " #{klass.command_name.ljust(max_command_len)} #{klass.help}" - end - puts "\n" - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/internal_stanza.rb b/Library/Homebrew/cask/cmd/internal_stanza.rb deleted file mode 100644 index 2ea3385426..0000000000 --- a/Library/Homebrew/cask/cmd/internal_stanza.rb +++ /dev/null @@ -1,127 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "cask/dsl" - -module Cask - class Cmd - # Implementation of the `brew cask _stanza` command. - # - # @api private - class InternalStanza < AbstractInternalCommand - extend T::Sig - - # Syntax - # - # brew cask _stanza [ --quiet ] [ --table | --yaml ] [ ... ] - # - # If no tokens are given, then data for all casks is returned. - # - # The pseudo-stanza "artifacts" is available. - # - # On failure, a blank line is returned on the standard output. - # - - ARTIFACTS = - (DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) + - DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)).freeze - - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - 1 - end - - sig { returns(String) } - def self.banner_args - " []" - end - - sig { returns(String) } - def self.description - <<~EOS - Extract and render a specific stanza for the given . - - Examples: - `brew cask _stanza appcast --table` - `brew cask _stanza app --table alfred google-chrome vagrant` - `brew cask _stanza url --table alfred google-chrome vagrant` - `brew cask _stanza version --table alfred google-chrome vagrant` - `brew cask _stanza artifacts --table alfred google-chrome vagrant` - `brew cask _stanza artifacts --table --yaml alfred google-chrome vagrant` - EOS - end - - def self.parser - super do - switch "--table", - description: "Print stanza in table format." - switch "--quiet", - description: "" - switch "--yaml", - description: "" - switch "--inspect", - description: "" - end - end - - attr_accessor :format, :stanza - private :format, :format= - private :stanza, :stanza= - - def initialize(*) - super - - named = args.named.dup - @stanza = named.shift.to_sym - args.freeze_named_args!(named) - - @format = :to_yaml if args.yaml? - - return if DSL::DSL_METHODS.include?(stanza) - - raise UsageError, <<~EOS - Unknown/unsupported stanza '#{stanza}'. - Check cask reference for supported stanzas. - EOS - end - - sig { void } - def run - if ARTIFACTS.include?(stanza) - artifact_name = stanza - @stanza = :artifacts - end - - casks(alternative: -> { Cask.to_a }).each do |cask| - print "#{cask}\t" if args.table? - - begin - value = cask.send(stanza) - rescue - opoo "Failure calling '#{stanza}' on Cask '#{cask}'" unless args.quiet? - puts "" - next - end - - if stanza == :artifacts - value = Hash[value.map { |v| [v.class.dsl_key, v.to_s] }] - value = value[artifact_name] if artifact_name - end - - if value.nil? || (value.respond_to?(:empty?) && value.empty?) - stanza_name = artifact_name || stanza - raise CaskError, "no such stanza '#{stanza_name}' on Cask '#{cask}'" - end - - if format - puts value.send(format) - elsif value.is_a?(Symbol) - puts value.inspect - else - puts value.to_s - end - end - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/list.rb b/Library/Homebrew/cask/cmd/list.rb index 7c780c2464..f6610caf23 100644 --- a/Library/Homebrew/cask/cmd/list.rb +++ b/Library/Homebrew/cask/cmd/list.rb @@ -5,17 +5,12 @@ require "cask/artifact/relocated" module Cask class Cmd - # Implementation of the `brew cask list` command. + # Cask implementation of the `brew list` command. # # @api private class List < AbstractCommand extend T::Sig - sig { returns(String) } - def self.description - "Lists installed casks or the casks provided in the arguments." - end - def self.parser super do switch "-1", diff --git a/Library/Homebrew/cask/cmd/outdated.rb b/Library/Homebrew/cask/cmd/outdated.rb deleted file mode 100644 index 791f465333..0000000000 --- a/Library/Homebrew/cask/cmd/outdated.rb +++ /dev/null @@ -1,40 +0,0 @@ -# typed: false -# frozen_string_literal: true - -module Cask - class Cmd - # Implementation of the `brew cask outdated` command. - # - # @api private - class Outdated < AbstractCommand - extend T::Sig - - sig { returns(String) } - def self.description - "List the outdated installed casks." - end - - def self.parser - super do - switch "--greedy", - description: "Also include casks which specify `auto_updates true` or `version :latest`." - switch "--json", - description: "Print a JSON representation of outdated casks." - end - end - - sig { void } - def run - outdated_casks = casks(alternative: -> { Caskroom.casks(config: Config.from_args(args)) }).select do |cask| - odebug "Checking update info of Cask #{cask}" - cask.outdated?(greedy: args.greedy?) - end - - verbose = ($stdout.tty? || args.verbose?) && !args.quiet? - output = outdated_casks.map { |cask| cask.outdated_info(args.greedy?, verbose, args.json?) } - - puts args.json? ? JSON.generate(output) : output - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/reinstall.rb b/Library/Homebrew/cask/cmd/reinstall.rb index 5d0af86177..1470bffede 100644 --- a/Library/Homebrew/cask/cmd/reinstall.rb +++ b/Library/Homebrew/cask/cmd/reinstall.rb @@ -3,17 +3,12 @@ module Cask class Cmd - # Implementation of the `brew cask reinstall` command. + # Cask implementation of the `brew reinstall` command. # # @api private class Reinstall < Install extend T::Sig - sig { returns(String) } - def self.description - "Reinstalls the given ." - end - sig { void } def run self.class.reinstall_casks( diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb deleted file mode 100644 index f0f1c34995..0000000000 --- a/Library/Homebrew/cask/cmd/style.rb +++ /dev/null @@ -1,49 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "json" -require "style" - -module Cask - class Cmd - # Implementation of the `brew cask style` command. - # - # @api private - class Style < AbstractCommand - extend T::Sig - - sig { returns(String) } - def self.description - "Checks style of the given using RuboCop." - end - - def self.parser - super do - switch "--fix", - description: "Fix style violations automatically using RuboCop's auto-correct feature." - end - end - - sig { void } - def run - success = Homebrew::Style.check_style_and_print( - cask_paths, - fix: args.fix?, - debug: args.debug?, - verbose: args.verbose?, - ) - raise CaskError, "Style check failed." unless success - end - - def cask_paths - @cask_paths ||= if args.named.empty? - Tap.map(&:cask_dir).select(&:directory?) - elsif args.named.any? { |file| File.exist?(file) } - args.named.map { |path| Pathname(path).expand_path } - else - casks.map(&:sourcefile_path) - end - end - end - end -end diff --git a/Library/Homebrew/cask/cmd/uninstall.rb b/Library/Homebrew/cask/cmd/uninstall.rb index 6a70b9b77e..40a70ca56c 100644 --- a/Library/Homebrew/cask/cmd/uninstall.rb +++ b/Library/Homebrew/cask/cmd/uninstall.rb @@ -3,22 +3,12 @@ module Cask class Cmd - # Implementation of the `brew cask uninstall` command. + # Cask implementation of the `brew uninstall` command. # # @api private class Uninstall < AbstractCommand extend T::Sig - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - "Uninstalls the given ." - end - def self.parser super do switch "--force", diff --git a/Library/Homebrew/cask/cmd/upgrade.rb b/Library/Homebrew/cask/cmd/upgrade.rb index a0d0ecb98c..f0a8bbe912 100644 --- a/Library/Homebrew/cask/cmd/upgrade.rb +++ b/Library/Homebrew/cask/cmd/upgrade.rb @@ -6,17 +6,12 @@ require "cask/config" module Cask class Cmd - # Implementation of the `brew cask upgrade` command. + # Cask implementation of the `brew upgrade` command. # # @api private class Upgrade < AbstractCommand extend T::Sig - sig { returns(String) } - def self.description - "Upgrades all outdated casks or the specified casks." - end - OPTIONS = [ [:switch, "--skip-cask-deps", { description: "Skip installing cask dependencies.", diff --git a/Library/Homebrew/cask/cmd/zap.rb b/Library/Homebrew/cask/cmd/zap.rb index 028c103afd..34f80fe7e1 100644 --- a/Library/Homebrew/cask/cmd/zap.rb +++ b/Library/Homebrew/cask/cmd/zap.rb @@ -3,26 +3,12 @@ module Cask class Cmd - # Implementation of the `brew cask zap` command. + # Cask implementation for the `brew uninstall` command. # # @api private class Zap < AbstractCommand extend T::Sig - sig { override.returns(T.nilable(T.any(Integer, Symbol))) } - def self.min_named - :cask - end - - sig { returns(String) } - def self.description - <<~EOS - Zaps all files associated with the given . Implicitly also performs all actions associated with `uninstall`. - - *May remove files which are shared between applications.* - EOS - end - def self.parser super do switch "--force", diff --git a/Library/Homebrew/cask/dsl/depends_on.rb b/Library/Homebrew/cask/dsl/depends_on.rb index 5bb3deda8b..ca85b1e44b 100644 --- a/Library/Homebrew/cask/dsl/depends_on.rb +++ b/Library/Homebrew/cask/dsl/depends_on.rb @@ -83,7 +83,7 @@ module Cask end def java=(arg) - odeprecated "depends_on :java", "depends_on a specific Java formula" + odisabled "depends_on :java", "depends_on a specific Java formula" @java = arg end @@ -91,7 +91,7 @@ module Cask def x11=(arg) raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg) - odeprecated "depends_on :x11", "depends_on specific X11 formula(e)" + odisabled "depends_on :x11", "depends_on specific X11 formula(e)" @x11 = arg end diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 68e4dd3532..ed43646664 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -195,7 +195,6 @@ module Homebrew def usage_banner_text @parser.banner - .gsub(/^ - (`[^`]+`)\s+/, "\n- \\1:\n
") # Format `cask` subcommands as Markdown list. end def comma_array(name, description: nil) @@ -344,10 +343,7 @@ module Homebrew end def generate_help_text - Formatter.wrap( - @parser.to_s.gsub(/^ - (`[^`]+`\s+)/, " \\1"), # Remove `-` from `cask` subcommand listing. - COMMAND_DESC_WIDTH, - ) + Formatter.wrap(@parser.to_s, COMMAND_DESC_WIDTH) .sub(/^/, "#{Tty.bold}Usage: brew#{Tty.reset} ") .gsub(/`(.*?)`/m, "#{Tty.bold}\\1#{Tty.reset}") .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } @@ -398,8 +394,7 @@ module Homebrew end def max_named(count) - # TODO: (2.8) uncomment for the next major/minor release - # odeprecated "`max_named`", "`named_args max:`" + odeprecated "`max_named`", "`named_args max:`" raise TypeError, "Unsupported type #{count.class.name} for max_named" unless count.is_a?(Integer) @@ -407,8 +402,7 @@ module Homebrew end def min_named(count_or_type) - # TODO: (2.8) uncomment for the next major/minor release - # odeprecated "`min_named`", "`named_args min:`" + odeprecated "`min_named`", "`named_args min:`" case count_or_type when Integer @@ -423,8 +417,7 @@ module Homebrew end def named(count_or_type) - # TODO: (2.8) uncomment for the next major/minor release - # odeprecated "`named`", "`named_args`" + odeprecated "`named`", "`named_args`" case count_or_type when Integer diff --git a/Library/Homebrew/cmd/cask.rb b/Library/Homebrew/cmd/cask.rb deleted file mode 100644 index cbd284fc2e..0000000000 --- a/Library/Homebrew/cmd/cask.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "cask/cmd" - -module Homebrew - module_function - - def cask_args - Cask::Cmd.parser - end - - def cask - ARGV.freeze - Cask::Cmd.run(*ARGV) - end -end diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index af6cb43ed2..ea41c1efa3 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -38,8 +38,6 @@ module Homebrew "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? diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a2bde175f0..25fbee9de6 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -132,8 +132,8 @@ module Homebrew args = install_args.parse if args.env.present? - # TODO: enable for Homebrew 2.8.0 and use `replacement: false` for 2.9.0. - # odeprecated "brew install --env", "`env :std` in specific formula files" + # TODO: use `replacement: false` for 3.1.0. + odeprecated "brew install --env", "`env :std` in specific formula files" end args.named.each do |name| diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index c0781d6a7a..c9cb629aa6 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -116,12 +116,8 @@ module Homebrew ls_args << "-r" if args.r? ls_args << "-t" if args.t? - if !$stdout.tty? && !args.formula? && !args.cask? - odisabled "`brew list` to only list formulae", "`brew list --formula`" - else - safe_system "ls", *ls_args, HOMEBREW_CELLAR unless args.cask? - list_casks(args: args) unless args.formula? - end + safe_system "ls", *ls_args, HOMEBREW_CELLAR unless args.cask? + list_casks(args: args) unless args.formula? elsif args.verbose? || !$stdout.tty? system_command! "find", args: args.named.to_kegs.map(&:to_s) + %w[-not -type d -print], print_stdout: true else diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb index 004bc3a1eb..a7a6da48f1 100644 --- a/Library/Homebrew/cmd/outdated.rb +++ b/Library/Homebrew/cmd/outdated.rb @@ -48,9 +48,9 @@ module Homebrew def outdated args = outdated_args.parse - case (j = json_version(args.json)) + case json_version(args.json) when :v1 - odisabled "`brew outdated --json#{j == :v1 ? "=v1" : ""}`", "`brew outdated --json=v2`" + odie "`brew outdated --json=v1` is no longer supported. Use brew outdated --json=v2 instead." when :v2, :default formulae, casks = if args.formula? [outdated_formulae(args: args), []] diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index d5c86658e0..66ca2764cf 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -65,7 +65,7 @@ module Homebrew conflicts "--open", "--closed" conflicts(*package_manager_switches) - # TODO: (2.9) add `min: 1` when the `odeprecated`/`odisabled` for `brew search` with no arguments is removed + # TODO: (3.1) add `min: 1` when the `odeprecated`/`odisabled` for `brew search` with no arguments is removed named_args :text_or_regex end end @@ -85,7 +85,7 @@ module Homebrew puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort) else - odeprecated "`brew search` with no arguments to output formulae", "`brew formulae`" + odisabled "`brew search` with no arguments to output formulae", "`brew formulae`" puts Formatter.columns(Formula.full_names.sort) end diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb deleted file mode 100644 index 3e78b4fc59..0000000000 --- a/Library/Homebrew/cmd/switch.rb +++ /dev/null @@ -1,30 +0,0 @@ -# typed: true -# frozen_string_literal: true - -require "formula" -require "keg" -require "cli/parser" - -module Homebrew - extend T::Sig - - module_function - - sig { returns(CLI::Parser) } - def switch_args - Homebrew::CLI::Parser.new do - description <<~EOS - Symlink all of the specified of 's installation into Homebrew's prefix. - EOS - - named_args number: 2 - hide_from_man_page! - end - end - - def switch - switch_args.parse - - odisabled "`brew switch`", "`brew link` @-versioned formulae" - end -end diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 85c1203039..23ebde0cfc 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -1,7 +1,6 @@ # typed: false # frozen_string_literal: true -require "cask/cmd" require "completions" # Helper functions for commands. @@ -97,15 +96,11 @@ module Commands cmds += internal_developer_commands cmds += external_commands if external cmds += internal_commands_aliases if aliases - cmds += cask_commands(aliases: aliases).map { |cmd| "cask #{cmd}" } cmds.sort end - def internal_commands_paths(cask: true) - cmds = find_commands HOMEBREW_CMD_PATH - # can be removed when cask commands are removed and no longer odeprecated/odisabled - cmds.delete(HOMEBREW_CMD_PATH/"cask.rb") unless cask - cmds + def internal_commands_paths + find_commands HOMEBREW_CMD_PATH end def internal_developer_commands_paths @@ -146,34 +141,6 @@ module Commands .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 @@ -196,10 +163,7 @@ module Commands # Ensure that the cache exists so we can build the commands list HOMEBREW_CACHE.mkpath - cmds = commands(aliases: true).reject do |cmd| - # TODO: (2.8) remove the cask check when `brew cask` is removed - cmd.start_with?("cask ") || Homebrew::Completions::COMPLETIONS_EXCLUSION_LIST.include?(cmd) - end + cmds = commands(aliases: true) - Homebrew::Completions::COMPLETIONS_EXCLUSION_LIST all_commands_file = HOMEBREW_CACHE/"all_commands_list.txt" external_commands_file = HOMEBREW_CACHE/"external_commands_list.txt" diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index c375139955..555a8b75fc 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -85,10 +85,6 @@ class DependencyCollector Dependency.new("bzip2", tags) unless which("bzip2") end - def java_dep_if_needed(tags) - JavaRequirement.new(tags) - end - def self.tar_needs_xz_dependency? !new.xz_dep_if_needed([]).nil? end @@ -124,7 +120,6 @@ class DependencyCollector case spec when :arch then ArchRequirement.new(tags) when :codesign then CodesignRequirement.new(tags) - when :java then java_dep_if_needed(tags) when :linux then LinuxRequirement.new(tags) when :macos then MacOSRequirement.new(tags) when :maximum_macos then MacOSRequirement.new(tags, comparator: "<=") diff --git a/Library/Homebrew/dev-cmd/diy.rb b/Library/Homebrew/dev-cmd/diy.rb deleted file mode 100644 index 64a37f337b..0000000000 --- a/Library/Homebrew/dev-cmd/diy.rb +++ /dev/null @@ -1,35 +0,0 @@ -# typed: true -# frozen_string_literal: true - -require "formula" -require "cli/parser" - -module Homebrew - extend T::Sig - - module_function - - sig { returns(CLI::Parser) } - def diy_args - Homebrew::CLI::Parser.new do - description <<~EOS - 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 `brew link`. - EOS - flag "--name=", - description: "Explicitly set the of the package being installed." - flag "--version=", - description: "Explicitly set the of the package being installed." - - max_named 0 - hide_from_man_page! - end - end - - def diy - diy_args.parse - - odisabled "`brew diy`" - end -end diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 59d9bbddd6..d7c0247a59 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -67,7 +67,7 @@ module Homebrew template = (SOURCE_PATH/"brew.1.md.erb").read variables = OpenStruct.new - variables[:commands] = generate_cmd_manpages(Commands.internal_commands_paths(cask: false)) + variables[:commands] = generate_cmd_manpages(Commands.internal_commands_paths) variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths) variables[:official_external_commands] = generate_cmd_manpages(Commands.official_external_commands_paths(quiet: quiet)) diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 287b8ccbee..369fe76bc4 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -47,9 +47,6 @@ module Homebrew flag "--message=", depends_on: "--autosquash", description: "Message to include when autosquashing revision bumps, deletions, and rebuilds." - flag "--workflow=", - description: "Retrieve artifacts from the specified workflow (default: `tests.yml`).", - replacement: "`--workflows`" flag "--artifact=", description: "Download artifacts with the specified name (default: `bottles`)." flag "--bintray-org=", @@ -358,13 +355,7 @@ module Homebrew def pr_pull args = pr_pull_args.parse - odisabled "`brew pr-pull --workflow`", "`brew pr-pull --workflows=`" if args.workflow.presence - - workflows = if args.workflow.blank? - args.workflows.presence || ["tests.yml"] - else - [args.workflow].compact.presence || ["tests.yml"] - end + workflows = args.workflows.presence || ["tests.yml"] artifact = args.artifact || "bottles" bintray_org = args.bintray_org || "homebrew" mirror_repo = args.bintray_mirror || "mirror" diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index cfa8b5479a..c1fd914cc9 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -26,14 +26,15 @@ module Homebrew description: "Print as a Markdown list." named_args max: 2 + + hide_from_man_page! end end def release_notes args = release_notes_args.parse - # TODO: (2.8) Deprecate this command now that the `brew release` command exists. - # odeprecated "`brew release-notes`" + odeprecated "`brew release-notes`", "`brew release`" previous_tag = args.named.first diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 44940507bd..c4585dff61 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -241,7 +241,7 @@ module SharedEnvExtension # Currently only used by aalib in core. sig { void } def ncurses_define - # odeprecated "ENV.ncurses_define" + odeprecated "ENV.ncurses_define" append "CPPFLAGS", "-DNCURSES_OPAQUE=0" end @@ -249,6 +249,8 @@ module SharedEnvExtension # @private sig { void } def userpaths! + odeprecated "ENV.userpaths!" + path = PATH.new(self["PATH"]).select do |p| # put Superenv.bin and opt path at the first p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV", "#{HOMEBREW_PREFIX}/opt") @@ -343,9 +345,10 @@ module SharedEnvExtension sig { void } def permit_arch_flags; end - # A no-op until we enable this by default again (which we may never do). sig { void } - def permit_weak_imports; end + def permit_weak_imports + odeprecated "ENV.permit_weak_imports" + end # @private sig { params(cc: T.any(Symbol, String)).returns(T::Boolean) } diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index d63cc5975a..bfd4657b10 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -99,7 +99,7 @@ module Stdenv %w[O3 O2 O1 O0 Os].each do |opt| define_method opt do - odeprecated "ENV.#{opt}" + odisabled "ENV.#{opt}" send(:remove_from_cflags, /-O./) send(:append_to_cflags, "-#{opt}") @@ -141,7 +141,7 @@ module Stdenv sig { void } def m64 - odeprecated "ENV.m64" + odisabled "ENV.m64" append_to_cflags "-m64" append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}" @@ -149,7 +149,7 @@ module Stdenv sig { void } def m32 - odeprecated "ENV.m32" + odisabled "ENV.m32" append_to_cflags "-m32" append "LDFLAGS", "-arch #{Hardware::CPU.arch_32_bit}" @@ -157,7 +157,7 @@ module Stdenv sig { void } def universal_binary - odeprecated "ENV.universal_binary" + odisabled "ENV.universal_binary" check_for_compiler_universal_support @@ -184,7 +184,7 @@ module Stdenv sig { void } def libstdcxx - odeprecated "ENV.libstdcxx" + odisabled "ENV.libstdcxx" append "CXX", "-stdlib=libstdc++" if compiler == :clang end @@ -220,7 +220,7 @@ module Stdenv sig { void } def x11 - odeprecated "ENV.x11", "depends_on specific X11 formula(e)" + odisabled "ENV.x11", "depends_on specific X11 formula(e)" end # @private diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index b8ccfdaaec..4d48592657 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -294,7 +294,7 @@ module Superenv sig { void } def universal_binary - odeprecated "ENV.universal_binary" + odisabled "ENV.universal_binary" check_for_compiler_universal_support @@ -308,14 +308,14 @@ module Superenv sig { void } def m32 - odeprecated "ENV.m32" + odisabled "ENV.m32" append "HOMEBREW_ARCHFLAGS", "-m32" end sig { void } def m64 - odeprecated "ENV.m64" + odisabled "ENV.m64" append "HOMEBREW_ARCHFLAGS", "-m64" end @@ -333,7 +333,7 @@ module Superenv sig { void } def libstdcxx - odeprecated "ENV.libstdcxx" + odisabled "ENV.libstdcxx" append_to_cccfg "h" if compiler == :clang end @@ -346,7 +346,7 @@ module Superenv %w[O3 O2 O1 O0 Os].each do |opt| define_method opt do - odeprecated "ENV.#{opt}" + odisabled "ENV.#{opt}" send(:[]=, "HOMEBREW_OPTIMIZATION_LEVEL", opt) end @@ -354,7 +354,7 @@ module Superenv sig { void } def set_x11_env_if_installed - odeprecated "ENV.set_x11_env_if_installed" + odisabled "ENV.set_x11_env_if_installed" end end diff --git a/Library/Homebrew/extend/os/dependency_collector.rb b/Library/Homebrew/extend/os/dependency_collector.rb index 58a3f23994..32a2466933 100644 --- a/Library/Homebrew/extend/os/dependency_collector.rb +++ b/Library/Homebrew/extend/os/dependency_collector.rb @@ -1,8 +1,4 @@ # typed: strict # frozen_string_literal: true -if OS.mac? - require "extend/os/mac/dependency_collector" -elsif OS.linux? - require "extend/os/linux/dependency_collector" -end +require "extend/os/mac/dependency_collector" if OS.mac? diff --git a/Library/Homebrew/extend/os/language/java.rb b/Library/Homebrew/extend/os/language/java.rb deleted file mode 100644 index 3c1c0372b3..0000000000 --- a/Library/Homebrew/extend/os/language/java.rb +++ /dev/null @@ -1,4 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -require "extend/os/mac/language/java" if OS.mac? diff --git a/Library/Homebrew/extend/os/linux/dependency_collector.rb b/Library/Homebrew/extend/os/linux/dependency_collector.rb deleted file mode 100644 index c019b67f09..0000000000 --- a/Library/Homebrew/extend/os/linux/dependency_collector.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: true -# frozen_string_literal: true - -class DependencyCollector - def java_dep_if_needed(tags) - req = JavaRequirement.new(tags) - begin - dep = Dependency.new("adoptopenjdk", tags) - return dep if dep.installed? - return req if req.satisfied? - - dep - rescue FormulaUnavailableError - req - end - end -end diff --git a/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb b/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb deleted file mode 100644 index aa643d9ffe..0000000000 --- a/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb +++ /dev/null @@ -1,17 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "language/java" - -class JavaRequirement < Requirement - env do - env_java_common - env_oracle_jdk - end - - private - - def oracle_java_os - :linux - end -end diff --git a/Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb b/Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb index 29738ff15d..c3ef502556 100644 --- a/Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb +++ b/Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb @@ -7,7 +7,7 @@ class OsxfuseRequirement < Requirement extend T::Sig def initialize(tags = []) - odeprecated "depends_on :osxfuse", 'on_linux do; depends_on "libfuse"; end' + odisabled "depends_on :osxfuse", 'on_linux do; depends_on "libfuse"; end' super(tags) end diff --git a/Library/Homebrew/extend/os/mac/language/java.rb b/Library/Homebrew/extend/os/mac/language/java.rb deleted file mode 100644 index 0096bb9c91..0000000000 --- a/Library/Homebrew/extend/os/mac/language/java.rb +++ /dev/null @@ -1,30 +0,0 @@ -# typed: true -# frozen_string_literal: true - -module Language - module Java - def self.system_java_home_cmd(version = nil) - version_flag = " --version #{version}" if version - "/usr/libexec/java_home#{version_flag} --failfast 2>/dev/null" - end - private_class_method :system_java_home_cmd - - def self.java_home(version = nil) - f = find_openjdk_formula(version) - return f.opt_libexec/"openjdk.jdk/Contents/Home" if f - - cmd = system_java_home_cmd(version) - path = Utils.popen_read(cmd).chomp - - Pathname.new path if path.present? - end - - def self.java_home_shell(version = nil) - f = find_openjdk_formula(version) - return (f.opt_libexec/"openjdk.jdk/Contents/Home").to_s if f - - "$(#{system_java_home_cmd(version)})" - end - private_class_method :java_home_shell - end -end diff --git a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb deleted file mode 100644 index b0e1576147..0000000000 --- a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb +++ /dev/null @@ -1,36 +0,0 @@ -# typed: false -# frozen_string_literal: true - -class JavaRequirement < Requirement - env do - env_java_common - env_oracle_jdk || env_apple - end - - private - - undef possible_javas, oracle_java_os - - def possible_javas - javas = [] - javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"] - javas << java_home_cmd - which_java = which("java") - # /usr/bin/java is a stub on macOS - javas << which_java if which_java.to_s != "/usr/bin/java" - javas - end - - def oracle_java_os - :darwin - end - - def java_home_cmd - odisabled "depends_on :java", - 'depends_on "openjdk@11", depends_on "openjdk@8" or depends_on "openjdk"' - end - - def env_apple - ENV.append_to_cflags "-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/" - end -end diff --git a/Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb index 613567817d..32bc0be0d5 100644 --- a/Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb +++ b/Library/Homebrew/extend/os/mac/requirements/osxfuse_requirement.rb @@ -7,7 +7,7 @@ class OsxfuseRequirement < Requirement extend T::Sig def initialize(tags = []) - odeprecated "depends_on :osxfuse" + odisabled "depends_on :osxfuse" super(tags) end diff --git a/Library/Homebrew/extend/os/mac/system_config.rb b/Library/Homebrew/extend/os/mac/system_config.rb index 7faa0f7261..d45eb2e0f5 100644 --- a/Library/Homebrew/extend/os/mac/system_config.rb +++ b/Library/Homebrew/extend/os/mac/system_config.rb @@ -7,17 +7,7 @@ module SystemConfig class << self include SystemCommand::Mixin - undef describe_java, describe_homebrew_ruby - - def describe_java - # java_home doesn't exist on all macOSs; it might be missing on older versions. - return "N/A" unless File.executable? "/usr/libexec/java_home" - - result = system_command("/usr/libexec/java_home", args: ["--xml", "--failfast"], print_stderr: false) - return "N/A" unless result.success? - - result.plist.map { |jvm| jvm["JVMVersion"] }.uniq.join(", ") - end + undef describe_homebrew_ruby def describe_homebrew_ruby s = describe_homebrew_ruby_version diff --git a/Library/Homebrew/extend/os/requirements/java_requirement.rb b/Library/Homebrew/extend/os/requirements/java_requirement.rb deleted file mode 100644 index cd6faa271b..0000000000 --- a/Library/Homebrew/extend/os/requirements/java_requirement.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -if OS.mac? - require "extend/os/mac/requirements/java_requirement" -elsif OS.linux? - require "extend/os/linux/requirements/java_requirement" -end diff --git a/Library/Homebrew/language/java.rb b/Library/Homebrew/language/java.rb index a67d52b10e..6b019a6658 100644 --- a/Library/Homebrew/language/java.rb +++ b/Library/Homebrew/language/java.rb @@ -28,13 +28,7 @@ module Language private_class_method :find_openjdk_formula def self.java_home(version = nil) - f = find_openjdk_formula(version) - return f.opt_libexec if f - - req = JavaRequirement.new Array(version) - raise UnsatisfiedRequirements, req.message unless req.satisfied? - - req.java_home + find_openjdk_formula(version)&.opt_libexec end def self.java_home_shell(version = nil) @@ -51,5 +45,3 @@ module Language end end end - -require "extend/os/language/java" diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb index 6b7b8251f8..90941fee76 100644 --- a/Library/Homebrew/requirements.rb +++ b/Library/Homebrew/requirements.rb @@ -4,7 +4,6 @@ require "requirement" require "requirements/arch_requirement" require "requirements/codesign_requirement" -require "requirements/java_requirement" require "requirements/linux_requirement" require "requirements/macos_requirement" require "requirements/osxfuse_requirement" diff --git a/Library/Homebrew/requirements/java_requirement.rb b/Library/Homebrew/requirements/java_requirement.rb deleted file mode 100644 index 2b777b6766..0000000000 --- a/Library/Homebrew/requirements/java_requirement.rb +++ /dev/null @@ -1,169 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "language/java" - -# A requirement on Java. -# -# @api private -class JavaRequirement < Requirement - extend T::Sig - - fatal true - - attr_reader :java_home, :version - - # A strict Java 8 requirement (1.8) should prompt the user to install - # an OpenJDK 1.8 distribution. Versions newer than Java 8 are not - # completely backwards compatible, and contain breaking changes such as - # strong encapsulation of JDK-internal APIs and a modified version scheme - # (*.0 not 1.*). - def suggestion - if fits_latest? - JAVA_SUGGESTION_MAP.fetch(JAVA_SUGGESTION_MAP.keys.max) - else - JAVA_SUGGESTION_MAP.fetch("1.8") - end - end - - satisfy build_env: false do - setup_java - next false unless @java - - next true - end - - def initialize(_tags = []) - odisabled "depends_on :java", - '"depends_on "openjdk@11", "depends_on "openjdk@8" or "depends_on "openjdk"' - super - end - - sig { returns(String) } - def message - version_string = " #{@version}" if @version - s = "Java#{version_string} is required for this software.\n" - s += suggestion - s - end - - sig { returns(String) } - def inspect - "#<#{self.class.name}: version=#{@version.inspect} #{tags.inspect}>" - end - - def display_s - if @version - op = if exact_version? - "=" - else - ">=" - end - "#{name.capitalize} #{op} #{version_without_plus}" - else - name.capitalize - end - end - - private - - CaskSuggestion = Struct.new(:token, :title) do - extend T::Sig - - sig { returns(String) } - def to_str - title_string = " #{title}" if title - <<~EOS - Install#{title_string} with Homebrew Cask: - brew install --cask #{token} - EOS - end - end - - JAVA_SUGGESTION_MAP = { - "1.8" => CaskSuggestion.new( - "homebrew/cask-versions/adoptopenjdk8", - "AdoptOpenJDK 8", - ), - "12.0" => CaskSuggestion.new("adoptopenjdk", "AdoptOpenJDK"), - }.freeze - - def version_without_plus - if exact_version? - @version - else - @version[0, @version.length - 1] - end - end - - def exact_version? - @version && @version.to_s[-1] != "+" - end - - def fits_latest? - @version.nil? || - @version.to_s.end_with?("+") || - @version.to_f >= JAVA_SUGGESTION_MAP.keys.max.to_f - end - - def setup_java - java = preferred_java - return unless java - - @java = java - @java_home = java.parent.parent - end - - def possible_javas - javas = [] - javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"] - javas << which("java") - javas - end - - def preferred_java - possible_javas.find do |java| - next false unless java&.executable? - next true unless @version - next true if satisfies_version(java) - end - end - - def env_java_common - return unless @java_home - - java_home = Pathname.new(@java_home) - ENV["JAVA_HOME"] = java_home - ENV.prepend_path "PATH", java_home/"bin" - end - - def env_oracle_jdk - return unless @java_home - - java_home = Pathname.new(@java_home) - return unless (java_home/"include").exist? - - ENV.append_to_cflags "-I#{java_home}/include" - ENV.append_to_cflags "-I#{java_home}/include/#{oracle_java_os}" - true - end - - def oracle_java_os - nil - end - - def satisfies_version(java) - java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+(\.\d+)?/] - return false unless java_version_s - - java_version = Version.create(java_version_s) - needed_version = Version.create(version_without_plus) - if exact_version? - java_version == needed_version - else - java_version >= needed_version - end - end -end - -require "extend/os/requirements/java_requirement" diff --git a/Library/Homebrew/requirements/tuntap_requirement.rb b/Library/Homebrew/requirements/tuntap_requirement.rb index b059bac0d6..34d2709f40 100644 --- a/Library/Homebrew/requirements/tuntap_requirement.rb +++ b/Library/Homebrew/requirements/tuntap_requirement.rb @@ -10,7 +10,7 @@ class TuntapRequirement < Requirement extend T::Sig def initialize(tags = []) - odeprecated "depends_on :tuntap" + odisabled "depends_on :tuntap" super(tags) end diff --git a/Library/Homebrew/requirements/x11_requirement.rb b/Library/Homebrew/requirements/x11_requirement.rb index eabc6cde47..f33946f3ec 100644 --- a/Library/Homebrew/requirements/x11_requirement.rb +++ b/Library/Homebrew/requirements/x11_requirement.rb @@ -11,7 +11,7 @@ class X11Requirement < Requirement include Comparable def initialize(tags = []) - odeprecated "depends_on :x11", "depends_on specific X11 formula(e)" + odisabled "depends_on :x11", "depends_on specific X11 formula(e)" super(tags) end diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index cbfa6a5328..fba426055f 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -630,20 +630,13 @@ module RuboCop end end - # This cop ensures that new formulae depending on Requirements are not introduced in homebrew/core. - class CoreRequirements < FormulaCop + # This cop ensures that new formulae depending on removed Requirements are not used + class Requirements < FormulaCop def audit_formula(_node, _class_node, _parent_class_node, _body_node) - return if formula_tap != "homebrew-core" - - if depends_on? :java - problem "Formulae in homebrew/core should depend on a versioned `openjdk` instead of :java" - end - - if depends_on? :x11 - problem "Formulae in homebrew/core should depend on specific X libraries instead of :x11" - end - - problem ":osxfuse is deprecated in homebrew/core" if depends_on? :osxfuse + problem "Formulae should depend on a versioned `openjdk` instead of :java" if depends_on? :java + problem "Formulae should depend on specific X libraries instead of :x11" if depends_on? :x11 + problem "Formulae should not depend on :osxfuse" if depends_on? :osxfuse + problem "Formulae should not depend on :tuntap" if depends_on? :tuntap end end diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 0794e77814..0492c08c89 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -356,7 +356,7 @@ class BottleSpecification if [HOMEBREW_DEFAULT_PREFIX, HOMEBREW_MACOS_ARM_DEFAULT_PREFIX, HOMEBREW_LINUX_DEFAULT_PREFIX].exclude?(prefix) - odeprecated "setting 'prefix' for bottles" + odisabled "setting 'prefix' for bottles" end @prefix = prefix end diff --git a/Library/Homebrew/test/.rubocop_todo.yml b/Library/Homebrew/test/.rubocop_todo.yml index 1bc0242833..dd3995cb43 100644 --- a/Library/Homebrew/test/.rubocop_todo.yml +++ b/Library/Homebrew/test/.rubocop_todo.yml @@ -107,7 +107,6 @@ RSpec/NamedSubject: - "cache_store_spec.rb" - "cask/audit_spec.rb" - "cask/cmd/style_spec.rb" - - "cask/cmd_spec.rb" - "cask/dsl/appcast_spec.rb" - "caveats_spec.rb" - "cleaner_spec.rb" diff --git a/Library/Homebrew/test/cask/cmd/audit_spec.rb b/Library/Homebrew/test/cask/cmd/audit_spec.rb index 1357e066b3..8faae5b8fc 100644 --- a/Library/Homebrew/test/cask/cmd/audit_spec.rb +++ b/Library/Homebrew/test/cask/cmd/audit_spec.rb @@ -1,15 +1,12 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/invalid_option" require "cask/auditor" 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" - describe "selection of Casks to audit" do it "audits all Casks if no tokens are given" do allow(Cask::Cask).to receive(:to_a).and_return([cask, cask]) diff --git a/Library/Homebrew/test/cask/cmd/cache_spec.rb b/Library/Homebrew/test/cask/cmd/cache_spec.rb deleted file mode 100644 index 5cde00d829..0000000000 --- a/Library/Homebrew/test/cask/cmd/cache_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Cache, :cask do - let(:local_transmission) { - Cask::CaskLoader.load(cask_path("local-transmission")) - } - - let(:local_caffeine) { - Cask::CaskLoader.load(cask_path("local-caffeine")) - } - - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - - it "prints the file used to cache the Cask" do - transmission_location = CurlDownloadStrategy.new( - local_transmission.url.to_s, local_transmission.token, local_transmission.version, - cache: Cask::Cache.path, **local_transmission.url.specs - ).cached_location - caffeine_location = CurlDownloadStrategy.new( - local_caffeine.url.to_s, local_caffeine.token, local_caffeine.version, - cache: Cask::Cache.path, **local_caffeine.url.specs - ).cached_location - - expect(described_class.cached_location(local_transmission)) - .to eql transmission_location - expect(described_class.cached_location(local_caffeine)) - .to eql caffeine_location - end -end diff --git a/Library/Homebrew/test/cask/cmd/cat_spec.rb b/Library/Homebrew/test/cask/cmd/cat_spec.rb deleted file mode 100644 index ac28d70762..0000000000 --- a/Library/Homebrew/test/cask/cmd/cat_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Cat, :cask do - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - - describe "given a basic Cask" do - let(:basic_cask_content) { - <<~'RUBY' - cask "basic-cask" do - version "1.2.3" - sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" - - url "https://brew.sh/TestCask-#{version}.dmg" - name "Basic Cask" - desc "Cask for testing basic functionality" - homepage "https://brew.sh/" - - app "TestCask.app" - end - RUBY - } - let(:caffeine_content) { - <<~'RUBY' - cask "local-caffeine" do - version "1.2.3" - sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" - - url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - homepage "https://brew.sh/" - - app "Caffeine.app" - end - RUBY - } - - it "displays the Cask file content about the specified Cask" do - expect { - described_class.run("basic-cask") - }.to output(basic_cask_content).to_stdout - end - - it "can display multiple Casks" do - expect { - described_class.run("basic-cask", "local-caffeine") - }.to output(basic_cask_content + caffeine_content).to_stdout - end - end - - it "raises an exception when the Cask does not exist" do - expect { described_class.run("notacask") } - .to raise_error(Cask::CaskUnavailableError, /is unavailable/) - end -end diff --git a/Library/Homebrew/test/cask/cmd/create_spec.rb b/Library/Homebrew/test/cask/cmd/create_spec.rb deleted file mode 100644 index 054d7dca4a..0000000000 --- a/Library/Homebrew/test/cask/cmd/create_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Create, :cask do - around do |example| - example.run - ensure - %w[new-cask additional-cask another-cask yet-another-cask local-caff].each do |cask| - FileUtils.rm_f Cask::CaskLoader.path(cask) - end - end - - before do - allow_any_instance_of(described_class).to receive(:exec_editor) - end - - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - - it "opens the editor for the specified Cask" do - command = described_class.new("new-cask") - expect(command).to receive(:exec_editor).with(Cask::CaskLoader.path("new-cask")) - command.run - end - - it "drops a template down for the specified Cask" do - described_class.run("new-cask") - template = File.read(Cask::CaskLoader.path("new-cask")) - expect(template).to eq <<~RUBY - cask "new-cask" do - version "" - sha256 "" - - url "https://" - name "" - desc "" - homepage "" - - app "" - end - RUBY - end - - it "raises an exception when more than one Cask is given" do - expect { - described_class.run("additional-cask", "another-cask") - }.to raise_error(Homebrew::CLI::NumberOfNamedArgumentsError) - end - - it "raises an exception when the Cask already exists" do - expect { - described_class.run("basic-cask") - }.to raise_error(Cask::CaskAlreadyCreatedError) - end - - it "allows creating Casks that are substrings of existing Casks" do - command = described_class.new("local-caff") - expect(command).to receive(:exec_editor).with(Cask::CaskLoader.path("local-caff")) - command.run - end -end diff --git a/Library/Homebrew/test/cask/cmd/doctor_spec.rb b/Library/Homebrew/test/cask/cmd/doctor_spec.rb deleted file mode 100644 index 1f913b6701..0000000000 --- a/Library/Homebrew/test/cask/cmd/doctor_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Doctor, :cask do - it_behaves_like "a command that handles invalid options" - - it "displays some nice info about the environment" do - expect { - described_class.run - }.to output(/^==> Homebrew Version/).to_stdout - end - - it "raises an exception when arguments are given" do - expect { - described_class.run("argument") - }.to raise_error(UsageError, /does not take named arguments/) - end -end diff --git a/Library/Homebrew/test/cask/cmd/edit_spec.rb b/Library/Homebrew/test/cask/cmd/edit_spec.rb deleted file mode 100644 index 8d86bf4649..0000000000 --- a/Library/Homebrew/test/cask/cmd/edit_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Edit, :cask do - before do - allow_any_instance_of(described_class).to receive(:exec_editor) - end - - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - - it "opens the editor for the specified Cask" do - command = described_class.new("local-caffeine") - expect(command).to receive(:exec_editor).with(Cask::CaskLoader.path("local-caffeine")) - command.run - end - - it "raises an error when given more than one argument" do - expect { - described_class.new("local-caffeine", "local-transmission") - }.to raise_error(Homebrew::CLI::NumberOfNamedArgumentsError) - end - - it "raises an exception when the Cask doesn't exist" do - expect { - described_class.run("notacask") - }.to raise_error(Cask::CaskUnavailableError) - end -end diff --git a/Library/Homebrew/test/cask/cmd/fetch_spec.rb b/Library/Homebrew/test/cask/cmd/fetch_spec.rb index e3d12e9b83..3859514606 100644 --- a/Library/Homebrew/test/cask/cmd/fetch_spec.rb +++ b/Library/Homebrew/test/cask/cmd/fetch_spec.rb @@ -1,9 +1,6 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Fetch, :cask do let(:local_transmission) { Cask::CaskLoader.load(cask_path("local-transmission")) @@ -13,9 +10,6 @@ describe Cask::Cmd::Fetch, :cask do Cask::CaskLoader.load(cask_path("local-caffeine")) } - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - it "allows downloading the installer of a Cask" do transmission_location = CurlDownloadStrategy.new( local_transmission.url.to_s, local_transmission.token, local_transmission.version, diff --git a/Library/Homebrew/test/cask/cmd/home_spec.rb b/Library/Homebrew/test/cask/cmd/home_spec.rb deleted file mode 100644 index 5774a6d59c..0000000000 --- a/Library/Homebrew/test/cask/cmd/home_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Home, :cask do - before do - allow(described_class).to receive(:open_url) - end - - it_behaves_like "a command that handles invalid options" -end diff --git a/Library/Homebrew/test/cask/cmd/info_spec.rb b/Library/Homebrew/test/cask/cmd/info_spec.rb index 00481ced43..c127ff6752 100644 --- a/Library/Homebrew/test/cask/cmd/info_spec.rb +++ b/Library/Homebrew/test/cask/cmd/info_spec.rb @@ -1,14 +1,9 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" require "utils" describe Cask::Cmd::Info, :cask do - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - it "displays some nice info about the specified Cask" do expect { described_class.run("local-transmission") diff --git a/Library/Homebrew/test/cask/cmd/install_spec.rb b/Library/Homebrew/test/cask/cmd/install_spec.rb index 4b2d9d984c..3c5303f668 100644 --- a/Library/Homebrew/test/cask/cmd/install_spec.rb +++ b/Library/Homebrew/test/cask/cmd/install_spec.rb @@ -1,13 +1,7 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Install, :cask do - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - it "displays the installation progress" do output = Regexp.new <<~EOS ==> Downloading file:.*caffeine.zip diff --git a/Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb b/Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb deleted file mode 100644 index 9fe4fbd77b..0000000000 --- a/Library/Homebrew/test/cask/cmd/internal_stanza_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -# typed: false -# frozen_string_literal: true - -describe Cask::Cmd::InternalStanza, :cask do - it "shows stanza of the Specified Cask" do - command = described_class.new("homepage", "local-caffeine") - expect { - command.run - }.to output("https://brew.sh/\n").to_stdout - end - - it "raises an exception when stanza is unknown/unsupported" do - expect { - described_class.new("this_stanza_does_not_exist", "local-caffeine") - }.to raise_error(%r{Unknown/unsupported stanza}) - end - - it "raises an exception when normal stanza is not present on cask" do - command = described_class.new("caveats", "local-caffeine") - expect { - command.run - }.to raise_error(/no such stanza/) - end - - it "raises an exception when artifact stanza is not present on cask" do - command = described_class.new("zap", "local-caffeine") - expect { - command.run - }.to raise_error(/no such stanza/) - end - - it "raises an exception when 'depends_on' stanza is not present on cask" do - command = described_class.new("depends_on", "local-caffeine") - expect { - command.run - }.to raise_error(/no such stanza/) - end - - it "shows all artifact stanzas when using 'artifacts' keyword" do - command = described_class.new("artifacts", "local-caffeine") - expect { - command.run - }.to output(/Caffeine\.app/).to_stdout - end -end diff --git a/Library/Homebrew/test/cask/cmd/list_spec.rb b/Library/Homebrew/test/cask/cmd/list_spec.rb index 8e8adb4070..07ed585a4c 100644 --- a/Library/Homebrew/test/cask/cmd/list_spec.rb +++ b/Library/Homebrew/test/cask/cmd/list_spec.rb @@ -1,11 +1,7 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::List, :cask do - it_behaves_like "a command that handles invalid options" - it "lists the installed Casks in a pretty fashion" do casks = %w[local-caffeine local-transmission].map { |c| Cask::CaskLoader.load(c) } diff --git a/Library/Homebrew/test/cask/cmd/outdated_spec.rb b/Library/Homebrew/test/cask/cmd/outdated_spec.rb deleted file mode 100644 index 6850fd749f..0000000000 --- a/Library/Homebrew/test/cask/cmd/outdated_spec.rb +++ /dev/null @@ -1,197 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Outdated, :cask do - let(:installed) do - [ - Cask::CaskLoader.load(cask_path("basic-cask")), - Cask::CaskLoader.load(cask_path("outdated/local-caffeine")), - Cask::CaskLoader.load(cask_path("outdated/local-transmission")), - Cask::CaskLoader.load(cask_path("version-latest-string")), - Cask::CaskLoader.load(cask_path("outdated/auto-updates")), - ] - end - - before do - installed.each { |cask| InstallHelper.install_with_caskfile(cask) } - end - - it_behaves_like "a command that handles invalid options" - - describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do - it "checks all the installed Casks when no token is provided" do - expect { - described_class.run - }.to output(<<~EOS).to_stdout.as_tty - local-caffeine (1.2.2) != 1.2.3 - local-transmission (2.60) != 2.61 - EOS - end - - it "checks only the tokens specified in the command line" do - expect { - described_class.run("local-caffeine") - }.to output(<<~EOS).to_stdout.as_tty - local-caffeine (1.2.2) != 1.2.3 - EOS - end - - it 'ignores "auto_updates" and "latest" Casks even when their tokens are provided in the command line' do - expect { - described_class.run("local-caffeine", "auto-updates", "version-latest-string") - }.to output(<<~EOS).to_stdout.as_tty - local-caffeine (1.2.2) != 1.2.3 - EOS - end - end - - describe "--quiet overrides TTY" do - it "lists only the names (no versions) of the outdated Casks with --quiet" do - expect { - described_class.run("--quiet") - }.to output(<<~EOS).to_stdout.as_tty - local-caffeine - local-transmission - EOS - end - end - - describe "--quiet overrides --verbose" do - it "lists only the names (no versions) of the outdated Casks with --quiet" do - expect { - described_class.run("--verbose", "--quiet") - }.to output(<<~EOS).to_stdout - local-caffeine - local-transmission - EOS - end - end - - describe "with --greedy it checks additional Casks" do - it 'includes the Casks with "auto_updates true" or "version latest" with --greedy' do - expect { - described_class.run("--greedy") - }.to output(<<~EOS).to_stdout.as_tty - auto-updates (2.57) != 2.61 - local-caffeine (1.2.2) != 1.2.3 - local-transmission (2.60) != 2.61 - version-latest-string (latest) != latest - EOS - end - - it 'does not include the Casks with "auto_updates true" when the version did not change' do - cask = Cask::CaskLoader.load(cask_path("auto-updates")) - InstallHelper.install_with_caskfile(cask) - - expect { - described_class.run("--greedy") - }.to output(<<~EOS).to_stdout.as_tty - local-caffeine (1.2.2) != 1.2.3 - local-transmission (2.60) != 2.61 - version-latest-string (latest) != latest - EOS - end - end - - describe "--json" do - it "lists outdated Casks in JSON format" do - result = [ - { - name: "local-caffeine", - installed_versions: "1.2.2", - current_version: "1.2.3", - }, - { - name: "local-transmission", - installed_versions: "2.60", - current_version: "2.61", - }, - ].to_json - - expect { - described_class.run("--json") - }.to output("#{result}\n").to_stdout - end - end - - describe "--json overrides --quiet" do - it "ignores --quiet and lists outdated Casks in JSON format" do - result = [ - { - name: "local-caffeine", - installed_versions: "1.2.2", - current_version: "1.2.3", - }, - { - name: "local-transmission", - installed_versions: "2.60", - current_version: "2.61", - }, - ].to_json - - expect { - described_class.run("--json", "--quiet") - }.to output("#{result}\n").to_stdout - end - end - - describe "--json and --greedy" do - it 'includes the Casks with "auto_updates true" or "version latest" in JSON format' do - result = [ - { - name: "auto-updates", - installed_versions: "2.57", - current_version: "2.61", - }, - { - name: "local-caffeine", - installed_versions: "1.2.2", - current_version: "1.2.3", - }, - { - name: "local-transmission", - installed_versions: "2.60", - current_version: "2.61", - }, - { - name: "version-latest-string", - installed_versions: "latest", - current_version: "latest", - }, - ].to_json - - expect { - described_class.run("--json", "--greedy") - }.to output("#{result}\n").to_stdout - end - - it 'does not include the Casks with "auto_updates true" with no version change in JSON format' do - cask = Cask::CaskLoader.load(cask_path("auto-updates")) - InstallHelper.install_with_caskfile(cask) - - result = [ - { - name: "local-caffeine", - installed_versions: "1.2.2", - current_version: "1.2.3", - }, - { - name: "local-transmission", - installed_versions: "2.60", - current_version: "2.61", - }, - { - name: "version-latest-string", - installed_versions: "latest", - current_version: "latest", - }, - ].to_json - - expect { - described_class.run("--json", "--greedy") - }.to output("#{result}\n").to_stdout - end - end -end diff --git a/Library/Homebrew/test/cask/cmd/reinstall_spec.rb b/Library/Homebrew/test/cask/cmd/reinstall_spec.rb index 9dae6d6720..013b90b7cc 100644 --- a/Library/Homebrew/test/cask/cmd/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/cmd/reinstall_spec.rb @@ -1,11 +1,7 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Reinstall, :cask do - it_behaves_like "a command that handles invalid options" - it "displays the reinstallation progress" do caffeine = Cask::CaskLoader.load(cask_path("local-caffeine")) diff --git a/Library/Homebrew/test/cask/cmd/shared_examples/invalid_option.rb b/Library/Homebrew/test/cask/cmd/shared_examples/invalid_option.rb deleted file mode 100644 index f344ba7703..0000000000 --- a/Library/Homebrew/test/cask/cmd/shared_examples/invalid_option.rb +++ /dev/null @@ -1,18 +0,0 @@ -# typed: false -# frozen_string_literal: true - -shared_examples "a command that handles invalid options" do - context "when an invalid option is specified" do - it "raises an exception when no Cask is specified" do - expect { - described_class.run("--not-a-valid-option") - }.to raise_error("invalid option: --not-a-valid-option") - end - - it "raises an exception when a Cask is specified" do - expect { - described_class.run("--not-a-valid-option", "basic-cask") - }.to raise_error("invalid option: --not-a-valid-option") - end - end -end diff --git a/Library/Homebrew/test/cask/cmd/shared_examples/requires_cask_token.rb b/Library/Homebrew/test/cask/cmd/shared_examples/requires_cask_token.rb deleted file mode 100644 index bfb750ab1e..0000000000 --- a/Library/Homebrew/test/cask/cmd/shared_examples/requires_cask_token.rb +++ /dev/null @@ -1,12 +0,0 @@ -# typed: false -# frozen_string_literal: true - -shared_examples "a command that requires a Cask token" do - context "when no Cask is specified" do - it "raises an exception " do - expect { - described_class.run - }.to raise_error(UsageError, /This command requires .*cask.* argument/) - end - end -end diff --git a/Library/Homebrew/test/cask/cmd/style_spec.rb b/Library/Homebrew/test/cask/cmd/style_spec.rb deleted file mode 100644 index 86c23425c7..0000000000 --- a/Library/Homebrew/test/cask/cmd/style_spec.rb +++ /dev/null @@ -1,86 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "open3" - -require "cli/args" -require "cli/named_args" - -require_relative "shared_examples/invalid_option" - -describe Cask::Cmd::Style, :cask do - let(:args) { [] } - let(:cli) { described_class.new(*args) } - - it_behaves_like "a command that handles invalid options" - - describe "::run" do - subject { described_class.rubocop(cask_path) } - - context "with a valid Cask" do - let(:cask_path) do - Pathname.new("#{HOMEBREW_LIBRARY_PATH}/test/support/fixtures/cask/Casks/version-latest.rb") - end - - it "is successful" do - expect { - described_class.run(cask_path) - }.not_to raise_error - end - end - end - - describe "#cask_paths" do - subject { cli.cask_paths } - - before do - args = instance_double(Homebrew::CLI::Args, named: Homebrew::CLI::NamedArgs.new(*tokens)) - allow(cli).to receive(:args).and_return(args) - end - - context "when no cask tokens are given" do - let(:tokens) { [] } - - matcher :a_path_ending_with do |end_string| - match do |actual| - expect(actual.to_s).to end_with(end_string) - end - end - - it { - expect(subject).to contain_exactly( - a_path_ending_with("/homebrew/homebrew-cask/Casks"), - a_path_ending_with("/third-party/homebrew-tap/Casks"), - ) - } - end - - context "when at least one cask token is a path that exists" do - let(:tokens) { ["adium", "Casks/dropbox.rb"] } - - before do - allow(File).to receive(:exist?).and_return(false, true) - end - - it "treats all tokens as paths" do - expect(subject).to eq [ - Pathname("adium").expand_path, - Pathname("Casks/dropbox.rb").expand_path, - ] - end - end - - context "when no cask tokens are paths that exist" do - let(:tokens) { %w[adium dropbox] } - - before do - allow(File).to receive(:exist?).and_return(false) - end - - it "tries to find paths for all tokens" do - expect(Cask::CaskLoader).to receive(:load).twice.and_return(instance_double(Cask::Cask, sourcefile_path: nil)) - subject - end - end - end -end diff --git a/Library/Homebrew/test/cask/cmd/uninstall_spec.rb b/Library/Homebrew/test/cask/cmd/uninstall_spec.rb index 703b9c7443..8af07bd9b7 100644 --- a/Library/Homebrew/test/cask/cmd/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cmd/uninstall_spec.rb @@ -1,13 +1,7 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Uninstall, :cask do - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - it "displays the uninstallation progress" do caffeine = Cask::CaskLoader.load(cask_path("local-caffeine")) diff --git a/Library/Homebrew/test/cask/cmd/upgrade_spec.rb b/Library/Homebrew/test/cask/cmd/upgrade_spec.rb index 4c9f1a3197..2db6976522 100644 --- a/Library/Homebrew/test/cask/cmd/upgrade_spec.rb +++ b/Library/Homebrew/test/cask/cmd/upgrade_spec.rb @@ -1,8 +1,6 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Upgrade, :cask do let(:version_latest_path_2) { version_latest.config.appdir.join("Caffeine Pro.app") } let(:version_latest_path_1) { version_latest.config.appdir.join("Caffeine Mini.app") } @@ -14,8 +12,6 @@ describe Cask::Cmd::Upgrade, :cask do let(:local_caffeine_path) { local_caffeine.config.appdir.join("Caffeine.app") } let(:local_caffeine) { Cask::CaskLoader.load("local-caffeine") } - it_behaves_like "a command that handles invalid options" - context "successful upgrade" do let(:installed) { [ diff --git a/Library/Homebrew/test/cask/cmd/zap_spec.rb b/Library/Homebrew/test/cask/cmd/zap_spec.rb index f5549f6f9e..799efdf982 100644 --- a/Library/Homebrew/test/cask/cmd/zap_spec.rb +++ b/Library/Homebrew/test/cask/cmd/zap_spec.rb @@ -1,13 +1,7 @@ # typed: false # frozen_string_literal: true -require_relative "shared_examples/requires_cask_token" -require_relative "shared_examples/invalid_option" - describe Cask::Cmd::Zap, :cask do - it_behaves_like "a command that requires a Cask token" - it_behaves_like "a command that handles invalid options" - it "shows an error when a bad Cask is provided" do expect { described_class.run("notacask") } .to raise_error(Cask::CaskUnavailableError, /is unavailable/) diff --git a/Library/Homebrew/test/cask/cmd_spec.rb b/Library/Homebrew/test/cask/cmd_spec.rb deleted file mode 100644 index d1385d7a3d..0000000000 --- a/Library/Homebrew/test/cask/cmd_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# typed: false -# frozen_string_literal: true - -describe Cask::Cmd, :cask do - context "when no subcommand is given" do - it "raises an error" do - expect { subject.run }.to raise_error(UsageError, /subcommand/) - end - end - - context "::run" do - let(:noop_command) { double("Cmd::Noop", run: nil) } - - before do - allow(Homebrew).to receive(:raise_deprecation_exceptions?).and_return(false) - end - - it "exits with a status of 1 when something goes wrong" do - allow(described_class).to receive(:lookup_command).and_raise(Cask::CaskError) - command = described_class.new("noop") - expect(command).to receive(:exit).with(1) - command.run - end - end - - it "provides a help message for all commands" do - described_class.command_classes.each do |command_class| - expect(command_class.help).to match(/\w+/), command_class.name - end - end -end diff --git a/Library/Homebrew/test/cask/dsl/appcast_spec.rb b/Library/Homebrew/test/cask/dsl/appcast_spec.rb index ac7c1f6643..692738b9e1 100644 --- a/Library/Homebrew/test/cask/dsl/appcast_spec.rb +++ b/Library/Homebrew/test/cask/dsl/appcast_spec.rb @@ -1,8 +1,6 @@ # typed: false # frozen_string_literal: true -require "cmd/cask" - describe Cask::DSL::Appcast do subject { described_class.new(url, params) } diff --git a/Library/Homebrew/test/cli/parser_spec.rb b/Library/Homebrew/test/cli/parser_spec.rb index c50c9fe2f7..042c843dc6 100644 --- a/Library/Homebrew/test/cli/parser_spec.rb +++ b/Library/Homebrew/test/cli/parser_spec.rb @@ -529,73 +529,4 @@ describe Homebrew::CLI::Parser do ) end end - - describe "named" do - subject(:parser) { - described_class.new do - named 1 - end - } - - it "allows the specified number of arguments" do - expect { parser.parse(["foo"]) }.not_to raise_error - end - - it "doesn't allow less than the specified number of arguments" do - expect { parser.parse([]) }.to raise_error(Homebrew::CLI::NumberOfNamedArgumentsError) - end - - it "treats a symbol as a single argument of the specified type" do - formula_parser = described_class.new do - named :formula - end - expect { formula_parser.parse([]) }.to raise_error( - Homebrew::CLI::NumberOfNamedArgumentsError, /This command requires exactly 1 formula argument/ - ) - end - - it "doesn't allow more than the specified number of arguments" do - expect { parser.parse(["foo", "bar"]) }.to raise_error(Homebrew::CLI::NumberOfNamedArgumentsError) - end - end - - describe "min_named" do - subject(:parser) { - described_class.new do - min_named 1 - end - } - - it "doesn't allow less than the minimum number of arguments" do - expect { parser.parse([]) }.to raise_error(Homebrew::CLI::MinNamedArgumentsError) - end - - it "allows the minimum number of arguments" do - expect { parser.parse(["foo"]) }.not_to raise_error - end - - it "allows more than the specified number of arguments" do - expect { parser.parse(["foo", "bar"]) }.not_to raise_error - end - end - - describe "max_named" do - subject(:parser) { - described_class.new do - max_named 1 - end - } - - it "doesn't allow more than the minimum number of arguments" do - expect { parser.parse(["foo", "bar"]) }.to raise_error(Homebrew::CLI::MaxNamedArgumentsError) - end - - it "allows the minimum number of arguments" do - expect { parser.parse(["foo"]) }.not_to raise_error - end - - it "allows less than the specified number of arguments" do - expect { parser.parse([]) }.not_to raise_error - end - end end diff --git a/Library/Homebrew/test/cmd/switch_spec.rb b/Library/Homebrew/test/cmd/switch_spec.rb deleted file mode 100644 index 8ad0ceb4c7..0000000000 --- a/Library/Homebrew/test/cmd/switch_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "cmd/shared_examples/args_parse" - -describe "Homebrew.switch_args" do - it_behaves_like "parseable arguments" -end diff --git a/Library/Homebrew/test/dev-cmd/diy_spec.rb b/Library/Homebrew/test/dev-cmd/diy_spec.rb deleted file mode 100644 index eafc466f31..0000000000 --- a/Library/Homebrew/test/dev-cmd/diy_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: false -# frozen_string_literal: true - -require "cmd/shared_examples/args_parse" - -describe "Homebrew.diy_args" do - it_behaves_like "parseable arguments" -end diff --git a/Library/Homebrew/test/language/java_spec.rb b/Library/Homebrew/test/language/java_spec.rb index ccabd4a0f4..bd41accf0f 100644 --- a/Library/Homebrew/test/language/java_spec.rb +++ b/Library/Homebrew/test/language/java_spec.rb @@ -4,41 +4,52 @@ require "language/java" describe Language::Java do + let(:f) do + formula("openjdk") do + url "openjdk" + version "15.0.1" + end + end + + before do + allow(Formula).to receive(:[]).and_return(f) + allow(f).to receive(:any_version_installed?).and_return(true) + allow(f).to receive(:any_installed_version).and_return(f.version) + end + describe "::java_home" do - if !OS.mac? || MacOS.version < :big_sur - it "returns valid JAVA_HOME if version is specified", :needs_macos do - java_home = described_class.java_home("1.6+") - expect(java_home/"bin/java").to be_an_executable - end + it "returns valid JAVA_HOME if version is specified" do + java_home = described_class.java_home("1.8+") + expect(java_home).to eql(f.opt_libexec) end - it "returns valid JAVA_HOME if version is not specified", :needs_macos do + it "returns valid JAVA_HOME if version is not specified" do java_home = described_class.java_home - expect(java_home/"bin/java").to be_an_executable + expect(java_home).to eql(f.opt_libexec) end end describe "::java_home_env" do - it "returns java_home path with version if version specified", :needs_macos do - java_home = described_class.java_home_env("blah") - expect(java_home[:JAVA_HOME]).to include("--version blah") + it "returns java_home path if version specified" do + java_home_env = described_class.java_home_env("1.8+") + expect(java_home_env[:JAVA_HOME]).to eql(f.opt_libexec.to_s) end - it "returns java_home path without version if version is not specified", :needs_macos do - java_home = described_class.java_home_env - expect(java_home[:JAVA_HOME]).not_to include("--version") + it "returns java_home path if version is not specified" do + java_home_env = described_class.java_home_env + expect(java_home_env[:JAVA_HOME]).to eql(f.opt_libexec.to_s) end end describe "::overridable_java_home_env" do - it "returns java_home path with version if version specified", :needs_macos do - java_home = described_class.overridable_java_home_env("blah") - expect(java_home[:JAVA_HOME]).to include("--version blah") + it "returns java_home path if version specified" do + overridable_java_home_env = described_class.overridable_java_home_env("1.8+") + expect(overridable_java_home_env[:JAVA_HOME]).to eql("${JAVA_HOME:-#{f.opt_libexec}}") end - it "returns java_home path without version if version is not specified", :needs_macos do - java_home = described_class.overridable_java_home_env - expect(java_home[:JAVA_HOME]).not_to include("--version") + it "returns java_home path if version is not specified" do + overridable_java_home_env = described_class.overridable_java_home_env + expect(overridable_java_home_env[:JAVA_HOME]).to eql("${JAVA_HOME:-#{f.opt_libexec}}") end end end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index df5a9906d3..7b7b3bfe3c 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -123,13 +123,7 @@ RSpec.configure do |config| end config.before(:each, :needs_java) do - java_installed = if OS.mac? - Utils.popen_read("/usr/libexec/java_home", "--failfast") - $CHILD_STATUS.success? - else - which("java") - end - skip "Java is not installed." unless java_installed + skip "Java is not installed." unless which("java") end config.before(:each, :needs_python) do diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index f0653ac84c..536bd01d33 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -88,10 +88,6 @@ module Utils Utils.popen_read(git, "-C", repo, "show", "#{commit}:#{relative_file}") end - def commit_message(_repo, _commit = nil) - odisabled "Utils::Git.commit_message(repo)", "Pathname(repo).git_commit_message" - end - def ensure_installed! return if available? @@ -133,14 +129,6 @@ module Utils .prepend(Formula["gnupg"].opt_bin) end - def origin_branch(_repo) - odisabled "Utils::Git.origin_branch(repo)", "Pathname(repo).git_origin_branch" - end - - def current_branch(_repo) - odisabled "Utils::Git.current_branch(repo)", "Pathname(repo).git_branch" - end - # Special case of `git cherry-pick` that permits non-verbose output and # optional resolution on merge conflict. def cherry_pick!(repo, *args, resolve: false, verbose: false) diff --git a/completions/bash/brew b/completions/bash/brew index 8d89f2fedb..cb73eb76c7 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -537,36 +537,6 @@ _brew_bump_unversioned_casks() { __brew_complete_tapped } -_brew_cask() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - -*) - __brewcomp " - --appdir - --audio-unit-plugindir - --colorpickerdir - --debug - --dictionarydir - --fontdir - --help - --input-methoddir - --internet-plugindir - --language - --mdimporterdir - --prefpanedir - --qlplugindir - --quiet - --screen-saverdir - --servicedir - --verbose - --vst-plugindir - --vst3-plugindir - " - return - ;; - esac -} - _brew_cat() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in @@ -670,23 +640,6 @@ _brew_config() { esac } -_brew_configure() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - -*) - __brewcomp " - --debug - --help - --name - --quiet - --verbose - --version - " - return - ;; - esac -} - _brew_create() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in @@ -793,23 +746,6 @@ _brew_dispatch_build_bottle() { __brew_complete_formulae } -_brew_diy() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - -*) - __brewcomp " - --debug - --help - --name - --quiet - --verbose - --version - " - return - ;; - esac -} - _brew_doctor() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in @@ -1845,21 +1781,6 @@ _brew_style() { __brew_complete_casks } -_brew_switch() { - local cur="${COMP_WORDS[COMP_CWORD]}" - case "$cur" in - -*) - __brewcomp " - --debug - --help - --quiet - --verbose - " - return - ;; - esac -} - _brew_tap() { local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in @@ -2385,19 +2306,16 @@ _brew() { bump-formula-pr) _brew_bump_formula_pr ;; bump-revision) _brew_bump_revision ;; bump-unversioned-casks) _brew_bump_unversioned_casks ;; - cask) _brew_cask ;; cat) _brew_cat ;; cleanup) _brew_cleanup ;; command) _brew_command ;; commands) _brew_commands ;; completions) _brew_completions ;; config) _brew_config ;; - configure) _brew_configure ;; create) _brew_create ;; deps) _brew_deps ;; desc) _brew_desc ;; dispatch-build-bottle) _brew_dispatch_build_bottle ;; - diy) _brew_diy ;; doctor) _brew_doctor ;; dr) _brew_dr ;; edit) _brew_edit ;; @@ -2445,7 +2363,6 @@ _brew() { sh) _brew_sh ;; sponsors) _brew_sponsors ;; style) _brew_style ;; - switch) _brew_switch ;; tap) _brew_tap ;; tap-info) _brew_tap_info ;; tap-new) _brew_tap_new ;; diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index c3775eec9e..1f3309844f 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -461,28 +461,6 @@ __fish_brew_complete_arg 'bump-unversioned-casks' -a '(__fish_brew_suggest_casks __fish_brew_complete_arg 'bump-unversioned-casks' -a '(__fish_brew_suggest_taps_installed)' -__fish_brew_complete_cmd 'cask' 'Homebrew Cask provides a friendly CLI workflow for the administration of macOS applications distributed as binaries' -__fish_brew_complete_arg 'cask' -l appdir -d 'Target location for Applications (default: `/Applications`)' -__fish_brew_complete_arg 'cask' -l audio-unit-plugindir -d 'Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)' -__fish_brew_complete_arg 'cask' -l colorpickerdir -d 'Target location for Color Pickers (default: `~/Library/ColorPickers`)' -__fish_brew_complete_arg 'cask' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'cask' -l dictionarydir -d 'Target location for Dictionaries (default: `~/Library/Dictionaries`)' -__fish_brew_complete_arg 'cask' -l fontdir -d 'Target location for Fonts (default: `~/Library/Fonts`)' -__fish_brew_complete_arg 'cask' -l help -d 'Show this message' -__fish_brew_complete_arg 'cask' -l input-methoddir -d 'Target location for Input Methods (default: `~/Library/Input Methods`)' -__fish_brew_complete_arg 'cask' -l internet-plugindir -d 'Target location for Internet Plugins (default: `~/Library/Internet Plug-Ins`)' -__fish_brew_complete_arg 'cask' -l language -d 'Comma-separated list of language codes to prefer for cask installation. The first matching language is used, otherwise it reverts to the cask\'s default language. The default value is the language of your system' -__fish_brew_complete_arg 'cask' -l mdimporterdir -d 'Target location for Spotlight Plugins (default: `~/Library/Spotlight`)' -__fish_brew_complete_arg 'cask' -l prefpanedir -d 'Target location for Preference Panes (default: `~/Library/PreferencePanes`)' -__fish_brew_complete_arg 'cask' -l qlplugindir -d 'Target location for QuickLook Plugins (default: `~/Library/QuickLook`)' -__fish_brew_complete_arg 'cask' -l quiet -d 'Make some output more quiet' -__fish_brew_complete_arg 'cask' -l screen-saverdir -d 'Target location for Screen Savers (default: `~/Library/Screen Savers`)' -__fish_brew_complete_arg 'cask' -l servicedir -d 'Target location for Services (default: `~/Library/Services`)' -__fish_brew_complete_arg 'cask' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_arg 'cask' -l vst-plugindir -d 'Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)' -__fish_brew_complete_arg 'cask' -l vst3-plugindir -d 'Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)' - - __fish_brew_complete_cmd 'cat' 'Display the source of a formula or cask' __fish_brew_complete_arg 'cat' -l cask -d 'Treat all named arguments as casks' __fish_brew_complete_arg 'cat' -l debug -d 'Display any debugging information' @@ -540,15 +518,6 @@ __fish_brew_complete_arg 'config' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'config' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_cmd 'configure' 'Automatically determine the installation prefix for non-Homebrew software' -__fish_brew_complete_arg 'configure' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'configure' -l help -d 'Show this message' -__fish_brew_complete_arg 'configure' -l name -d 'Explicitly set the name of the package being installed' -__fish_brew_complete_arg 'configure' -l quiet -d 'Make some output more quiet' -__fish_brew_complete_arg 'configure' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_arg 'configure' -l version -d 'Explicitly set the version of the package being installed' - - __fish_brew_complete_cmd 'create' 'Generate a formula or, with `--cask`, a cask for the downloadable file at URL and open it in the editor' __fish_brew_complete_arg 'create' -l HEAD -d 'Indicate that URL points to the package\'s repository rather than a file' __fish_brew_complete_arg 'create' -l autotools -d 'Create a basic template for an Autotools-style build' @@ -623,15 +592,6 @@ __fish_brew_complete_arg 'dispatch-build-bottle' -l workflow -d 'Dispatch specif __fish_brew_complete_arg 'dispatch-build-bottle' -a '(__fish_brew_suggest_formulae_all)' -__fish_brew_complete_cmd 'diy' 'Automatically determine the installation prefix for non-Homebrew software' -__fish_brew_complete_arg 'diy' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'diy' -l help -d 'Show this message' -__fish_brew_complete_arg 'diy' -l name -d 'Explicitly set the name of the package being installed' -__fish_brew_complete_arg 'diy' -l quiet -d 'Make some output more quiet' -__fish_brew_complete_arg 'diy' -l verbose -d 'Make some output more verbose' -__fish_brew_complete_arg 'diy' -l version -d 'Explicitly set the version of the package being installed' - - __fish_brew_complete_cmd 'doctor' 'Check your system for potential problems' __fish_brew_complete_arg 'doctor' -l audit-debug -d 'Enable debugging and profiling of audit methods' __fish_brew_complete_arg 'doctor' -l debug -d 'Display any debugging information' @@ -1288,13 +1248,6 @@ __fish_brew_complete_arg 'style' -a '(__fish_brew_suggest_formulae_all)' __fish_brew_complete_arg 'style' -a '(__fish_brew_suggest_casks_all)' -__fish_brew_complete_cmd 'switch' 'Symlink all of the specified version of formula\'s installation into Homebrew\'s prefix' -__fish_brew_complete_arg 'switch' -l debug -d 'Display any debugging information' -__fish_brew_complete_arg 'switch' -l help -d 'Show this message' -__fish_brew_complete_arg 'switch' -l quiet -d 'Make some output more quiet' -__fish_brew_complete_arg 'switch' -l verbose -d 'Make some output more verbose' - - __fish_brew_complete_cmd 'tap' 'Tap a formula repository' __fish_brew_complete_arg 'tap' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'tap' -l force-auto-update -d 'Auto-update tap even if it is not hosted on GitHub. By default, only taps hosted on GitHub are auto-updated (for performance reasons)' diff --git a/completions/internal_commands_list.txt b/completions/internal_commands_list.txt index c258fbd350..b1d36a5ddc 100644 --- a/completions/internal_commands_list.txt +++ b/completions/internal_commands_list.txt @@ -19,7 +19,6 @@ bump-cask-pr bump-formula-pr bump-revision bump-unversioned-casks -cask casks cat cleanup @@ -32,7 +31,6 @@ create deps desc dispatch-build-bottle -diy doctor dr edit @@ -83,7 +81,6 @@ sh shellenv sponsors style -switch tap tap-info tap-new diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 766c32adee..b9453ac6b8 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -145,7 +145,6 @@ __brew_internal_commands() { 'bump-formula-pr:Create a pull request to update formula with a new URL or a new tag' 'bump-revision:Create a commit to increment the revision of formula' 'bump-unversioned-casks:Check all casks with unversioned URLs in a given tap for updates' - 'cask:Homebrew Cask provides a friendly CLI workflow for the administration of macOS applications distributed as binaries' 'casks:List all locally installable casks including short names' 'cat:Display the source of a formula or cask' 'cleanup:Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae' @@ -157,7 +156,6 @@ __brew_internal_commands() { 'deps:Show dependencies for formula' 'desc:Display formula'\''s name and one-line description' 'dispatch-build-bottle:Build bottles for these formulae with GitHub Actions' - 'diy:Automatically determine the installation prefix for non-Homebrew software' 'doctor:Check your system for potential problems' 'edit:Open a formula or cask in the editor set by `EDITOR` or `HOMEBREW_EDITOR`, or open the Homebrew repository for editing if no formula is provided' 'extract:Look through repository history to find the most recent version of formula and create a copy in tap' @@ -200,7 +198,6 @@ __brew_internal_commands() { 'shellenv:Print export statements' 'sponsors:Print a Markdown summary of Homebrew'\''s GitHub Sponsors, suitable for pasting into a README' 'style:Check formulae or files for conformance to Homebrew style guidelines' - 'switch:Symlink all of the specified version of formula'\''s installation into Homebrew'\''s prefix' 'tap:Tap a formula repository' 'tap-info:Show detailed information about one or more taps' 'tap-new:Generate the template files for a new tap' @@ -553,30 +550,6 @@ _brew_bump_unversioned_casks() { '::tap:__brew_any_tap' } -# brew cask -_brew_cask() { - _arguments \ - '(--formula)--appdir[Target location for Applications (default: `/Applications`)]' \ - '(--formula)--audio-unit-plugindir[Target location for Audio Unit Plugins (default: `~/Library/Audio/Plug-Ins/Components`)]' \ - '(--formula)--colorpickerdir[Target location for Color Pickers (default: `~/Library/ColorPickers`)]' \ - '--debug[Display any debugging information]' \ - '(--formula)--dictionarydir[Target location for Dictionaries (default: `~/Library/Dictionaries`)]' \ - '(--formula)--fontdir[Target location for Fonts (default: `~/Library/Fonts`)]' \ - '--help[Show this message]' \ - '(--formula)--input-methoddir[Target location for Input Methods (default: `~/Library/Input Methods`)]' \ - '(--formula)--internet-plugindir[Target location for Internet Plugins (default: `~/Library/Internet Plug-Ins`)]' \ - '(--formula)--language[Comma-separated list of language codes to prefer for cask installation. The first matching language is used, otherwise it reverts to the cask'\''s default language. The default value is the language of your system]' \ - '(--formula)--mdimporterdir[Target location for Spotlight Plugins (default: `~/Library/Spotlight`)]' \ - '(--formula)--prefpanedir[Target location for Preference Panes (default: `~/Library/PreferencePanes`)]' \ - '(--formula)--qlplugindir[Target location for QuickLook Plugins (default: `~/Library/QuickLook`)]' \ - '--quiet[Make some output more quiet]' \ - '(--formula)--screen-saverdir[Target location for Screen Savers (default: `~/Library/Screen Savers`)]' \ - '(--formula)--servicedir[Target location for Services (default: `~/Library/Services`)]' \ - '--verbose[Make some output more verbose]' \ - '(--formula)--vst-plugindir[Target location for VST Plugins (default: `~/Library/Audio/Plug-Ins/VST`)]' \ - '(--formula)--vst3-plugindir[Target location for VST3 Plugins (default: `~/Library/Audio/Plug-Ins/VST3`)]' -} - # brew cat _brew_cat() { _arguments \ @@ -644,17 +617,6 @@ _brew_config() { '--verbose[Make some output more verbose]' } -# brew configure -_brew_configure() { - _arguments \ - '--debug[Display any debugging information]' \ - '--help[Show this message]' \ - '--name[Explicitly set the name of the package being installed]' \ - '--quiet[Make some output more quiet]' \ - '--verbose[Make some output more verbose]' \ - '--version[Explicitly set the version of the package being installed]' -} - # brew create _brew_create() { _arguments \ @@ -737,17 +699,6 @@ _brew_dispatch_build_bottle() { '::formula:__brew_formulae' } -# brew diy -_brew_diy() { - _arguments \ - '--debug[Display any debugging information]' \ - '--help[Show this message]' \ - '--name[Explicitly set the name of the package being installed]' \ - '--quiet[Make some output more quiet]' \ - '--verbose[Make some output more verbose]' \ - '--version[Explicitly set the version of the package being installed]' -} - # brew doctor _brew_doctor() { _arguments \ @@ -1501,15 +1452,6 @@ _brew_style() { '::cask:__brew_casks' } -# brew switch -_brew_switch() { - _arguments \ - '--debug[Display any debugging information]' \ - '--help[Show this message]' \ - '--quiet[Make some output more quiet]' \ - '--verbose[Make some output more verbose]' -} - # brew tap _brew_tap() { _arguments \ diff --git a/docs/Manpage.md b/docs/Manpage.md index a596822af1..ec8ee3f98c 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1225,19 +1225,6 @@ Requires write access to the Homebrew/brew repository. * `--minor`: Create a minor release. -### `release-notes` [*`options`*] [*`previous_tag`*] [*`end_ref`*] - -Print the merged pull requests on Homebrew/brew between two Git refs. -If no *`previous_tag`* is provided it defaults to the latest tag. -If no *`end_ref`* is provided it defaults to `origin/master`. - -If `--markdown` and a *`previous_tag`* are passed, an extra line containing -a link to the Homebrew blog will be adding to the output. Additionally, -a warning will be shown if the latest minor release was less than one month ago. - -* `--markdown`: - Print as a Markdown list. - ### `rubocop` Installs, configures and runs Homebrew's `rubocop`. diff --git a/manpages/brew.1 b/manpages/brew.1 index d5ec73d453..164452d298 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1703,16 +1703,6 @@ Create a major release\. \fB\-\-minor\fR Create a minor release\. . -.SS "\fBrelease\-notes\fR [\fIoptions\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]" -Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. -. -.P -If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containing a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\. -. -.TP -\fB\-\-markdown\fR -Print as a Markdown list\. -. .SS "\fBrubocop\fR" Installs, configures and runs Homebrew\'s \fBrubocop\fR\. .