drbqs 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/VERSION +1 -1
  2. data/bin/drbqs-execute +6 -0
  3. data/bin/drbqs-manage +2 -2
  4. data/bin/drbqs-node +2 -2
  5. data/bin/drbqs-server +2 -2
  6. data/bin/drbqs-ssh +2 -2
  7. data/drbqs.gemspec +53 -16
  8. data/example/error_server/error.rb +6 -0
  9. data/example/error_server/server_def.rb +7 -0
  10. data/example/{error → error_task}/error.rb +0 -0
  11. data/example/{error → error_task}/server_def.rb +0 -0
  12. data/example/sum2/execute_def.rb +27 -0
  13. data/lib/drbqs/command_line/argument.rb +29 -0
  14. data/lib/drbqs/command_line/command_base.rb +81 -0
  15. data/lib/drbqs/command_line/command_execute.rb +33 -0
  16. data/lib/drbqs/command_line/command_line.rb +19 -0
  17. data/lib/drbqs/command_line/command_manage.rb +34 -0
  18. data/lib/drbqs/command_line/command_node.rb +26 -0
  19. data/lib/drbqs/command_line/command_server.rb +41 -0
  20. data/lib/drbqs/command_line/command_ssh.rb +51 -0
  21. data/lib/drbqs/command_line/option_setting.rb +42 -0
  22. data/lib/drbqs/execute/process_define.rb +213 -0
  23. data/lib/drbqs/execute/register.rb +147 -0
  24. data/lib/drbqs/{utility → execute}/server_define.rb +7 -14
  25. data/lib/drbqs/manage/execute_node.rb +4 -2
  26. data/lib/drbqs/manage/manage.rb +23 -16
  27. data/lib/drbqs/manage/send_signal.rb +31 -4
  28. data/lib/drbqs/manage/ssh_execute.rb +50 -6
  29. data/lib/drbqs/manage/ssh_shell.rb +95 -50
  30. data/lib/drbqs/node/connection.rb +1 -1
  31. data/lib/drbqs/node/node.rb +67 -17
  32. data/lib/drbqs/node/state.rb +109 -0
  33. data/lib/drbqs/node/task_client.rb +7 -7
  34. data/lib/drbqs/server/history.rb +16 -0
  35. data/lib/drbqs/server/message.rb +80 -15
  36. data/lib/drbqs/server/node_list.rb +16 -3
  37. data/lib/drbqs/server/prof.rb +48 -0
  38. data/lib/drbqs/server/queue.rb +20 -2
  39. data/lib/drbqs/server/server.rb +112 -70
  40. data/lib/drbqs/server/server_hook.rb +26 -6
  41. data/lib/drbqs/server/test/node.rb +34 -0
  42. data/lib/drbqs/server/test/server.rb +74 -0
  43. data/lib/drbqs/setting/base.rb +120 -0
  44. data/lib/drbqs/setting/data_container.rb +39 -0
  45. data/lib/drbqs/setting/execute.rb +71 -0
  46. data/lib/drbqs/setting/manage.rb +163 -0
  47. data/lib/drbqs/setting/node.rb +84 -0
  48. data/lib/drbqs/setting/server.rb +230 -0
  49. data/lib/drbqs/setting/setting.rb +14 -0
  50. data/lib/drbqs/setting/source.rb +220 -0
  51. data/lib/drbqs/setting/ssh.rb +165 -0
  52. data/lib/drbqs/task/task_generator.rb +4 -2
  53. data/lib/drbqs/utility/misc.rb +15 -1
  54. data/lib/drbqs/utility/temporary.rb +4 -2
  55. data/lib/drbqs.rb +3 -2
  56. data/spec/command_line/command_base_spec.rb +47 -0
  57. data/spec/{utility/command_line → command_line}/commands_spec.rb +3 -3
  58. data/spec/command_line/option_setting_spec.rb +29 -0
  59. data/spec/execute/def/execute1.rb +24 -0
  60. data/spec/execute/def/no_def.rb +2 -0
  61. data/spec/execute/process_define_spec.rb +167 -0
  62. data/spec/execute/register_spec.rb +77 -0
  63. data/spec/{utility → execute}/server_define_spec.rb +0 -0
  64. data/spec/integration_test/01_basic_usage_spec.rb +1 -1
  65. data/spec/integration_test/02_use_generator_spec.rb +1 -1
  66. data/spec/integration_test/03_use_temporary_file_spec.rb +1 -1
  67. data/spec/integration_test/04_use_unix_domain_spec.rb +1 -1
  68. data/spec/integration_test/05_server_exit_signal_spec.rb +1 -1
  69. data/spec/integration_test/06_node_exit_after_task_spec.rb +1 -1
  70. data/spec/integration_test/07_command_server_with_node_spec.rb +19 -16
  71. data/spec/integration_test/08_shutdown_unused_nodes_spec.rb +38 -0
  72. data/spec/integration_test/09_server_process_data_spec.rb +74 -0
  73. data/spec/integration_test/10_test_server_spec.rb +18 -0
  74. data/spec/integration_test/definition/task_obj_definition.rb +14 -0
  75. data/spec/manage/send_signal_spec.rb +8 -0
  76. data/spec/manage/ssh_shell_spec.rb +1 -1
  77. data/spec/node/state_spec.rb +148 -0
  78. data/spec/node/task_client_spec.rb +15 -0
  79. data/spec/server/history_spec.rb +51 -20
  80. data/spec/server/message_spec.rb +7 -2
  81. data/spec/server/node_list_spec.rb +1 -1
  82. data/spec/server/queue_spec.rb +93 -4
  83. data/spec/server/server_hook_spec.rb +62 -0
  84. data/spec/setting/base_spec.rb +35 -0
  85. data/spec/setting/data_container_spec.rb +92 -0
  86. data/spec/setting/execute_spec.rb +51 -0
  87. data/spec/setting/manage_spec.rb +63 -0
  88. data/spec/setting/node_spec.rb +43 -0
  89. data/spec/setting/server_spec.rb +46 -0
  90. data/spec/setting/source_spec.rb +245 -0
  91. data/spec/spec_helper.rb +17 -10
  92. data/spec/utility/argument_spec.rb +7 -7
  93. metadata +179 -146
  94. data/lib/drbqs/utility/argument.rb +0 -27
  95. data/lib/drbqs/utility/command_line/command_base.rb +0 -27
  96. data/lib/drbqs/utility/command_line/command_manage.rb +0 -121
  97. data/lib/drbqs/utility/command_line/command_node.rb +0 -103
  98. data/lib/drbqs/utility/command_line/command_server.rb +0 -165
  99. data/lib/drbqs/utility/command_line/command_ssh.rb +0 -126
  100. data/lib/drbqs/utility/command_line.rb +0 -15
  101. data/spec/utility/command_line/command_base_spec.rb +0 -33
