class Bow::Command
Attributes
all[R]
names[R]
app[R]
Public Class Methods
command_name()
click to toggle source
# File lib/bow/command.rb, line 15 def command_name @command_name ||= name.to_s .split('::') .last .split(/([A-Z]{1}[^A-Z]*)/) .reject(&:empty?) .join('_') .downcase end
find(name)
click to toggle source
# File lib/bow/command.rb, line 25 def find(name) index = @names.index name.to_s @all[index] if index end
inherited(command_class)
click to toggle source
# File lib/bow/command.rb, line 8 def inherited(command_class) @all ||= [] @names ||= [] @all << command_class @names << command_class.command_name end
new(app = nil, argv = [])
click to toggle source
# File lib/bow/command.rb, line 35 def initialize(app = nil, argv = []) @app = app @argv = argv end
Public Instance Methods
command_name()
click to toggle source
# File lib/bow/command.rb, line 48 def command_name self.class.command_name end
description()
click to toggle source
# File lib/bow/command.rb, line 40 def description @description ||= "Command #{command_name} description" end
targets()
click to toggle source
# File lib/bow/command.rb, line 52 def targets user = app.options[:user] group = app.options[:group] app.targets(user).hosts(group) end
usage()
click to toggle source
# File lib/bow/command.rb, line 44 def usage @usage ||= "bow #{command_name} [args] [options]" end