Class: Homebrew::DevCmd::GenerateCaskToken Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/generate-cask-token.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/generate_cask_token.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

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::GenerateCaskToken::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/generate_cask_token.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.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'dev-cmd/generate-cask-token.rb', line 25

def run
  app_name = Cask::TokenGenerator.simplified_app_name(args.named.fetch(0))
  token = Cask::TokenGenerator.token_for(app_name)
  file_name = "#{token}.rb"

  puts "Proposed Simplified App name: #{app_name}" if args.debug?
  puts "Proposed token:               #{token}"
  puts "Proposed file name:           #{file_name}"
  puts "Cask Header Line:             cask \"#{token}\" do"

  warnings = Cask::TokenGenerator.warnings(token)
  duplicate = CoreCaskTap.instance.cask_tokens.include?(token)
  if duplicate
    warnings << "A cask named '#{token}' already exists. " \
                "Prepend the vendor name if this is not a duplicate."
  end

  warnings.each { |warning| opoo warning }
  # The other warnings are advisory: only a duplicate token needs a rethink.
  Homebrew.failed = true if duplicate
end