Class: Machines::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/machines/help.rb

Instance Method Summary collapse

Constructor Details

#initializeHelp

Returns a new instance of Help.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/machines/help.rb', line 3

def initialize
  @actions = {
    'htpasswd' => 'Generates basic auth in webserver/conf/htpasswd',
    'new <DIR>' => 'Generates an example machines project in DIR',
    'dryrun <machine> [tasks]' => 'Display commands that would be run. Optionally, specify tasks to run',
    'tasks <machine>' => 'Lists the available tasks for the specified machine',
    'build <machine> [tasks]' => 'Builds your chosen machine. Optionally, specify tasks to run',
    'list' => 'Lists the available machines',
    'packages' => 'Lists the available packages',
    'override <PACKAGE>' => 'Copies the default package into project/packages so it can be edited/overidden'
  }
end

Instance Method Details

#actionsObject



16
17
18
# File 'lib/machines/help.rb', line 16

def actions
  @actions.keys.map{|key| key.gsub(/ .*/, '')}
end

#machine_listObject



20
21
22
23
24
25
26
27
# File 'lib/machines/help.rb', line 20

def machine_list
  $conf.machines = AppConf.new
  $conf.load('machines.yml')
  <<-LIST
Machines from machines.yml:
#{$conf.machines.keys.map{|machine| "  #{machine}" }.join("\n")}
LIST
end

#syntaxObject



29
30
31
32
33
34
35
36
# File 'lib/machines/help.rb', line 29

def syntax
  <<-HELP
machines v#{Machines::VERSION} - Ubuntu/Ruby configuration tool.
machines COMMAND
COMMAND can be:
#{@actions.map{|action, help| "  %-25s#{help}" % action}.join("\n")}
HELP
end