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, ruby_cmd?

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.



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'dev-cmd/bump.rb', line 65

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.auto?
      raise UsageError, "`--formula` or `--cask` must be passed with `--auto`." if !args.formula? && !args.cask?

      tap_arg = args.tap
      raise UsageError, "`--tap=` must be passed with `--auto`." if tap_arg.blank?

      tap = Tap.fetch(tap_arg)
      autobump_list = tap.autobump
      what = args.cask? ? "casks" : "formulae"
      raise UsageError, "No autobumped #{what} found." if autobump_list.blank?

      autobump_list.map do |name|
        qualified_name = "#{tap.name}/#{name}"
        next Cask::CaskLoader.load(qualified_name) if args.cask?

        Formulary.factory(qualified_name)
      end
    elsif args.tap
      tap = Tap.fetch(args.tap)
      raise UsageError, "`--tap` requires `--auto` for 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