Class: Homebrew::DevCmd::Bump

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/bump.rb

Defined Under Namespace

Classes: VersionBumpInfo

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#runvoid

This method returns an undefined value.



59
60
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
# File 'dev-cmd/bump.rb', line 59

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

  if args.limit.present? && !args.formula? && !args.cask?
    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))
      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?
      if args.formula?
        args.named.to_formulae
      elsif args.cask?
        args.named.to_casks
      else
        args.named.to_formulae_and_casks
      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

    unless 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

    if formulae_and_casks.present?
      handle_formula_and_casks(formulae_and_casks)
    else
      handle_api_response
    end
  end
end