Class: Landrush::Command
- Inherits:
-
Object
- Object
- Landrush::Command
- Defined in:
- lib/landrush/command.rb
Constant Summary collapse
- DAEMON_COMMANDS =
%w(start stop restart status)
Instance Method Summary collapse
Instance Method Details
#boom(msg) ⇒ Object
26 27 28 |
# File 'lib/landrush/command.rb', line 26 def boom(msg) raise Vagrant::Errors::CLIInvalidOptions, :help => usage(msg) end |
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/landrush/command.rb', line 5 def execute ARGV.shift # flush landrush from ARGV, RExec wants to use it for daemon commands command = ARGV.first if DAEMON_COMMANDS.include?(command) Server.daemonize elsif command == 'dependentvms' if DependentVMs.any? @env.ui.info(DependentVMs.list.map { |dvm| " - #{dvm}" }.join("\n")) else @env.ui.info("No dependent VMs") end elsif command == 'install' ResolverConfig.ensure_config_exists else boom("'#{command}' is not a command") end 0 # happy exit code end |
#usage(msg) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/landrush/command.rb', line 30 def usage(msg); <<-EOS.gsub(/^ /, '') ERROR: #{msg} vagrant landrush <command> commands: {start|stop|restart|status} control the landrush server daemon dependentvms list vms currently dependent on the landrush server install install resolver config for host visbility (requires sudo) EOS end |