bin/drbqs-server in drbqs-0.0.7 vs bin/drbqs-server in drbqs-0.0.8
- old
+ new
@@ -11,20 +11,16 @@
Start DRbQS server of definition files.
HELP
options = {
- :log_file => STDOUT
+ :log_file => STDOUT,
+ :command_type => :server_start,
+ :acl => DRbQS::Config.get_acl_file
}
-if n = ARGV.index('--')
- command_argv = ARGV[0..(n - 1)]
- server_argv = ARGV[(n + 1)..-1]
-else
- command_argv = ARGV
- server_argv = []
-end
+command_argv, server_argv = DRbQS::Manage.split_arguments(ARGV)
begin
OptionParser.new(help_message) do |opt|
opt.on('-p PORT', '--port', Integer, 'Set the port number of server.') do |v|
options[:port] = v
@@ -44,10 +40,13 @@
end
end
opt.on('--debug', 'Set $DEBUG true.') do |v|
$DEBUG = true
end
+ opt.on('--test STR', String, 'Execute test.') do |v|
+ options[:command_type] = "test_#{v}"
+ end
opt.parse!(command_argv)
end
rescue OptionParser::InvalidOption
$stderr.print <<MES
error: Invalid Option
@@ -70,6 +69,13 @@
puts "load #{path}"
load path
end
DRbQS.parse_option(server_argv)
-DRbQS.start_server(options)
+case options[:command_type]
+when /^test/
+ s = options[:command_type].split('_')[1].split(',')
+ type = s[0].intern
+ DRbQS.test_server(options, type, s[1..-1])
+else
+ DRbQS.start_server(options)
+end