Class: Homebrew::DevCmd::Bump Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/bump.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args, VersionBumpInfo

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::Bump::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/bump.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'dev-cmd/bump.rb', line 61

def run
  Homebrew.install_bundler_gems!(groups: ["livecheck"])

  Homebrew.with_no_api_env do
    eval_all = args.eval_all? || Homebrew::EnvConfig.eval_all?

    formulae_and_casks = if args.tap
      tap = Tap.fetch(T.must(args.tap))
      raise UsageError, "`--tap` cannot be used with official taps." if tap.official?

      formulae = args.cask? ? [] : tap.formula_files.map { |path| Formulary.factory(path) }
      casks = args.formula? ? [] : tap.cask_files.map { |path| Cask::CaskLoader.load(path) }
      formulae + casks
    elsif args.installed?
      formulae = args.cask? ? [] : Formula.installed
      casks = args.formula? ? [] : Cask::Caskroom.casks
      formulae + casks
    elsif args.named.present?
      args.named.to_formulae_and_casks_with_taps
    elsif eval_all
      formulae = args.cask? ? [] : Formula.all(eval_all:)
      casks = args.formula? ? [] : Cask::Cask.all(eval_all:)
      formulae + casks
    else
      raise UsageError,
            "`brew bump` without named arguments needs `--installed` or `--eval-all` passed or " \
            "`HOMEBREW_EVAL_ALL` set!"
    end

    if args.start_with
      formulae_and_casks.select! do |formula_or_cask|
        name = formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
        name.start_with?(args.start_with)
      end
    end

    formulae_and_casks = formulae_and_casks&.sort_by do |formula_or_cask|
      formula_or_cask.respond_to?(:token) ? formula_or_cask.token : formula_or_cask.name
    end

    if args.repology? && !Utils::Curl.curl_supports_tls13?
      begin
        ensure_formula_installed!("curl", reason: "Repology queries") unless HOMEBREW_BREWED_CURL_PATH.exist?
      rescue FormulaUnavailableError
        opoo "A newer `curl` is required for Repology queries."
      end
    end

    handle_formulae_and_casks(formulae_and_casks)
  end
end