class AcquiaToolbelt::Thor

Public Class Methods

banner(task, task_help = false, subcommand = false) click to toggle source
banner_base() click to toggle source

Define a base for the commands.

handle_no_task_error(task) click to toggle source
# File lib/acquia_toolbelt/thor.rb, line 62
def self.handle_no_task_error(task)
  raise UndefinedTaskError, "Could not find command #{task.inspect}."
end
help(shell, subcommand = false) click to toggle source
# File lib/acquia_toolbelt/thor.rb, line 17
def self.help(shell, subcommand = false)
  list = printable_commands(true, subcommand).sort! { |a, b| a[0] <=> b[0] }

  shell.say "Type 'acquia [COMMAND] help' for more details on subcommands or to show example usage."

  if @package_name
    shell.say "#{@package_name} commands:"
  else
    shell.say
    shell.say 'Commands:'
  end

  shell.print_table(list, :indent => 2, :truncate => true)
  shell.say unless subcommand
  class_options_help(shell)
end
printable_commands(all = true, subcommand = true) click to toggle source
# File lib/acquia_toolbelt/thor.rb, line 34
def self.printable_commands(all = true, subcommand = true)
  (all ? all_commands : commands).map do |_, command|
    # Don't show the hidden commands or the help commands.
    next if command.hidden? || next if command.name.include? 'help'
    item = []
    item << banner(command, false, subcommand)
    item << (command.description ? "# #{command.description.gsub(/\s+/m,' ')}" : '') unless command.description.empty?
    item
  end.compact
end
subcommand(name, klass) click to toggle source
Calls superclass method Thor::subcommand
# File lib/acquia_toolbelt/thor.rb, line 66
def self.subcommand(name, klass)
  @@subcommand_class_for ||= {}
  @@subcommand_class_for[name] = klass
  super
end
subcommand_class_for(name) click to toggle source
# File lib/acquia_toolbelt/thor.rb, line 72
def self.subcommand_class_for(name)
  @@subcommand_class_for ||= {}
  @@subcommand_class_for[name]
end

Protected Class Methods

exit_on_failure?() click to toggle source
# File lib/acquia_toolbelt/thor.rb, line 81
def self.exit_on_failure?
  true
end