diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 01a6d8819b35e..0376d206f976b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -112,7 +112,6 @@ Layout/LineLength: ' url "', ' mirror "', " plist_options ", - ' appcast "', ' executable: "', ' font "', ' homepage "', diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 77deaf1a23d77..a8a34133c5fee 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -289,7 +289,7 @@ def audit_latest_with_auto_updates sig { params(livecheck_result: T.any(NilClass, T::Boolean, Symbol)).void } def audit_hosting_with_livecheck(livecheck_result: audit_livecheck_version) - return if cask.discontinued? || cask.deprecated? || cask.disabled? + return if cask.deprecated? || cask.disabled? return if cask.version&.latest? return unless cask.url return if block_url_offline? @@ -682,7 +682,7 @@ def audit_gitlab_prerelease_version sig { void } def audit_github_repository_archived # Deprecated/disabled casks may have an archived repository. - return if cask.discontinued? || cask.deprecated? || cask.disabled? + return if cask.deprecated? || cask.disabled? user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if online? return if user.nil? @@ -696,7 +696,7 @@ def audit_github_repository_archived sig { void } def audit_gitlab_repository_archived # Deprecated/disabled casks may have an archived repository. - return if cask.discontinued? || cask.deprecated? || cask.disabled? + return if cask.deprecated? || cask.disabled? user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if online? return if user.nil? diff --git a/Library/Homebrew/cask/cask_loader.rb b/Library/Homebrew/cask/cask_loader.rb index b92b06e38f53a..faa8b63edc389 100644 --- a/Library/Homebrew/cask/cask_loader.rb +++ b/Library/Homebrew/cask/cask_loader.rb @@ -315,7 +315,6 @@ def load(config:) end url json_cask[:url], **json_cask.fetch(:url_specs, {}) if json_cask[:url].present? - appcast json_cask[:appcast] if json_cask[:appcast].present? json_cask[:name]&.each do |cask_name| name cask_name end diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 62dee57438211..d9ae0f529b34b 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -248,16 +248,6 @@ def url(*args, **options, &block) end end - # Sets the cask's appcast URL. - # - # @api public - def appcast(*args, **kwargs) - set_unique_stanza(:appcast, args.empty? && kwargs.empty?) do - odisabled "the `appcast` stanza", "the `livecheck` stanza" - true - end - end - # Sets the cask's container type or nested container path. # # ### Examples @@ -417,7 +407,7 @@ def caveats(*strings, &block) end def discontinued? - # odeprecated "`discontinued?`", "`deprecated?` or `disabled?`" + odeprecated "`discontinued?`", "`deprecated?` or `disabled?`" @caveats&.discontinued? == true end diff --git a/Library/Homebrew/cask/dsl/caveats.rb b/Library/Homebrew/cask/dsl/caveats.rb index 599675380706b..865b9ada10272 100644 --- a/Library/Homebrew/cask/dsl/caveats.rb +++ b/Library/Homebrew/cask/dsl/caveats.rb @@ -164,7 +164,7 @@ def eval_caveats(&block) end caveat :discontinued do - # odeprecated "`caveats :discontinued`", "`deprecate!`" + odeprecated "`caveats :discontinued`", "`deprecate!`" @discontinued = true <<~EOS #{@cask} has been officially discontinued upstream. diff --git a/Library/Homebrew/cask/dsl/postflight.rb b/Library/Homebrew/cask/dsl/postflight.rb index 0747ff8def6a6..cc2eaab4256f9 100644 --- a/Library/Homebrew/cask/dsl/postflight.rb +++ b/Library/Homebrew/cask/dsl/postflight.rb @@ -8,10 +8,6 @@ class DSL # Class corresponding to the `postflight` stanza. class Postflight < Base include Staged - - def suppress_move_to_applications(**_options) - odisabled "`Cask::DSL::Postflight#suppress_move_to_applications`" - end end end end diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 49af60b28240c..4db27d7a87a2d 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -152,15 +152,11 @@ def elisp_caveats end def service_caveats - return if !formula.plist && !formula.service? && !Utils::Service.installed?(formula) && !keg&.plist_installed? + return if !formula.service? && !Utils::Service.installed?(formula) && !keg&.plist_installed? return if formula.service? && !formula.service.command? && !Utils::Service.installed?(formula) s = [] - return <<~EOS if !Utils::Service.launchctl? && formula.plist - #{Formatter.warning("Warning:")} #{formula.name} provides a launchd plist which can only be used on macOS! - EOS - # Brew services only works with these two tools return <<~EOS if !Utils::Service.systemctl? && !Utils::Service.launchctl? && formula.service.command? #{Formatter.warning("Warning:")} #{formula.name} provides a service which can only be used on macOS or systemd! diff --git a/Library/Homebrew/cmd/postgresql-upgrade-database.rb b/Library/Homebrew/cmd/postgresql-upgrade-database.rb deleted file mode 100644 index 9451a732fcf56..0000000000000 --- a/Library/Homebrew/cmd/postgresql-upgrade-database.rb +++ /dev/null @@ -1,169 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -require "abstract_command" -require "formula" - -module Homebrew - module Cmd - class PostgresqlUpgradeDatabase < AbstractCommand - cmd_args do - description <<~EOS - Upgrades the database for the `postgresql` formula. - EOS - - named_args :none - - hide_from_man_page! - end - - sig { override.void } - def run - odisabled "brew postgresql_upgrade_database", - "using new, versioned e.g. `var/postgres@14` datadir and `pg_upgrade`" - - name = "postgresql" - pg = Formula[name] - bin = pg.bin - var = pg.var - version = pg.version - pg_version_file = var/"postgres/PG_VERSION" - - pg_version_installed = version.to_s[/^\d+/] - pg_version_data = pg_version_file.read.chomp - if pg_version_installed == pg_version_data - odie <<~EOS - #{name} data already upgraded! - EOS - end - - datadir = var/"postgres" - old_datadir = var/"postgres.old" - if old_datadir.exist? - odie <<~EOS - #{old_datadir} already exists! - Remove it if you want to upgrade data automatically. - EOS - end - - old_pg_name = "#{name}@#{pg_version_data}" - old_pg_glob = "#{HOMEBREW_CELLAR}/#{old_pg_name}/#{pg_version_data}.*/bin" - old_bin = Pathname.glob(old_pg_glob).first - old_bin ||= begin - Formula[old_pg_name] - ohai "brew install #{old_pg_name}" - system HOMEBREW_BREW_FILE, "install", old_pg_name - Pathname.glob(old_pg_glob).first - rescue FormulaUnavailableError - nil - end - - odie "No #{name} #{pg_version_data}.* version installed!" unless old_bin - - server_stopped = T.let(false, T::Boolean) - moved_data = T.let(false, T::Boolean) - initdb_run = T.let(false, T::Boolean) - upgraded = T.let(false, T::Boolean) - - begin - # Following instructions from: - # https://www.postgresql.org/docs/10/static/pgupgrade.html - ohai "Upgrading #{name} data from #{pg_version_data} to #{pg_version_installed}..." - services_json_output = Utils.popen_read(HOMEBREW_BREW_FILE, "services", "info", "--all", "--json") - services_json = JSON.parse(services_json_output) - loaded_service_names = services_json.select { |sj| sj[:loaded] }.map { |sj| sj[:name] } - if loaded_service_names.include?(name) - system HOMEBREW_BREW_FILE, "services", "stop", name - service_stopped = true - elsif quiet_system "#{bin}/pg_ctl", "-D", datadir, "status" - system "#{bin}/pg_ctl", "-D", datadir, "stop" - server_stopped = true - end - - # Shut down old server if it is up via brew services - system HOMEBREW_BREW_FILE, "services", "stop", old_pg_name if loaded_service_names.include?(old_pg_name) - - # get 'lc_collate' from old DB" - unless quiet_system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "status" - system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "start" - end - - initdb_args = T.let([], T::Array[String]) - locale_settings = %w[ - lc_collate - lc_ctype - lc_messages - lc_monetary - lc_numeric - lc_time - server_encoding - ] - locale_settings.each do |setting| - sql = "SELECT setting FROM pg_settings WHERE name LIKE '#{setting}';" - value = Utils.popen_read("#{old_bin}/psql", "postgres", "-qtAX", "-U", ENV.fetch("USER"), "-c", - sql).strip - - next if value.empty? - - initdb_args += if setting == "server_encoding" - ["-E #{value}"] - else - ["--#{setting.tr("_", "-")}=#{value}"] - end - end - - if quiet_system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "status" - system "#{old_bin}/pg_ctl", "-w", "-D", datadir, "stop" - end - - ohai "Moving #{name} data from #{datadir} to #{old_datadir}..." - FileUtils.mv datadir, old_datadir - moved_data = true - - (var/"postgres").mkpath - ohai "Creating database..." - safe_system "#{bin}/initdb", *initdb_args, "#{var}/postgres" - initdb_run = true - - ohai "Migrating and upgrading data..." - (var/"log").cd do - safe_system "#{bin}/pg_upgrade", - "-r", - "-b", old_bin, - "-B", bin, - "-d", old_datadir, - "-D", datadir, - "-j", Hardware::CPU.cores.to_s - end - upgraded = true - - ohai "Upgraded #{name} data from #{pg_version_data} to #{pg_version_installed}!" - ohai "Your #{name} #{pg_version_data} data remains at #{old_datadir}" - ensure - if upgraded - if server_stopped - safe_system "#{bin}/pg_ctl", "-D", datadir, "start" - elsif service_stopped - safe_system HOMEBREW_BREW_FILE, "services", "start", name - end - else - onoe "Upgrading #{name} data from #{pg_version_data} to #{pg_version_installed} failed!" - if initdb_run - ohai "Removing empty #{name} initdb database..." - FileUtils.rm_r datadir - end - if moved_data - ohai "Moving #{name} data back from #{old_datadir} to #{datadir}..." - FileUtils.mv old_datadir, datadir - end - if server_stopped - system "#{bin}/pg_ctl", "-D", datadir, "start" - elsif service_stopped - system HOMEBREW_BREW_FILE, "services", "start", name - end - end - end - end - end - end -end diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 0ab6fbabf92c1..122ef265a206d 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -754,52 +754,20 @@ def empty? end def dump(auto_update: false) - report_all = ENV["HOMEBREW_UPDATE_REPORT_ALL_FORMULAE"].present? - if report_all && !Homebrew::EnvConfig.no_install_from_api? - odisabled "`HOMEBREW_UPDATE_REPORT_ALL_FORMULAE`" - opoo "This will not report all formulae because Homebrew cannot get this data from the API." - report_all = false - end - unless Homebrew::EnvConfig.no_update_report_new? dump_new_formula_report dump_new_cask_report end - if report_all - dump_renamed_formula_report - dump_renamed_cask_report - end - - dump_deleted_formula_report(report_all) - dump_deleted_cask_report(report_all) - - outdated_formulae = [] - outdated_casks = [] - - if report_all - if auto_update - if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive? - ohai "Modified Formulae", - "Modified #{Utils.pluralize("formula", changed_formulae, plural: "e", include_count: true)}." - end + dump_deleted_formula_report + dump_deleted_cask_report - if (changed_casks = select_formula_or_cask(:MC).count) && changed_casks.positive? - ohai "Modified Casks", "Modified #{Utils.pluralize("cask", changed_casks, include_count: true)}." - end - else - dump_modified_formula_report - dump_modified_cask_report - end - else - outdated_formulae = Formula.installed.select(&:outdated?).map(&:name) - outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token) - unless auto_update - output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae - output_dump_formula_or_cask_report "Outdated Casks", outdated_casks - end + outdated_formulae = Formula.installed.select(&:outdated?).map(&:name) + outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token) + unless auto_update + output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae + output_dump_formula_or_cask_report "Outdated Casks", outdated_casks end - return if outdated_formulae.blank? && outdated_casks.blank? outdated_formulae = outdated_formulae.count @@ -853,92 +821,21 @@ def dump_new_cask_report output_dump_formula_or_cask_report "New Casks", casks end - def dump_renamed_formula_report - formulae = select_formula_or_cask(:R).sort.map do |name, new_name| - name = pretty_installed(name) if installed?(name) - new_name = pretty_installed(new_name) if installed?(new_name) - "#{name} -> #{new_name}" - end - - output_dump_formula_or_cask_report "Renamed Formulae", formulae - end - - def dump_renamed_cask_report - casks = select_formula_or_cask(:RC).sort.map do |name, new_name| - name = pretty_installed(name) if installed?(name) - new_name = pretty_installed(new_name) if installed?(new_name) - "#{name} -> #{new_name}" - end - - output_dump_formula_or_cask_report "Renamed Casks", casks - end - - def dump_deleted_formula_report(report_all) + def dump_deleted_formula_report formulae = select_formula_or_cask(:D).sort.filter_map do |name| - if installed?(name) - pretty_uninstalled(name) - elsif report_all - name - end + pretty_uninstalled(name) if installed?(name) end - title = if report_all - "Deleted Formulae" - else - "Deleted Installed Formulae" - end - output_dump_formula_or_cask_report title, formulae + output_dump_formula_or_cask_report "Deleted Installed Formulae", formulae end - def dump_deleted_cask_report(report_all) + def dump_deleted_cask_report casks = select_formula_or_cask(:DC).sort.filter_map do |name| name = name.split("/").last - if cask_installed?(name) - pretty_uninstalled(name) - elsif report_all - name - end - end - - title = if report_all - "Deleted Casks" - else - "Deleted Installed Casks" - end - output_dump_formula_or_cask_report title, casks - end - - def dump_modified_formula_report - formulae = select_formula_or_cask(:M).sort.map do |name| - if installed?(name) - if outdated?(name) - pretty_outdated(name) - else - pretty_installed(name) - end - else - name - end - end - - output_dump_formula_or_cask_report "Modified Formulae", formulae - end - - def dump_modified_cask_report - casks = select_formula_or_cask(:MC).sort.map do |name| - name = name.split("/").last - if cask_installed?(name) - if cask_outdated?(name) - pretty_outdated(name) - else - pretty_installed(name) - end - else - name - end + pretty_uninstalled(name) if cask_installed?(name) end - output_dump_formula_or_cask_report "Modified Casks", casks + output_dump_formula_or_cask_report "Deleted Installed Casks", casks end def output_dump_formula_or_cask_report(title, formulae_or_casks) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 71516f1161019..aab7e7714da04 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -124,8 +124,8 @@ class UpgradeCmd < AbstractCommand sig { override.void } def run - # Deprecated since this is now the default behavior. - odeprecated "`brew upgrade --ignore-pinned`" if args.ignore_pinned? + # Disabled since this is now the default behavior. + odisabled "`brew upgrade --ignore-pinned`" if args.ignore_pinned? formulae, casks = args.named.to_resolved_formulae_to_casks # If one or more formulae are specified, but no casks were diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3dde5d54da1d7..4932d492d2adb 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -50,13 +50,11 @@ class Audit < AbstractCommand "`--strict` and `--online`." switch "--new-formula", replacement: "--new", - # odeprecated: change this to true on disable and remove `args.new_formula?` calls - disable: false, + disable: true, hidden: true switch "--new-cask", replacement: "--new", - # odeprecated: change this to true on disable and remove `args.new_formula?` calls - disable: false, + disable: true, hidden: true switch "--[no-]signing", description: "Audit for signed apps, which are required on ARM" @@ -105,9 +103,6 @@ class Audit < AbstractCommand sig { override.void } def run - new_cask = args.new? || args.new_cask? - new_formula = args.new? || args.new_formula? - Formulary.enable_factory_cache! os_arch_combinations = args.os_arch_combinations @@ -115,8 +110,8 @@ def run Homebrew.auditing = true Homebrew.inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? - strict = new_formula || args.strict? - online = new_formula || args.online? + strict = args.new? || args.strict? + online = args.new? || args.online? tap_audit = args.tap.present? skip_style = args.skip_style? || args.no_named? || tap_audit no_named_args = T.let(false, T::Boolean) @@ -176,7 +171,7 @@ def run if only_cops style_options[:only_cops] = only_cops - elsif new_formula || new_cask + elsif args.new? nil elsif except_cops style_options[:except_cops] = except_cops @@ -207,7 +202,7 @@ def run only = only_cops ? ["style"] : args.only options = { - new_formula:, + new_formula: args.new?, strict:, online:, git: args.git?, @@ -262,7 +257,7 @@ def run # No need for `|| nil` for `--[no-]signing` # because boolean switches are already `nil` if not passed audit_signing: args.signing?, - audit_new_cask: new_cask || nil, + audit_new_cask: args.new? || nil, audit_token_conflicts: args.token_conflicts? || nil, quarantine: true, any_named_args: !no_named_args, diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index ebb49a8873cd0..1252cf3601c13 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -49,8 +49,6 @@ class BumpCaskPr < AbstractCommand description: "Specify the checksum of the new download." flag "--fork-org=", description: "Use the specified GitHub organization for forking." - switch "-f", "--force", - hidden: true conflicts "--dry-run", "--write" conflicts "--no-audit", "--online" @@ -62,8 +60,7 @@ class BumpCaskPr < AbstractCommand sig { override.void } def run - odeprecated "brew bump-cask-pr --online" if args.online? - odisabled "brew bump-cask-pr --force" if args.force? + odisabled "brew bump-cask-pr --online" if args.online? # This will be run by `brew audit` or `brew style` later so run it first to # not start spamming during normal output. diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 5e4b0f007c7c6..ddd439e5bffdf 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -475,7 +475,7 @@ def check_new_version(formula, tap_remote_repo, version: nil, url: nil, tag: nil def check_throttle(formula, new_version) throttled_rate = formula.livecheck.throttle throttled_rate ||= if (rate = formula.tap.audit_exceptions.dig(:throttled_formulae, formula.name)) - odeprecated "throttled_formulae.json", "Livecheck#throttle" + odisabled "throttled_formulae.json", "Livecheck#throttle" rate end return if throttled_rate.blank? diff --git a/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb b/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb index 9014f5af52a83..b12508657fbe3 100644 --- a/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb +++ b/Library/Homebrew/dev-cmd/bump-unversioned-casks.rb @@ -44,7 +44,7 @@ def run casks = args.named.to_paths(only: :cask, recurse_tap: true).map { |path| Cask::CaskLoader.load(path) } unversioned_casks = casks.select do |cask| - cask.url&.unversioned? && !cask.livecheckable? && !cask.discontinued? + cask.url&.unversioned? && !cask.livecheckable? end ohai "Unversioned Casks: #{unversioned_casks.count} (#{state.size} cached)" diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index acd841eaf2a8c..538d69ed3afa6 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -45,8 +45,6 @@ class VersionBumpInfo < T::Struct description: "Limit number of package results returned." flag "--start-with=", description: "Letter or word that the list of package results should alphabetically follow." - switch "-f", "--force", - hidden: true conflicts "--cask", "--formula" conflicts "--tap=", "--installed" @@ -63,8 +61,6 @@ def run raise UsageError, "`--limit` must be used with either `--formula` or `--cask`." end - odisabled "brew bump --force" if args.force? - Homebrew.with_no_api_env do formulae_and_casks = if args.tap tap = Tap.fetch(T.must(args.tap)) diff --git a/Library/Homebrew/dev-cmd/livecheck.rb b/Library/Homebrew/dev-cmd/livecheck.rb index 4868097656111..a97c856f70f90 100644 --- a/Library/Homebrew/dev-cmd/livecheck.rb +++ b/Library/Homebrew/dev-cmd/livecheck.rb @@ -120,19 +120,7 @@ def run private def watchlist_path - @watchlist_path ||= begin - watchlist = File.expand_path(Homebrew::EnvConfig.livecheck_watchlist) - - unless File.exist?(watchlist) - previous_default_watchlist = File.expand_path("~/.brew_livecheck_watchlist") - if File.exist?(previous_default_watchlist) - odisabled "~/.brew_livecheck_watchlist", "~/.homebrew/livecheck_watchlist.txt" - watchlist = previous_default_watchlist - end - end - - watchlist - end + @watchlist_path ||= File.expand_path(Homebrew::EnvConfig.livecheck_watchlist) end end end diff --git a/Library/Homebrew/dev-cmd/pr-automerge.rb b/Library/Homebrew/dev-cmd/pr-automerge.rb index 2cfb1b989baff..f4fe6e1b45942 100644 --- a/Library/Homebrew/dev-cmd/pr-automerge.rb +++ b/Library/Homebrew/dev-cmd/pr-automerge.rb @@ -28,11 +28,6 @@ class PrAutomerge < AbstractCommand switch "--autosquash", description: "Instruct `brew pr-publish` to automatically reformat and reword commits " \ "in the pull request to the preferred format." - switch "--no-autosquash", - description: "Instruct `brew pr-publish` to skip automatically reformatting and rewording commits " \ - "in the pull request to the preferred format.", - disable: true, # odisabled: remove this switch with 4.3.0 - hidden: true switch "--ignore-failures", description: "Include pull requests that have failing status checks." diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 6e6210acd0967..bd8bc73a5c3bf 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -35,11 +35,6 @@ class PrPull < AbstractCommand switch "--autosquash", description: "Automatically reformat and reword commits in the pull request to our " \ "preferred format." - switch "--no-autosquash", - description: "Skip automatically reformatting and rewording commits in the pull request to our " \ - "preferred format.", - disable: true, # odisabled: remove this switch with 4.3.0 - hidden: true switch "--branch-okay", description: "Do not warn if pulling to a branch besides the repository default (useful for testing)." switch "--resolve", diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e4c9aa0038387..821ed735f9a52 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -79,7 +79,7 @@ def quiet! # Disable any output during downloading. sig { void } def shutup! - odeprecated "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`" + odisabled "`AbstractDownloadStrategy#shutup!`", "`AbstractDownloadStrategy#quiet!`" quiet! end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index f82e9b4b2f18f..0ad0b86f643f4 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -565,13 +565,6 @@ def synced_with_other_formulae? } def resource(name, klass = Resource, &block) = active_spec.resource(name, klass, &block) - # An old name for the formula. - sig { returns(T.nilable(String)) } - def oldname - odisabled "`Formula#oldname`", "`Formula#oldnames`" - @oldname ||= oldnames.first - end - # Old names for the formula. # # @api internal @@ -605,16 +598,6 @@ def aliases # The declared {Dependency}s for the currently active {SoftwareSpec} (i.e. including those provided by macOS) delegate declared_deps: :active_spec - # Dependencies provided by macOS for the currently active {SoftwareSpec}. - def uses_from_macos_elements - odisabled "`Formula#uses_from_macos_elements`", "`Formula#declared_deps`" - end - - # Dependency names provided by macOS for the currently active {SoftwareSpec}. - def uses_from_macos_names - odisabled "`Formula#uses_from_macos_names`", "`Formula#declared_deps`" - end - # The {Requirement}s for the currently active {SoftwareSpec}. delegate requirements: :active_spec @@ -1241,8 +1224,7 @@ def with_logging(log_type) # # @see https://www.unix.com/man-page/all/5/plist/ plist(5) man page def plist - # odeprecated: consider removing entirely in 4.3.0 - # odeprecated "`Formula#plist`", "`Homebrew::Service`" + odeprecated "`Formula#plist`", "`Homebrew::Service`" nil end @@ -2401,7 +2383,7 @@ def to_hash "name" => name, "full_name" => full_name, "tap" => tap&.name, - "oldname" => oldnames.first, # deprecated + "oldname" => ("odeprecated" if oldnames.first), "oldnames" => oldnames, "aliases" => aliases.sort, "versioned_formulae" => versioned_formulae.map(&:name), @@ -3731,7 +3713,7 @@ def resource(name, klass = Resource, &block) # # @api public def go_resource(name, &block) - # odeprecated "`Formula.go_resource`", "Go modules" + odeprecated "`Formula.go_resource`", "Go modules" specs.each { |spec| spec.go_resource(name, &block) } end diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index db833443ff57e..e220e77dee227 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -427,7 +427,7 @@ def audit_installed problem_if_output(check_elisp_root(formula.share, formula.name)) problem_if_output(check_python_packages(formula.lib, formula.deps)) problem_if_output(check_shim_references(formula.prefix)) - problem_if_output(check_plist(formula.prefix, formula.plist)) + problem_if_output(check_plist(formula.prefix, formula.launchd_service_path)) problem_if_output(check_python_symlinks(formula.name, formula.keg_only?)) problem_if_output(check_cpuid_instruction(formula)) problem_if_output(check_binary_arches(formula)) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 21df0a776cbb2..1475a595ff554 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1049,12 +1049,7 @@ def link(keg) sig { void } def install_service - if formula.service? && formula.plist - ofail "Formula specified both service and plist" - return - end - - if formula.service? && formula.service.command? + service = if formula.service? && formula.service.command? service_path = formula.systemd_service_path service_path.atomic_write(formula.service.to_systemd_unit) service_path.chmod 0644 @@ -1064,14 +1059,9 @@ def install_service timer_path.atomic_write(formula.service.to_systemd_timer) timer_path.chmod 0644 end - end - service = if formula.service? && formula.service.command? formula.service.to_plist - elsif formula.plist - formula.plist end - return unless service launchd_service_path = formula.launchd_service_path diff --git a/Library/Homebrew/github_packages.rb b/Library/Homebrew/github_packages.rb index 64aa192cc157a..1cb620acca1e8 100644 --- a/Library/Homebrew/github_packages.rb +++ b/Library/Homebrew/github_packages.rb @@ -125,8 +125,8 @@ def self.image_formula_name(formula_name) def self.image_version_rebuild(version_rebuild) return version_rebuild if version_rebuild.match?(VALID_OCI_TAG_REGEX) - odeprecated "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}", - "declaring a new `version` without these characters" + odisabled "GitHub Packages versions that do not match #{VALID_OCI_TAG_REGEX.source}", + "declaring a new `version` without these characters" version_rebuild.gsub(INVALID_OCI_TAG_CHARS_REGEX, ".") end diff --git a/Library/Homebrew/language/go.rb b/Library/Homebrew/language/go.rb index c5344e92b2f10..6118ffc5bb312 100644 --- a/Library/Homebrew/language/go.rb +++ b/Library/Homebrew/language/go.rb @@ -14,7 +14,7 @@ module Go # e.g. `resource "github.com/foo/bar"`. sig { params(resources: T::Array[Resource], target: T.any(String, Pathname)).void } def self.stage_deps(resources, target) - # odeprecated "`Language::Go.stage_deps`", "Go modules" + odeprecated "`Language::Go.stage_deps`", "Go modules" if resources.empty? if Homebrew::EnvConfig.developer? odie "Tried to stage empty Language::Go resources array" diff --git a/Library/Homebrew/livecheck/skip_conditions.rb b/Library/Homebrew/livecheck/skip_conditions.rb index e868d7640d1f1..3a3effd910056 100644 --- a/Library/Homebrew/livecheck/skip_conditions.rb +++ b/Library/Homebrew/livecheck/skip_conditions.rb @@ -107,20 +107,6 @@ def formula_versioned(formula, livecheckable, full_name: false, verbose: false) Livecheck.status_hash(formula, "versioned", full_name:, verbose:) end - sig { - params( - cask: Cask::Cask, - livecheckable: T::Boolean, - full_name: T::Boolean, - verbose: T::Boolean, - ).returns(Hash) - } - def cask_discontinued(cask, livecheckable, full_name: false, verbose: false) - return {} if !cask.discontinued? || livecheckable - - Livecheck.status_hash(cask, "discontinued", full_name:, verbose:) - end - sig { params( cask: Cask::Cask, @@ -210,7 +196,6 @@ def cask_url_unversioned(cask, livecheckable, full_name: false, verbose: false) # Skip conditions for casks. CASK_CHECKS = [ :package_or_resource_skip, - :cask_discontinued, :cask_deprecated, :cask_disabled, :cask_extract_plist, diff --git a/Library/Homebrew/macos_version.rb b/Library/Homebrew/macos_version.rb index a8ca466404cdd..649b55bcdd282 100644 --- a/Library/Homebrew/macos_version.rb +++ b/Library/Homebrew/macos_version.rb @@ -136,40 +136,3 @@ def requires_nehalem_cpu? # NOTE: Constructor needs to called with an arbitrary macOS-like version which is then set to `nil`. NULL = MacOSVersion.new("10.0").tap { |v| v.instance_variable_set(:@version, nil) }.freeze end - -require "lazy_object" - -module MacOSVersionErrorCompat - def const_missing(name) - if name == :MacOSVersionError - odisabled "`MacOSVersionError`", "`MacOSVersion::Error`" - return MacOSVersion::Error - end - - super - end -end - -# `LazyObject` does not work for exceptions when used in `rescue` statements. -class Object - class << self - prepend MacOSVersionErrorCompat - end -end - -module MacOSVersions - SYMBOLS = LazyObject.new do # rubocop:disable Style/MutableConstant - odisabled "`MacOSVersions::SYMBOLS`", "`MacOSVersion::SYMBOLS`" - MacOSVersion::SYMBOLS - end -end - -module OS - module Mac - # TODO: Replace `::Version` with `Version` when this is removed. - Version = LazyObject.new do # rubocop:disable Style/MutableConstant - odisabled "`OS::Mac::Version`", "`MacOSVersion`" - MacOSVersion - end - end -end diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index 3fab83e525aab..2e2752c7bb7e2 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -58,60 +58,60 @@ module Mac raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] def self.version - odeprecated "`MacOS.version` on Linux" + odisabled "`MacOS.version` on Linux" MacOSVersion::NULL end def self.full_version - odeprecated "`MacOS.full_version` on Linux" + odisabled "`MacOS.full_version` on Linux" MacOSVersion::NULL end def self.languages - odeprecated "`MacOS.languages` on Linux" + odisabled "`MacOS.languages` on Linux" @languages ||= Array(ENV["LANG"]&.slice(/[a-z]+/)).uniq end def self.language - odeprecated "`MacOS.language` on Linux" + odisabled "`MacOS.language` on Linux" languages.first end def self.sdk_root_needed? - odeprecated "`MacOS.sdk_root_needed?` on Linux" + odisabled "`MacOS.sdk_root_needed?` on Linux" false end def self.sdk_path_if_needed(_version = nil) - odeprecated "`MacOS.sdk_path_if_needed` on Linux" + odisabled "`MacOS.sdk_path_if_needed` on Linux" nil end def self.sdk_path(_version = nil) - odeprecated "`MacOS.sdk_path` on Linux" + odisabled "`MacOS.sdk_path` on Linux" nil end module Xcode def self.version - odeprecated "`MacOS::Xcode.version` on Linux" + odisabled "`MacOS::Xcode.version` on Linux" ::Version::NULL end def self.installed? - odeprecated "`MacOS::Xcode.installed?` on Linux" + odisabled "`MacOS::Xcode.installed?` on Linux" false end end module CLT def self.version - odeprecated "`MacOS::CLT.version` on Linux" + odisabled "`MacOS::CLT.version` on Linux" ::Version::NULL end def self.installed? - odeprecated "`MacOS::CLT.installed?` on Linux" + odisabled "`MacOS::CLT.installed?` on Linux" false end end diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index ebb0003b777c3..417b0ebe9bf0b 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -26,7 +26,7 @@ module Mac # @api internal sig { returns(MacOSVersion) } def self.version - odeprecated "`MacOS.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? @version ||= full_version.strip_patch end @@ -36,7 +36,7 @@ def self.version # @api internal sig { returns(MacOSVersion) } def self.full_version - odeprecated "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.full_version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? @full_version ||= if (fake_macos = ENV.fetch("HOMEBREW_FAKE_MACOS", nil)) # for Portable Ruby building MacOSVersion.new(fake_macos) else @@ -69,7 +69,7 @@ def self.preferred_perl_version end def self.languages - odeprecated "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.languages` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? return @languages if @languages os_langs = Utils.popen_read("defaults", "read", "-g", "AppleLanguages") @@ -83,7 +83,7 @@ def self.languages end def self.language - odeprecated "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.language` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? languages.first end @@ -94,7 +94,7 @@ def self.active_developer_dir sig { returns(T::Boolean) } def self.sdk_root_needed? - odeprecated "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.sdk_root_needed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? if MacOS::CLT.installed? # If there's no CLT SDK, return false return false unless MacOS::CLT.provides_sdk? @@ -143,13 +143,13 @@ def self.sdk_for_formula(formula, version = nil, check_only_runtime_requirements # Returns the path to an SDK or nil, following the rules set by {sdk}. def self.sdk_path(version = nil) - odeprecated "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.sdk_path` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? s = sdk(version) s&.path end def self.sdk_path_if_needed(version = nil) - odeprecated "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS.sdk_path_if_needed` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? # Prefer CLT SDK when both Xcode and the CLT are installed. # Expected results: # 1. On Xcode-only systems, return the Xcode SDK. diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index 12fa0f5a99540..eebf3d7b44af3 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -123,7 +123,7 @@ def self.bundle_path sig { returns(T::Boolean) } def self.installed? - odeprecated "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS::Xcode.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? !prefix.nil? end @@ -175,7 +175,7 @@ def self.update_instructions # @api internal sig { returns(::Version) } def self.version - odeprecated "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS::Xcode.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? # may return a version string # that is guessed based on the compiler, so do not # use it in order to check if Xcode is installed. @@ -274,7 +274,7 @@ module CLT # Returns true even if outdated tools are installed. sig { returns(T::Boolean) } def self.installed? - odeprecated "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS::CLT.installed?` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? !version.null? end @@ -409,7 +409,7 @@ def self.detect_version_from_clang_version # @api internal sig { returns(::Version) } def self.version - odeprecated "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? + odisabled "`MacOS::CLT.version` on Linux" if Homebrew::SimulateSystem.simulating_or_running_on_linux? if @version ||= detect_version ::Version.new @version else diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 400540d0565d1..f404206f9d29b 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -143,7 +143,7 @@ def resource(name, klass = Resource, &block) end def go_resource(name, &block) - # odeprecated "`SoftwareSpec#go_resource`", "Go modules" + odeprecated "`SoftwareSpec#go_resource`", "Go modules" resource name, Resource::Go, &block end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/postgresql_upgrade_database.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/postgresql_upgrade_database.rbi deleted file mode 100644 index 5d90e72a26c8b..0000000000000 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/postgresql_upgrade_database.rbi +++ /dev/null @@ -1,12 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for dynamic methods in `Homebrew::Cmd::PostgresqlUpgradeDatabase`. -# Please instead update this file by running `bin/tapioca dsl Homebrew::Cmd::PostgresqlUpgradeDatabase`. - -class Homebrew::Cmd::PostgresqlUpgradeDatabase - sig { returns(Homebrew::Cmd::PostgresqlUpgradeDatabase::Args) } - def args; end -end - -class Homebrew::Cmd::PostgresqlUpgradeDatabase::Args < Homebrew::CLI::Args; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/audit.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/audit.rbi index c86d4071ab949..0de9834f8e643 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/audit.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/audit.rbi @@ -58,12 +58,6 @@ class Homebrew::DevCmd::Audit::Args < Homebrew::CLI::Args sig { returns(T::Boolean) } def new?; end - sig { returns(T::Boolean) } - def new_cask?; end - - sig { returns(T::Boolean) } - def new_formula?; end - sig { returns(T::Boolean) } def online?; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi index 84c6f89a5423b..ed6c71cff1f87 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi @@ -16,12 +16,6 @@ class Homebrew::DevCmd::Bump::Args < Homebrew::CLI::Args sig { returns(T::Boolean) } def casks?; end - sig { returns(T::Boolean) } - def f?; end - - sig { returns(T::Boolean) } - def force?; end - sig { returns(T::Boolean) } def formula?; end diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump_cask_pr.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump_cask_pr.rbi index a1f2a81a3dcaf..8a99cb443802e 100644 --- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump_cask_pr.rbi +++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/bump_cask_pr.rbi @@ -16,12 +16,6 @@ class Homebrew::DevCmd::BumpCaskPr::Args < Homebrew::CLI::Args sig { returns(T::Boolean) } def dry_run?; end - sig { returns(T::Boolean) } - def f?; end - - sig { returns(T::Boolean) } - def force?; end - sig { returns(T.nilable(String)) } def fork_org; end diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 1577624988170..a312d30c1b6e0 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -118,20 +118,6 @@ def self.with_cask_token(token) [tap, token.downcase] end - sig { returns(CoreCaskTap) } - def self.default_cask_tap - odisabled "`Tap.default_cask_tap`", "`CoreCaskTap.instance`" - - CoreCaskTap.instance - end - - sig { params(force: T::Boolean).returns(T::Boolean) } - def self.install_default_cask_tap_if_necessary(force: false) - odisabled "`Tap.install_default_cask_tap_if_necessary`", "`CoreCaskTap.instance.ensure_installed!`" - - false - end - sig { returns(T::Set[Tap]) } def self.allowed_taps cache_key = :"allowed_taps_#{Homebrew::EnvConfig.allowed_taps.to_s.tr(" ", "_")}" @@ -1042,7 +1028,7 @@ def self.each(&block) # An array of all installed {Tap} names. sig { returns(T::Array[String]) } def self.names - # odeprecated "`#{self}.names`" + odeprecated "`#{self}.names`" map(&:name).sort end @@ -1154,7 +1140,7 @@ def ensure_installed! sig { void } def self.ensure_installed! - # odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`" + odeprecated "`#{self}.ensure_installed!`", "`#{self}.instance.ensure_installed!`" instance.ensure_installed! end diff --git a/Library/Homebrew/test/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index 97c2970ded625..0f796b5a8fbad 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -31,30 +31,9 @@ def caveats end describe "#caveats" do - context "when f.plist is not nil", :needs_macos do + context "when service block is defined" do before do - allow(Utils::Service).to receive(:launchctl?).and_return(true) - end - - it "prints error when no launchd is present" do - f = formula do - url "foo-1.0" - def plist - "plist_test.plist" - end - end - expect(Utils::Service).to receive(:launchctl?).once.and_return(false) - expect(described_class.new(f).caveats).to include("provides a launchd plist which can only be used on macOS!") - end - - it "prints plist login information when f.plist_startup is nil" do - f = formula do - url "foo-1.0" - def plist - "plist_test.plist" - end - end - expect(described_class.new(f).caveats).to include("restart at login") + allow(Utils::Service).to receive_messages(launchctl?: true, systemctl?: true) end it "gives information about service" do @@ -71,41 +50,6 @@ def plist expect(caveats).to include("background service") end - it "warns about brew failing under tmux" do - f = formula do - url "foo-1.0" - def plist - "plist_test.plist" - end - end - ENV["HOMEBREW_TMUX"] = "1" - allow(Homebrew).to receive(:_system).and_return(true) - allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false) - caveats = described_class.new(f).caveats - - expect(caveats).to include("WARNING:") - expect(caveats).to include("tmux") - end - - # TODO: This should get deprecated and the service block `plist_name` method should get used instead. - it "prints info when there are custom service files" do - f = formula do - url "foo-1.0" - def plist_name - "custom.mxcl.foo" - end - end - expect(Utils::Service).to receive(:installed?).with(f).once.and_return(true) - expect(Utils::Service).to receive(:running?).with(f).once.and_return(false) - expect(described_class.new(f).caveats).to include("restart at login") - end - end - - context "when service block is defined" do - before do - allow(Utils::Service).to receive_messages(launchctl?: true, systemctl?: true) - end - it "prints warning when no service daemon is found" do f = formula do url "foo-1.0" @@ -113,8 +57,8 @@ def plist_name run [bin/"cmd"] end end - expect(Utils::Service).to receive(:launchctl?).twice.and_return(false) - expect(Utils::Service).to receive(:systemctl?).once.and_return(false) + expect(Utils::Service).to receive(:launchctl?).and_return(false) + expect(Utils::Service).to receive(:systemctl?).and_return(false) expect(described_class.new(f).caveats).to include("service which can only be used on macOS or systemd!") end diff --git a/Library/Homebrew/test/cmd/postgresql-upgrade-database_spec.rb b/Library/Homebrew/test/cmd/postgresql-upgrade-database_spec.rb deleted file mode 100644 index 934b037951d33..0000000000000 --- a/Library/Homebrew/test/cmd/postgresql-upgrade-database_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -require "cmd/postgresql-upgrade-database" -require "cmd/shared_examples/args_parse" - -RSpec.describe Homebrew::Cmd::PostgresqlUpgradeDatabase do - it_behaves_like "parseable arguments" -end diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb index e2655cd0c52b5..d4b6284b3d1b7 100644 --- a/Library/Homebrew/test/formula_installer_spec.rb +++ b/Library/Homebrew/test/formula_installer_spec.rb @@ -451,22 +451,6 @@ class #{Formulary.class_s(f_name)} < Formula end describe "#install_service" do - it "works if plist is set" do - formula = Testball.new - path = formula.launchd_service_path - formula.opt_prefix.mkpath - - expect(formula).to receive(:plist).twice.and_return("PLIST") - expect(formula).to receive(:launchd_service_path).and_call_original - - installer = described_class.new(formula) - expect do - installer.install_service - end.not_to output(/Error: Failed to install service files/).to_stderr - - expect(path).to exist - end - it "works if service is set" do formula = Testball.new service = Homebrew::Service.new(formula) @@ -474,14 +458,13 @@ class #{Formulary.class_s(f_name)} < Formula service_path = formula.systemd_service_path formula.opt_prefix.mkpath - expect(formula).to receive(:plist).and_return(nil) - expect(formula).to receive(:service?).exactly(3).and_return(true) - expect(formula).to receive(:service).exactly(7).and_return(service) + expect(formula).to receive(:service?).and_return(true) + expect(formula).to receive(:service).at_least(:once).and_return(service) expect(formula).to receive(:launchd_service_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original expect(service).to receive(:timed?).and_return(false) - expect(service).to receive(:command?).exactly(2).and_return(true) + expect(service).to receive(:command?).and_return(true) expect(service).to receive(:to_plist).and_return("plist") expect(service).to receive(:to_systemd_unit).and_return("unit") @@ -502,15 +485,14 @@ class #{Formulary.class_s(f_name)} < Formula timer_path = formula.systemd_timer_path formula.opt_prefix.mkpath - expect(formula).to receive(:plist).and_return(nil) - expect(formula).to receive(:service?).exactly(3).and_return(true) - expect(formula).to receive(:service).exactly(9).and_return(service) + expect(formula).to receive(:service?).and_return(true) + expect(formula).to receive(:service).at_least(:once).and_return(service) expect(formula).to receive(:launchd_service_path).and_call_original expect(formula).to receive(:systemd_service_path).and_call_original expect(formula).to receive(:systemd_timer_path).and_call_original expect(service).to receive(:timed?).and_return(true) - expect(service).to receive(:command?).exactly(2).and_return(true) + expect(service).to receive(:command?).and_return(true) expect(service).to receive(:to_plist).and_return("plist") expect(service).to receive(:to_systemd_unit).and_return("unit") expect(service).to receive(:to_systemd_timer).and_return("timer") @@ -530,8 +512,7 @@ class #{Formulary.class_s(f_name)} < Formula path = formula.launchd_service_path formula.opt_prefix.mkpath - expect(formula).to receive(:plist).and_return(nil) - expect(formula).to receive(:service?).exactly(3).and_return(nil) + expect(formula).to receive(:service?).and_return(nil) expect(formula).not_to receive(:launchd_service_path) installer = described_class.new(formula) @@ -541,24 +522,5 @@ class #{Formulary.class_s(f_name)} < Formula expect(path).not_to exist end - - it "errors with duplicate definition" do - formula = Testball.new - path = formula.launchd_service_path - formula.opt_prefix.mkpath - - expect(formula).to receive(:plist).and_return("plist") - expect(formula).to receive(:service?).and_return(true) - expect(formula).not_to receive(:service) - expect(formula).not_to receive(:launchd_service_path) - - installer = described_class.new(formula) - expect do - installer.install_service - end.to output("Error: Formula specified both service and plist\n").to_stderr - - expect(Homebrew).to have_failed - expect(path).not_to exist - end end end diff --git a/Library/Homebrew/test/language/go_spec.rb b/Library/Homebrew/test/language/go_spec.rb deleted file mode 100644 index d13bd56c13f94..0000000000000 --- a/Library/Homebrew/test/language/go_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require "language/go" - -RSpec.describe Language::Go do - specify "#stage_deps" do - ENV.delete("HOMEBREW_DEVELOPER") - - expect(described_class).to receive(:opoo).once - - mktmpdir do |path| - described_class.stage_deps [], path - end - end -end diff --git a/Library/Homebrew/test/livecheck/skip_conditions_spec.rb b/Library/Homebrew/test/livecheck/skip_conditions_spec.rb index 33e40cf543aca..6c5347164d793 100644 --- a/Library/Homebrew/test/livecheck/skip_conditions_spec.rb +++ b/Library/Homebrew/test/livecheck/skip_conditions_spec.rb @@ -92,19 +92,6 @@ regex(/"stable":"(\d+(?:\.\d+)+)"/i) end end, - discontinued: Cask::Cask.new("test_discontinued") do - version "0.0.1" - sha256 :no_check - - url "https://brew.sh/test-0.0.1.tgz" - name "Test Discontinued" - desc "Discontinued test cask" - homepage "https://brew.sh" - - caveats do - discontinued - end - end, deprecated: Cask::Cask.new("test_deprecated") do version "0.0.1" sha256 :no_check @@ -258,13 +245,6 @@ }, }, cask: { - discontinued: { - cask: "test_discontinued", - status: "discontinued", - meta: { - livecheckable: false, - }, - }, deprecated: { cask: "test_deprecated", status: "deprecated", @@ -380,13 +360,6 @@ end end - context "when a cask without a livecheckable is discontinued" do - it "skips" do - expect(skip_conditions.skip_information(casks[:discontinued])) - .to eq(status_hashes[:cask][:discontinued]) - end - end - context "when a cask without a livecheckable is deprecated" do it "skips" do expect(skip_conditions.skip_information(casks[:deprecated])) @@ -503,13 +476,6 @@ end end - context "when a cask without a livecheckable is discontinued" do - it "errors" do - expect { skip_conditions.referenced_skip_information(casks[:discontinued], original_name) } - .to raise_error(RuntimeError, "Referenced cask (test_discontinued) is skipped as discontinued") - end - end - context "when a cask without a livecheckable is deprecated" do it "errors" do expect { skip_conditions.referenced_skip_information(casks[:deprecated], original_name) } @@ -635,14 +601,6 @@ end end - context "when the cask is discontinued without a livecheckable" do - it "prints skip information" do - expect { skip_conditions.print_skip_information(status_hashes[:cask][:discontinued]) } - .to output("test_discontinued: discontinued\n").to_stdout - .and not_to_output.to_stderr - end - end - context "when the cask is deprecated without a livecheckable" do it "prints skip information" do expect { skip_conditions.print_skip_information(status_hashes[:cask][:deprecated]) } diff --git a/Library/Homebrew/test/migrator_spec.rb b/Library/Homebrew/test/migrator_spec.rb index 87fadd5e95555..8a1608f88d596 100644 --- a/Library/Homebrew/test/migrator_spec.rb +++ b/Library/Homebrew/test/migrator_spec.rb @@ -20,7 +20,7 @@ let(:old_pin) { HOMEBREW_PINNED_KEGS/"oldname" } before do |example| - allow(new_formula).to receive(:oldname).and_return("oldname") + allow(new_formula).to receive(:oldnames).and_return(["oldname"]) # do not create directories for error tests next if example.metadata[:description].start_with?("raises an error") diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb deleted file mode 100644 index 69d7f8f4a5578..0000000000000 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb +++ /dev/null @@ -1,11 +0,0 @@ -cask "invalid-appcast-multiple" do - version "1.2.3" - sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" - - url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast "https://brew.sh/appcast1.xml" - appcast "https://brew.sh/appcast2.xml" - homepage "https://brew.sh/invalid-appcast-multiple" - - app "Caffeine.app" -end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb deleted file mode 100644 index b5fa78e0f0356..0000000000000 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb +++ /dev/null @@ -1,10 +0,0 @@ -cask "invalid-appcast-url" do - version "1.2.3" - sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" - - url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast 1 - homepage "https://brew.sh/invalid-appcast-url" - - app "Caffeine.app" -end diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb deleted file mode 100644 index c26b429354174..0000000000000 --- a/Library/Homebrew/test/support/fixtures/cask/Casks/with-appcast.rb +++ /dev/null @@ -1,10 +0,0 @@ -cask "with-appcast" do - version "1.2.3" - sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94" - - url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" - appcast "https://brew.sh/appcast.xml" - homepage "https://brew.sh/with-appcast" - - app "Caffeine.app" -end diff --git a/Library/Homebrew/test/tap_spec.rb b/Library/Homebrew/test/tap_spec.rb index 940ac944f9530..2f85fe93728de 100644 --- a/Library/Homebrew/test/tap_spec.rb +++ b/Library/Homebrew/test/tap_spec.rb @@ -160,10 +160,6 @@ def setup_completion(link:) end end - specify "::names" do - expect(described_class.names.sort).to eq(["homebrew/core", "homebrew/foo"]) - end - specify "attributes" do expect(homebrew_foo_tap.user).to eq("Homebrew") expect(homebrew_foo_tap.repo).to eq("foo") diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 274cd1aff2976..f6cf4435267d9 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -345,12 +345,6 @@ def self.detect(url, **specs) parse(specs.fetch(:tag, url), detected_from_url: true) end - sig { params(val: String).returns(Version) } - def self.create(val) - odisabled "`Version.create`", "`Version.new`" - new(val) - end - sig { params(spec: T.any(String, Pathname), detected_from_url: T::Boolean).returns(T.attached_class) } def self.parse(spec, detected_from_url: false) spec = CGI.unescape(spec.to_s) if detected_from_url