Class: DRbQS::Command::Server

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

Constant Summary collapse

HELP_MESSAGE =
<<HELP
Usage: #{@@command_name} <definition.rb> [other files ...] [options ...]
       #{@@command_name} <definition.rb> [other files ...] [options ...] -- [server options ...]
  Start DRbQS server of definition files.

HELP
@@command_name =
File.basename($PROGRAM_NAME)

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

#initializeServer

Returns a new instance of Server.



13
14
15
# File 'lib/drbqs/command_line/command_server.rb', line 13

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

Instance Method Details

#parse_option(argv) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/drbqs/command_line/command_server.rb', line 17

def parse_option(argv)
  command_argv, server_argv = split_arguments(argv)

  command_argv = option_parser_base(command_argv, :log_level => true, :daemon => true, :debug => true) do
    set(:port, '-p PORT', '--port', Integer, 'Set the port number of server.')
    set(:unix, '-u PATH', '--unix', String, 'Set the path of unix domain socket.')
    set(:acl, '--acl FILE', String, 'Set a file to define ACL.')
    set(:log_file, '--log-file STR', String, "Set the path of log file. If this options is not set, use STDOUT.")
    set(:sftp_user, '--sftp-user USER', String, 'Set the user of sftp destination.')
    set(:sftp_host, '--sftp-host HOST', String, 'Set the host of sftp destination.')
    set(:profile, '--profile', 'Use profile for test exec.')
    set(:profile_printer, '--profile-printer PRINTER', String,
        'Set the printer type for profile. The value is flat, graph, graphhtml, or calltree.')
    set(:test, '--test STR', String, 'Execute test.')
    set(:execute_node, '--execute-node NUM', Integer, 'Execute nodes.')
    set(:help, '-h', '--help', 'Show this command help and server specific help.') do |opt|
      $stdout.print opt
    end
  end
  setting.set_argument(*command_argv)
  setting.set_server_argument(*server_argv)
end