18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/spiderfw/cmd/cmd.rb', line 18
def initialize
@cmd = CmdParse::CommandParser.new({:handle_exceptions => true, :takes_commands => true})
@cmd.program_name = "spider"
@cmd.options = CmdParse::OptionParserWrapper.new do |opt|
opt.separator _("Global options:")
opt.on("--version", _("Output Spider version and exit"), "-v"){ |v|
require 'spiderfw/version'
puts Spider::VERSION
exit
}
opt.on("--verbose", _("Be verbose when outputting info"), "-V" ) {|t| $verbose = true }
opt.on("--chdir", _("Cd to a directory before running"), "-c"){ |c| Dir.chdir(c) }
opt.on("--sets SETS", Array, _("Include configuration sets"), "-s"){ |sets|
$SPIDER_CONFIG_SETS = sets
}
opt.on("--devel", _("Set runmode to devel"), "-d") do
$SPIDER_RUNMODE = 'devel'
end
opt.on("--test", _("Set runmode to test")) do
$SPIDER_RUNMODE = 'test'
end
opt.on("--http-proxy [PROXY]", _("Proxy server to use for http operations (http://user:pass@host:port)")){ |p|
ENV['http_proxy'] = p
}
end
@cmd.add_command(CmdParse::HelpCommand.new, true)
@cmd.add_command(WebServerCommand.new)
@cmd.add_command(CreateCommand.new)
@cmd.add_command(ConsoleCommand.new)
begin
require 'spiderfw/cmd/commands/cert'
@cmd.add_command(CertCommand.new)
rescue LoadError
end
@cmd.add_command(TestCommand.new)
@cmd.add_command(SetupCommand.new)
@cmd.add_command(ModelCommand.new)
@cmd.add_command(ConfigCommand.new)
@cmd.add_command(ContentCommand.new)
@cmd.add_command(AppCommand.new)
end
|