Class: DRbQS::Command::Execute

Inherits:
Base
  • Object
show all
Defined in:
lib/drbqs/command_line/command_execute.rb

Constant Summary collapse

HELP_MESSAGE =
<<HELP
Usage: #{@@command_name} <definition> [options ...]
       #{@@command_name} <definition> [options ...] [-- server options ...]
  Execute DRbQS server and some nodes from definition file.

HELP

Constants included from Misc

Misc::STRINGS_FOR_KEY

Instance Method Summary collapse

Methods inherited from Base

exec, #exec, #setting

Methods included from Argument

check_argument_size, split_arguments

Methods included from Misc

create_logger, create_uri, output_error, process_running_normally?, random_key, time_to_history_string, time_to_history_string2, uri_drbunix

Constructor Details

#initializeExecute

Returns a new instance of Execute.



11
12
13
# File 'lib/drbqs/command_line/command_execute.rb', line 11

def initialize
  super(DRbQS::Setting::Execute, HELP_MESSAGE)
end

Instance Method Details

#parse_option(argv) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/drbqs/command_line/command_execute.rb', line 15

def parse_option(argv)
  args, server_args = split_arguments(argv)
  args = option_parser_base(args) do
    set(:port, '-p NUM', '--port NUM', Integer, 'Set the port number.')
    set(:server, '-s STR', '--server STR', String, 'Set the key of server.')
    set(:node, '-n STR', '--node STR', String, 'Set the comma sparated key of nodes.')
    set(:no_server, '--no-server', 'Not execute server.')
    set(:no_node, '--no-node', 'Not execute node.')
    set(:wait_server_finish, "--wait-server-finish", "Wait finish of server process.")
    set(:information, '-i', '--information', 'Show information.')
    set(:help, '-h', '--help', 'Show this command help and usage of definition file.') do |opt|
      $stdout.print opt
    end
  end
  setting.set_argument(*args)
  setting.server_argument = server_args
end