def self.run(args = nil)
cmd = new(args)
case cmd.command
when /^(?:--?)?status$/
cmd.status(cmd.command)
when /^(?:--?)?restart$/
cmd.stop(cmd.command)
cmd.start
when /^(?:--?)?start$/
cmd.start
when /^(?:--?)?create$/
cmd.create(cmd.command)
when /^(?:--?)?stop$/
if cmd.stop(cmd.command)
puts "Ramazement has ended, go in peace."
$stdout.flush
else
puts "Ramaze failed to stop (or was not running)"
end
when /^(?:--?)?console$/
require "ramaze"
require "irb"
require "irb/completion"
Ramaze.options.started = true
require "start"
IRB.start
puts "Ramazement has ended, go in peace."
when /^(?:--?)?h(elp)?$/
puts cmd.usage
when /^(?:--?)?v(ersion)?$/
cmd.include_ramaze
puts Ramaze::VERSION
exit
when /^$/
puts "Must supply a valid command"
puts cmd.usage
exit 1
else
puts "#{command} not implemented"
puts cmd.usage
exit 1
end
end