@@ -1,121 +0,0 @@
1
- module DRbQS
2
- class CommandManage < CommandBase
3
- HELP_MESSAGE =<<HELP
4
- Usage: #{@@command_name} <command> [arguments ...]
5
- Manage DRbQS server by sending messages.
6
- <command> is 'signal', 'status', 'process', or 'initialize'.
7
-
8
- #{@@command_name} signal <uri> server-exit
9
- #{@@command_name} signal <uri> node-exit-after-task <node_number>
10
- #{@@command_name} status <uri>
11
- #{@@command_name} process list
12
- #{@@command_name} process clear
13
- #{@@command_name} initialize
14
-
15
- HELP
16
-
17
- def parse_option(argv)
18
- begin
19
- OptionParser.new(HELP_MESSAGE) do |opt|
20
- opt.on('--debug', 'Set $DEBUG true.') do |v|
21
- $DEBUG = true
22
- end
23
- opt.parse!(argv)
24
- end
25
- rescue OptionParser::InvalidOption
26
- $stderr.print "error: Invalid Option\n\n" << HELP_MESSAGE
27
- exit_invalid_option
28
- rescue OptionParser::InvalidArgument
29
- $stderr.print "error: Invalid Argument\n\n" << HELP_MESSAGE
30
- exit_invalid_option
31
- end
32
- @mode = argv.shift
33
- @argv = argv
34
- @manage = DRbQS::Manage.new
35
- end
36
-
37
- def command_initialize
38
- check_argument_size(@argv, :>=, 0, :<=, 1)
39
- @manage.set_home_directory(@argv[0])
40
- @manage.create_config
41
- exit_normally
42
- end
43
- private :command_initialize
44
-
45
- def command_process
46
- check_argument_size(@argv, :>=, 0, :<=, 1)
47
- if @argv[0] == 'clear'
48
- @manage.clear_process
49
- exit_normally
50
- end
51
- list = @manage.list_process
52
- $stdout.puts "Server"
53
- list[:server].each do |uri, data|
54
- $stdout.puts "#{uri}"
55
- data.each do |k, v|
56
- $stdout.puts sprintf(" %-10s %s", k, v)
57
- end
58
- end
59
- $stdout.puts "\nNode"
60
- list[:node].each do |pid, data|
61
- $stdout.puts "#{pid}"
62
- data.each do |k, v|
63
- $stdout.puts sprintf(" %-10s %s", k, v)
64
- end
65
- end
66
- exit_normally
67
- end
68
- private :command_process
69
-
70
- def command_status
71
- check_argument_size(@argv, :==, 1)
72
- @manage.set_uri(@argv[0])
73
- if status = @manage.get_status
74
- $stdout.puts status
75
- end
76
- exit_normally
77
- end
78
- private :command_status
79
-
80
- def command_signal
81
- @manage.set_uri(@argv[0])
82
- signal = @argv[1]
83
- case signal
84
- when 'server-exit'
85
- check_argument_size(@argv, :==, 2)
86
- @manage.send_exit_signal
87
- exit_normally
88
- when 'node-exit-after-task'
89
- check_argument_size(@argv, :==, 3)
90
- node_id = @argv[2].to_i
91
- @manage.send_node_exit_after_task(node_id)
92
- exit_normally
93
- else
94
- $stderr.print "error: Invalid signal '#{signal}'\n\n" << HELP_MESSAGE
95
- exit_unusually
96
- end
97
- end
98
- private :command_signal
99
-
100
- def exec
101
- case @mode
102
- when 'initialize'
103
- command_initialize
104
- when 'process'
105
- command_process
106
- when 'status'
107
- command_status
108
- when 'signal'
109
- command_signal
110
- end
111
- $stderr.print "error: Invalid command '#{@mode}'\n\n" << HELP_MESSAGE
112
- exit_invalid_option
113
- rescue DRb::DRbConnError => err
114
- $stderr.puts "error: Can not connect server: #{err.to_s}"
115
- exit_unusually
116
- rescue => err
117
- $stderr.print "error: #{err.to_s}\n" << err.backtrace.join("\n")
118
- exit_unusually
119
- end
120
- end
121
- end
@@ -1,103 +0,0 @@
1
- module DRbQS
2
- class CommandNode < CommandBase
3
- HELP_MESSAGE =<<HELP
4
- Usage: #{@@command_name} [<uri>] [<process_number>] [options ...]
5
- Start DRbQS nodes connecting to <uri>.
6
-
7
- HELP
8
-
9
- LOG_PREFIX_DEFAULT = 'drbqs_node'
10
- LOG_LEVEL_DEFAULT = Logger::ERROR
11
-
12
- def parse_option(argv)
13
- options = {
14
- :log_prefix => LOG_PREFIX_DEFAULT,
15
- :log_level => LOG_LEVEL_DEFAULT,
16
- :load => []
17
- }
18
-
19
- begin
20
- OptionParser.new(HELP_MESSAGE) do |opt|
21
- opt.on('-l', '--load FILE', String, 'Add a file to load.') do |v|
22
- options[:load] << File.expand_path(v)
23
- end
24
- opt.on('--log-prefix STR', String, "Set the prefix of log files. The default is '#{LOG_PREFIX_DEFAULT}'.") do |v|
25
- options[:log_prefix] = v
26
- end
27
- opt.on('--log-level LEVEL', String,
28
- "Set the log level. The value accepts 'fatal', 'error', 'warn', 'info', and 'debug'. The default is 'error'.") do |v|
29
- if /^(fatal)|(error)|(warn)|(info)|(debug)$/i =~ v
30
- options[:log_level] = eval("Logger::#{v.upcase}")
31
- else
32
- $stderr.print "error: Invalid log level.\n\n" << HELP_MESSAGE
33
- exit_invalid_option
34
- end
35
- end
36
- opt.on('--log-stdout', 'Use stdout for outputting logs. This option cancels --log-prefix.') do |v|
37
- options[:log_prefix] = nil
38
- end
39
- opt.on('--debug', 'Set $DEBUG true.') do |v|
40
- $DEBUG = true
41
- end
42
- opt.parse!(argv)
43
- end
44
- rescue OptionParser::InvalidOption
45
- $stderr.print "error: Invalid Option\n\n" << HELP_MESSAGE
46
- exit_invalid_option
47
- rescue OptionParser::InvalidArgument
48
- $stderr.print "error: Invalid Argument\n\n" << HELP_MESSAGE
49
- exit_invalid_option
50
- end
51
- @options = options
52
- @argv = argv
53
- end
54
-
55
- def parse_argv_array
56
- process_num = 1
57
- uri = nil
58
- @argv.each do |arg|
59
- if /^\d+$/ =~ arg
60
- process_num = arg.to_i
61
- elsif uri
62
- $stderr.print "error: More than one uris is set.\n\n" << HELP_MESSAGE
63
- exit_invalid_option
64
- else
65
- uri = arg
66
- end
67
- end
68
- uri ||= DRbQS::Misc.create_uri
69
- [process_num, uri]
70
- end
71
- private :parse_argv_array
72
-
73
- def exec
74
- if @argv.size > 2
75
- $stderr.print "error: Too many arguments.\n\n" << HELP_MESSAGE
76
- exit_invalid_option
77
- end
78
- process_num, uri = parse_argv_array
79
-
80
- @options[:load].each do |v|
81
- $stdout.puts "load #{v}"
82
- load v
83
- end
84
-
85
- $stdout.puts "Connect to #{uri}"
86
- $stdout.puts "Execute #{process_num} processes"
87
-
88
- if @options[:log_prefix]
89
- if /\/$/ =~ @options[:log_prefix]
90
- @options[:log_prefix] += 'out'
91
- end
92
- end
93
-
94
- exec_node = DRbQS::ExecuteNode.new(uri, @options[:log_prefix], @options[:log_level])
95
- exec_node.execute(process_num)
96
- exec_node.wait
97
- exit_normally
98
- rescue => err
99
- $stderr.print "error: #{err.to_s}\n" << err.backtrace.join("\n")
100
- exit_unusually
101
- end
102
- end
103
- end
@@ -1,165 +0,0 @@
1
- module DRbQS
2
- class CommandServer < CommandBase
3
- @@command_name = File.basename($PROGRAM_NAME)
4
-
5
- HELP_MESSAGE =<<HELP
6
- Usage: #{@@command_name} <definition.rb> [other files ...] [options ...]
7
- #{@@command_name} <definition.rb> [other files ...] [options ...] -- [server options ...]
8
- Start DRbQS server of definition files.
9
-
10
- HELP
11
-
12
- NODE_INTERVAL_TIME = 1
13
-
14
- def parse_option(argv)
15
- @options = {
16
- :log_file => STDOUT
17
- }
18
- @command_type = :server_start
19
-
20
- test_opts = {}
21
- @execute_node_number = nil
22
- @command_argv, @server_argv = split_arguments(argv)
23
-
24
- begin
25
- OptionParser.new(HELP_MESSAGE) do |opt|
26
- opt.on('-p PORT', '--port', Integer, 'Set the port number of server.') do |v|
27
- @options[:port] = v
28
- end
29
- opt.on('-u PATH', '--unix', String, 'Set the path of unix domain socket.') do |v|
30
- @options[:unix] = v
31
- end
32
- opt.on('--acl FILE', String, 'Set a file to define ACL.') do |v|
33
- @options[:acl] = v
34
- end
35
- opt.on('--log-file STR', String, "Set the path of log file. If this options is not set, use STDOUT.") do |v|
36
- @options[:log_file] = v
37
- end
38
- opt.on('--log-level LEVEL', String,
39
- "Set the log level. The value accepts 'fatal', 'error', 'warn', 'info', and 'debug'. The default is 'error'.") do |v|
40
- if /^(fatal)|(error)|(warn)|(info)|(debug)$/i =~ v
41
- @options[:log_level] = eval("Logger::#{v.upcase}")
42
- else
43
- $stderr.print "error: Invalid log level.\n\n" << HELP_MESSAGE
44
- exit_invalid_option
45
- end
46
- end
47
- opt.on('--file-directory DIR', String, 'Set the file archive directory.') do |v|
48
- @options[:file_directory] = v
49
- end
50
- opt.on('--sftp-user USER', String, 'Set the user of sftp destination.') do |v|
51
- @options[:sftp_user] = v
52
- end
53
- opt.on('--sftp-host HOST', String, 'Set the host of sftp destination.') do |v|
54
- @options[:sftp_host] = v
55
- end
56
- opt.on('--profile', 'Use profile for test exec.') do |v|
57
- @test_opts[:profile] = true
58
- end
59
- opt.on('--debug', 'Set $DEBUG true.') do |v|
60
- $DEBUG = true
61
- end
62
- opt.on('--test STR', String, 'Execute test.') do |v|
63
- @command_type = "test_#{v}"
64
- end
65
- opt.on('--execute-node NUM', Integer, 'Execute nodes.') do |v|
66
- @execute_node_number = v
67
- end
68
- opt.on('-h', '--help', 'Show help.') do |v|
69
- $stdout.print opt
70
- @command_type = :help
71
- end
72
- opt.parse!(@command_argv)
73
- end
74
- rescue OptionParser::InvalidOption
75
- $stderr.print "error: Invalid Option\n\n" << HELP_MESSAGE
76
- exit_invalid_option
77
- rescue OptionParser::InvalidArgument
78
- $stderr.print "error: Invalid Argument\n\n" << HELP_MESSAGE
79
- exit_invalid_option
80
- end
81
- end
82
-
83
- def command_test
84
- s = @command_type.split('_')[1].split(',')
85
- type = s[0].intern
86
- DRbQS.test_server(@options, type, s[1..-1], @test_opts)
87
- end
88
- private :command_test
89
-
90
- def command_start_server
91
- DRbQS.start_server(@options)
92
- end
93
- private :command_start_server
94
-
95
- def command_server_with_nodes
96
- server_pid = fork do
97
- DRbQS.start_server(@options)
98
- end
99
- uri = DRbQS::Misc.create_uri(@options)
100
- manage = DRbQS::Manage.new(:uri => uri)
101
- if manage.wait_server_process(server_pid)
102
- node_log_file = nil
103
- unless IO === @options[:log_file]
104
- node_log_file = FileName.create(@options[:log_file], :add => :always, :position => :middle, :delimiter => '', :format => "_node_%02d")
105
- end
106
- exec_node = DRbQS::ExecuteNode.new(uri, node_log_file, @options[:log_level])
107
- exec_node.execute(@execute_node_number, NODE_INTERVAL_TIME)
108
- exec_node.wait
109
- else
110
- $stderr.puts "error: Server has been terminated."
111
- exit_unusually
112
- end
113
- end
114
- private :command_server_with_nodes
115
-
116
- def command_server_help
117
- begin
118
- @command_argv.each do |path|
119
- if File.exist?(path)
120
- load path
121
- end
122
- end
123
- if mes = DRbQS.option_help_message
124
- $stdout.print "\n" << mes
125
- end
126
- rescue => err
127
- $stderr.print "error: Load invalid file.\n#{err.to_s}\n#{err.backtrace.join("\n")}"
128
- exit_invalid_option
129
- end
130
- exit_normally
131
- end
132
- private :command_server_help
133
-
134
- def exec
135
- if @command_type == :help
136
- command_server_help
137
- end
138
- if @command_argv.size == 0 || !(@command_argv.all? { |path| File.exist?(path) })
139
- $stderr.print "error: There are nonexistent files.\n\n" << HELP_MESSAGE
140
- exit_unusually
141
- end
142
- @command_argv.each do |path|
143
- load path
144
- end
145
- unless @options[:acl]
146
- @options[:acl] = DRbQS::Config.new.get_acl_file
147
- end
148
- DRbQS.parse_option(@server_argv)
149
- case @command_type
150
- when /^test/
151
- command_test
152
- else
153
- if @execute_node_number
154
- command_server_with_nodes
155
- else
156
- command_start_server
157
- end
158
- end
159
- exit_normally
160
- rescue => err
161
- $stderr.print "error: #{err.to_s}\n" << err.backtrace.join("\n")
162
- exit_unusually
163
- end
164
- end
165
- end
@@ -1,126 +0,0 @@
1
- module DRbQS
2
- class CommandSSH < CommandBase
3
- HELP_MESSAGE =<<HELP
4
- Usage: #{@@command_name} <command> [arguments ...]
5
- Execute command over SSH.
6
- <command> is 'list', 'show', 'execute', or 'environment'
7
-
8
- #{@@command_name} list
9
- #{@@command_name} show <configuration>
10
- #{@@command_name} environment <destination>
11
- #{@@command_name} execute <destination>
12
-
13
- HELP
14
-
15
- def parse_option(argv)
16
- options = {}
17
- argv, command_args = split_arguments(argv)
18
-
19
- begin
20
- OptionParser.new(HELP_MESSAGE) do |opt|
21
- opt.on('--debug', 'Set $DEBUG true.') do |v|
22
- $DEBUG = true
23
- end
24
- opt.on('--dir DIR', String, 'Set the base directory over ssh.') do |v|
25
- options[:dir] = v
26
- end
27
- opt.on('--shell STR', String, 'Set the shell over ssh') do |v|
28
- options[:shell] = v
29
- end
30
- opt.on('--rvm STR', String, 'Ruby version to use on RVM over ssh.') do |v|
31
- options[:rvm] = v
32
- end
33
- opt.on('--rvm-init PATH', String, 'Path of script to initialize RVM over ssh.') do |v|
34
- options[:rvm_init] = v
35
- end
36
- opt.on('--output PATH', String, 'File path that stdout and stderr are output to over ssh.') do |v|
37
- options[:output] = v
38
- end
39
- opt.on('--nice NUM', Integer, 'Set the value for nice command.') do |v|
40
- options[:nice] = v
41
- end
42
- opt.on('--nohup', 'Use nohup command.') do |v|
43
- options[:nohup] = true
44
- end
45
- opt.parse!(argv)
46
- end
47
- rescue OptionParser::InvalidOption
48
- $stderr.print "error: Invalid Option\n\n" << HELP_MESSAGE
49
- exit_invalid_option
50
- rescue OptionParser::InvalidArgument
51
- $stderr.print "error: Invalid Argument\n\n" << HELP_MESSAGE
52
- exit_invalid_option
53
- end
54
- @options = options
55
- @command = argv.shift
56
- @argv = argv
57
- @command_args = command_args
58
- end
59
-
60
- def command_list
61
- ssh_host = DRbQS::Config.new.ssh_host
62
- $stdout.puts ssh_host.config_names.join("\n")
63
- exit_normally
64
- end
65
- private :command_list
66
-
67
- def command_show
68
- check_argument_size(@argv, :==, 1)
69
- name = @argv[0]
70
- ssh_host = DRbQS::Config.new.ssh_host
71
- if path = ssh_host.get_path(name)
72
- $stdout.puts File.read(path)
73
- exit_normally
74
- else
75
- $stderr.print "Can not find configuration file '#{name}'."
76
- exit_unusually
77
- end
78
- end
79
- private :command_show
80
-
81
- def manage_ssh(dest)
82
- DRbQS::Manage::SSHExecute.new(dest, @options)
83
- end
84
- private :manage_ssh
85
-
86
- def command_environment
87
- check_argument_size(@argv, :==, 1)
88
- dest = @argv[0]
89
- manage_ssh(dest).get_environment
90
- exit_normally
91
- end
92
- private :command_environment
93
-
94
- def command_execute
95
- check_argument_size(@argv, :==, 1)
96
- dest = @argv[0]
97
- mng_ssh = manage_ssh(dest)
98
- if @command_args.size > 0
99
- mng_ssh.execute(@command_args)
100
- exit_normally
101
- else
102
- $stderr.print "error: There is no command for ssh.\n\n" << HELP_MESSAGE
103
- exit_unusually
104
- end
105
- end
106
- private :command_execute
107
-
108
- def exec
109
- case @command
110
- when 'list'
111
- command_list
112
- when 'show'
113
- command_show
114
- when 'environment'
115
- command_environment
116
- when 'execute'
117
- command_execute
118
- end
119
- $stderr.print "error: Invalid command '#{@command}'.\n\n" << HELP_MESSAGE
120
- exit_invalid_option
121
- rescue => err
122
- $stderr.print "error: #{err.to_s}\n" << err.backtrace.join("\n")
123
- exit_unusually
124
- end
125
- end
126
- end
@@ -1,15 +0,0 @@
1
- require 'drbqs'
2
- require 'drbqs/utility/argument'
3
- require 'drbqs/manage/manage'
4
- require 'drbqs/manage/execute_node'
5
- require 'drbqs/utility/command_line/command_base'
6
- require 'optparse'
7
-
8
- Version = DRbQS::VERSION
9
-
10
- module DRbQS
11
- autoload :CommandManage, 'drbqs/utility/command_line/command_manage'
12
- autoload :CommandServer, 'drbqs/utility/command_line/command_server'
13
- autoload :CommandNode, 'drbqs/utility/command_line/command_node'
14
- autoload :CommandSSH, 'drbqs/utility/command_line/command_ssh'
15
- end
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- require 'drbqs/utility/command_line'
4
-
5
- describe DRbQS::CommandBase do
6
- it "should define DRbQS::CommandBase.exec." do
7
- argv = [1, 2, 3]
8
- obj = mock
9
- DRbQS::CommandBase.should_receive(:new).and_return(obj)
10
- obj.should_receive(:parse_option)
11
- obj.should_receive(:exec)
12
- DRbQS::CommandBase.exec(argv)
13
- end
14
-
15
- subject do
16
- DRbQS::CommandBase.new
17
- end
18
-
19
- it "should exit with 0." do
20
- Kernel.should_receive(:exit).with(0)
21
- subject.__send__(:exit_normally)
22
- end
23
-
24
- it "should exit." do
25
- Kernel.should_receive(:exit)
26
- subject.__send__(:exit_unusually)
27
- end
28
-
29
- it "should exit." do
30
- Kernel.should_receive(:exit)
31
- subject.__send__(:exit_invalid_option)
32
- end
33
- end