Class: Homebrew::Cmd::Info Private

Inherits:
AbstractCommand show all
Defined in:
cmd/info.rb,
sorbet/rbi/dsl/homebrew/cmd/info.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

Constant Summary collapse

VALID_DAYS =

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

%w[30 90 365].freeze
VALID_FORMULA_CATEGORIES =

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

%w[install install-on-request build-error].freeze
VALID_CATEGORIES =

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

(VALID_FORMULA_CATEGORIES + %w[cask-install os-version]).freeze

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::Cmd::Info::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/cmd/info.rbi', line 10

def args; end

#github_remote_path(remote, path) ⇒ Object

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.



114
115
116
117
118
119
120
# File 'cmd/info.rb', line 114

def github_remote_path(remote, path)
  if remote =~ %r{^(?:https?://|git(?:@|://))github\.com[:/](.+)/(.+?)(?:\.git)?$}
    "https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/blob/HEAD/#{path}"
  else
    "#{remote}/#{path}"
  end
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.



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
# File 'cmd/info.rb', line 81

def run
  if args.analytics?
    if args.days.present? && VALID_DAYS.exclude?(args.days)
      raise UsageError, "`--days` must be one of #{VALID_DAYS.join(", ")}."
    end

    if args.category.present?
      if args.named.present? && VALID_FORMULA_CATEGORIES.exclude?(args.category)
        raise UsageError,
              "`--category` must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae."
      end

      unless VALID_CATEGORIES.include?(args.category)
        raise UsageError, "`--category` must be one of #{VALID_CATEGORIES.join(", ")}."
      end
    end

    print_analytics
  elsif args.json
    all = args.eval_all?

    print_json(all)
  elsif args.github?
    raise FormulaOrCaskUnspecifiedError if args.no_named?

    exec_browser(*args.named.to_formulae_and_casks.map { |f| github_info(f) })
  elsif args.no_named?
    print_statistics
  else
    print_info
  end
end