Class: DRbQS::Setting::Server
- Inherits:
-
Base
- Object
- Base
- DRbQS::Setting::Server
show all
- Includes:
- Misc
- Defined in:
- lib/drbqs/setting/server.rb
Constant Summary
collapse
- NODE_INTERVAL_TIME =
1
Constants included
from Misc
Misc::STRINGS_FOR_KEY
Instance Attribute Summary
Attributes inherited from Base
#source
Instance Method Summary
collapse
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
Methods inherited from Base
#clone, #string_for_shell, #value
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/drbqs/setting/server.rb', line 8
def initialize
super(:all_keys_defined => true, :log_level => true, :daemon => true) do
[:port, :unix, :acl, :sftp_user, :sftp_host,
:profile_printer, :test, :execute_node].each do |key|
register_key(key, :check => 1)
end
register_key(:log_file, :check => 1, :default => [STDOUT])
register_key(:profile, :bool => true)
register_key(:load, :add => true)
register_key(:help, :bool => true)
set_argument_condition(:>, 0)
end
@server_argument = DRbQS::Setting::Source.new(nil)
@command_type = :server_start
@test_opts = {}
@execute_node_number = nil
end
|
Instance Method Details
#command_line_argument(escape = nil) ⇒ Object
80
81
82
83
84
85
86
87
88
|
# File 'lib/drbqs/setting/server.rb', line 80
def command_line_argument(escape = nil)
ary = super(escape)
server_args = @server_argument.command_line_argument(escape)
if server_args.size > 0
ary << '--'
ary.concat(server_args)
end
ary
end
|
#exec(io = nil) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
# File 'lib/drbqs/setting/server.rb', line 213
def exec(io = nil)
if @command_type == :help
command_server_help(io)
elsif !fork_daemon_process
setup_arguments
case @command_type
when /^test/
command_test(io)
else
if @execute_node_number
command_server_with_nodes
else
command_start_server
end
end
end
true
end
|
#parse! ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/drbqs/setting/server.rb', line 55
def parse!
if get(:help)
@command_type = :help
return true
end
super
parse_test
parse_execute_node
@options[:port] = get_first(:port) do |val|
val.to_i
end
@options[:unix] = get_first(:unix)
@options[:acl] = get_first(:acl)
@options[:sftp_user] = get_first(:sftp_user)
@options[:sftp_host] = get_first(:sftp_host)
@options[:log_file] = get_first(:log_file)
@options.delete_if do |key, val|
!val
end
end
|
#set_server_argument(*args) ⇒ Object
76
77
78
|
# File 'lib/drbqs/setting/server.rb', line 76
def set_server_argument(*args)
@server_argument.set_argument(*args)
end
|