svutil 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/lib/svutil.rb +1 -1
- data/lib/svutil/config.rb +106 -112
- data/lib/svutil/process_manager.rb +13 -11
- data/test/test_config.rb +39 -40
- data/test/test_config_handle_options.rb +7 -8
- data/test/test_helper.rb +12 -0
- data/test/test_process_manager.rb +74 -0
- data/test/test_validations.rb +7 -6
- metadata +11 -9
data/Rakefile
CHANGED
@@ -19,6 +19,7 @@ $hoe = Hoe.spec('svutil') do |p|
|
|
19
19
|
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
20
20
|
p.rsync_args = '-av --delete --ignore-errors'
|
21
21
|
p.readme_file = "README.rdoc"
|
22
|
+
p.require_ruby_version(">= 1.9.0")
|
22
23
|
end
|
23
24
|
|
24
25
|
require 'newgem/tasks' # load /tasks/*.rake
|
data/lib/svutil.rb
CHANGED
data/lib/svutil/config.rb
CHANGED
@@ -4,11 +4,9 @@ require 'ostruct'
|
|
4
4
|
require 'pp'
|
5
5
|
|
6
6
|
module SVUtil
|
7
|
-
def self.config
|
8
|
-
Config.config_class
|
9
|
-
end
|
10
|
-
|
11
7
|
class Defaults
|
8
|
+
attr_reader :attrs
|
9
|
+
|
12
10
|
def initialize
|
13
11
|
@attrs = {}
|
14
12
|
end
|
@@ -27,41 +25,38 @@ module SVUtil
|
|
27
25
|
end
|
28
26
|
|
29
27
|
class Config
|
30
|
-
|
31
|
-
|
32
|
-
attr_writer :config_file
|
33
|
-
attr_reader :attrs
|
34
|
-
attr_reader :defaults
|
35
|
-
# Used mainly for testing
|
36
|
-
attr_accessor :option_source
|
28
|
+
attr_writer :config_file
|
29
|
+
attr_reader :attrs
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
def initialize
|
32
|
+
@cli_options = {}
|
33
|
+
@attrs = if self.class.defaults
|
34
|
+
self.class.defaults.attrs.clone
|
35
|
+
else
|
36
|
+
{}
|
43
37
|
end
|
38
|
+
end
|
44
39
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
yield self
|
49
|
-
end
|
50
|
-
self.validate
|
40
|
+
def set(options = {})
|
41
|
+
if block_given?
|
42
|
+
yield self
|
51
43
|
end
|
44
|
+
self.validate
|
45
|
+
end
|
52
46
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
47
|
+
def config_file
|
48
|
+
@config_file ||= "settings"
|
49
|
+
end
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
# TODO: Put in module and extend
|
52
|
+
class << self
|
53
|
+
attr_reader :cli_option_handlers
|
54
|
+
attr_reader :validate_block
|
61
55
|
|
62
|
-
def
|
63
|
-
@
|
64
|
-
@
|
56
|
+
def defaults
|
57
|
+
@defaults ||= Defaults.new
|
58
|
+
yield @defaults if block_given?
|
59
|
+
return @defaults
|
65
60
|
end
|
66
61
|
|
67
62
|
def handle_options(&block)
|
@@ -72,102 +67,101 @@ module SVUtil
|
|
72
67
|
def validator(&block)
|
73
68
|
@validate_block = block
|
74
69
|
end
|
70
|
+
end
|
75
71
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
# TODO: Validate the writability of the log file
|
82
|
-
@validate_block.call(self) unless @validate_block.nil?
|
83
|
-
true
|
84
|
-
end
|
72
|
+
def set_cli_option(option, value)
|
73
|
+
@cli_options ||= {}
|
74
|
+
@cli_options[option.to_s] = value
|
75
|
+
end
|
85
76
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
set_cli_option(:daemon, true)
|
96
|
-
end
|
97
|
-
opts.on("-l", "--debug-log [log-file]", "Debug Log File") do |log|
|
98
|
-
set_cli_option(:log_file, log)
|
99
|
-
end
|
100
|
-
opts.on("-T", "--trace", "Display backtrace on errors") do
|
101
|
-
set_cli_option(:trace, true)
|
102
|
-
end
|
103
|
-
opts.on("-P", "--pid [pid-file]", "PID File") do |pid|
|
104
|
-
set_cli_option(:pid_file, pid)
|
105
|
-
end
|
106
|
-
# Handle CLI passed options
|
107
|
-
(cli_option_handlers || []).each do |handler|
|
108
|
-
handler.call(opts)
|
109
|
-
end
|
110
|
-
end.parse!(self.option_source || ARGV)
|
77
|
+
def validate
|
78
|
+
# TODO: Check file perms
|
79
|
+
if ((pid_file.nil? or pid_file.empty? or File.directory?(pid_file)) && self.daemon)
|
80
|
+
err("PID file must be a writable file")
|
81
|
+
end
|
82
|
+
# TODO: Validate the writability of the log file
|
83
|
+
self.instance_exec(self, &self.class.validate_block) unless self.class.validate_block.nil?
|
84
|
+
true
|
85
|
+
end
|
111
86
|
|
112
|
-
|
113
|
-
|
114
|
-
|
87
|
+
def init(test_options = nil)
|
88
|
+
set do |c|
|
89
|
+
self.config_provided_on_cli = false
|
90
|
+
OptionParser.new do |opts|
|
91
|
+
opts.on("-f", "--config [filename]", "Config file to use (default 'settings')") do |filename|
|
92
|
+
self.config_file = filename.strip
|
93
|
+
self.config_provided_on_cli = true
|
115
94
|
end
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
95
|
+
opts.on("-d", "--daemon", "Run in the background as a daemon") do
|
96
|
+
set_cli_option(:daemon, true)
|
97
|
+
end
|
98
|
+
opts.on("-l", "--debug-log [log-file]", "Debug Log File") do |log|
|
99
|
+
set_cli_option(:log_file, log)
|
100
|
+
end
|
101
|
+
opts.on("-T", "--trace", "Display backtrace on errors") do
|
102
|
+
set_cli_option(:trace, true)
|
103
|
+
end
|
104
|
+
opts.on("-P", "--pid [pid-file]", "PID File") do |pid|
|
105
|
+
set_cli_option(:pid_file, pid)
|
106
|
+
end
|
107
|
+
# Handle CLI passed options
|
108
|
+
(self.class.cli_option_handlers || []).each do |handler|
|
109
|
+
self.instance_exec(opts, &handler)
|
120
110
|
end
|
111
|
+
end.parse!(test_options || ARGV)
|
112
|
+
|
113
|
+
|
114
|
+
# Process the config file
|
115
|
+
if (self.config_file && File.exists?(self.config_file)) || self.config_provided_on_cli
|
116
|
+
load_config_file
|
117
|
+
end
|
118
|
+
|
119
|
+
# Finally apply any CLI options
|
120
|
+
(@cli_options || {}).each do |(k,v)|
|
121
|
+
@attrs[k.to_s] = v
|
121
122
|
end
|
122
123
|
end
|
124
|
+
end
|
123
125
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
@attrs
|
128
|
-
|
129
|
-
|
130
|
-
else
|
131
|
-
value = @attrs[method_id.to_s]
|
132
|
-
if !value && @defaults
|
133
|
-
@defaults.default_for(method_id.to_s)
|
134
|
-
else
|
135
|
-
value
|
136
|
-
end
|
137
|
-
end
|
126
|
+
private
|
127
|
+
def method_missing(method_id, *args)
|
128
|
+
if method_id.to_s =~ /=$/
|
129
|
+
@attrs[method_id.to_s[0...-1]] = args.first
|
130
|
+
else
|
131
|
+
value = @attrs[method_id.to_s]
|
138
132
|
end
|
133
|
+
end
|
139
134
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
end
|
148
|
-
self.send("#{pair[0].strip}=", pair[1].strip)
|
135
|
+
def load_config_file
|
136
|
+
contents = ""
|
137
|
+
File.open(config_file, "r") { |file| contents << file.read }
|
138
|
+
contents.split("\n").each_with_index do |line, index|
|
139
|
+
pair = line.split("=")
|
140
|
+
if pair.size != 2
|
141
|
+
err("Invalid config file '#{config_file}'. Syntax error at line #{index + 1}")
|
149
142
|
end
|
143
|
+
self.send("#{pair[0].strip}=", pair[1].strip)
|
150
144
|
end
|
145
|
+
end
|
151
146
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
147
|
+
# TODO: This should be moved out to a Validator class
|
148
|
+
def err(message)
|
149
|
+
STDERR.puts(message)
|
150
|
+
exit 1
|
151
|
+
end
|
157
152
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
end
|
153
|
+
def subclasses_of(*superclasses) #:nodoc:
|
154
|
+
subclasses = []
|
155
|
+
superclasses.each do |sup|
|
156
|
+
ObjectSpace.each_object(Class) do |k|
|
157
|
+
if superclasses.any? { |superclass| k < superclass } &&
|
158
|
+
(k.name.nil? || k.name.empty? || eval("defined?(::#{k}) && ::#{k}.object_id == k.object_id"))
|
159
|
+
subclasses << k
|
166
160
|
end
|
167
|
-
subclasses.uniq!
|
168
161
|
end
|
169
|
-
subclasses
|
162
|
+
subclasses.uniq!
|
170
163
|
end
|
171
|
-
|
164
|
+
subclasses
|
165
|
+
end
|
172
166
|
end
|
173
167
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module SVUtil
|
2
2
|
class ProcessManager
|
3
|
-
def initialize(klass)
|
3
|
+
def initialize(klass, config)
|
4
|
+
@klass = klass
|
5
|
+
@config = config
|
6
|
+
@server_instance = @klass.new
|
7
|
+
|
4
8
|
# TODO: Add ability for users to specify these signals
|
5
9
|
Signal.trap("INT") { shutdown('Interupted', 1) }
|
6
10
|
Signal.trap("TERM") { shutdown('Terminated', 2) }
|
@@ -11,20 +15,18 @@ module SVUtil
|
|
11
15
|
STDERR.puts "There is already a '#{$0}' process running"
|
12
16
|
exit 1
|
13
17
|
end
|
14
|
-
daemonize if SVUtil::config.daemon
|
15
|
-
write_pid_file
|
16
|
-
@klass = klass
|
17
|
-
@server_instance = @klass.new
|
18
18
|
end
|
19
19
|
|
20
20
|
def start
|
21
21
|
begin
|
22
|
+
daemonize if @config.daemon
|
23
|
+
write_pid_file
|
22
24
|
@server_instance.run
|
23
25
|
rescue SystemExit => e
|
24
26
|
shutdown("System Exited")
|
25
27
|
rescue Exception => e
|
26
28
|
Log.error(e.message)
|
27
|
-
Log.error(e.backtrace.join("\n")) if
|
29
|
+
Log.error(e.backtrace.join("\n")) if @config.trace
|
28
30
|
shutdown("Process Completed with Error", 1)
|
29
31
|
end
|
30
32
|
shutdown("Process Completed")
|
@@ -35,9 +37,9 @@ module SVUtil
|
|
35
37
|
Log.info "Shutting Down (#{reason})"
|
36
38
|
begin
|
37
39
|
@server_instance.shutdown if @server_instance.respond_to?(:shutdown)
|
38
|
-
rescue => e
|
40
|
+
rescue Exception => e
|
39
41
|
Log.error("Shutdown Callback threw error: #{e.message}")
|
40
|
-
Log.error("Shutdown Callback threw error: #{e.backtrace}") if
|
42
|
+
Log.error("Shutdown Callback threw error: #{e.backtrace}") if @config.trace
|
41
43
|
Log.info("Shuting down anyway")
|
42
44
|
end
|
43
45
|
remove_pid_file
|
@@ -45,20 +47,20 @@ module SVUtil
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def running?
|
48
|
-
pid_file =
|
50
|
+
pid_file = @config.pid_file
|
49
51
|
return false unless pid_file
|
50
52
|
File.exist?(pid_file)
|
51
53
|
end
|
52
54
|
|
53
55
|
def write_pid_file
|
54
|
-
pid_file =
|
56
|
+
pid_file = @config.pid_file
|
55
57
|
return unless pid_file
|
56
58
|
File.open(pid_file, "w") { |f| f.write(Process.pid) }
|
57
59
|
File.chmod(0644, pid_file)
|
58
60
|
end
|
59
61
|
|
60
62
|
def remove_pid_file
|
61
|
-
pid_file =
|
63
|
+
pid_file = @config.pid_file
|
62
64
|
return unless pid_file
|
63
65
|
File.unlink(pid_file) if File.exists?(pid_file)
|
64
66
|
end
|
data/test/test_config.rb
CHANGED
@@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
|
3
3
|
class CustomConfig < SVUtil::Config
|
4
4
|
defaults do |c|
|
5
5
|
c.foo = 'bar'
|
6
|
+
c.manager = 'daniel'
|
6
7
|
end
|
7
8
|
end
|
8
9
|
|
@@ -10,77 +11,75 @@ class TestConfig < Test::Unit::TestCase
|
|
10
11
|
include SVUtil
|
11
12
|
|
12
13
|
def setup
|
14
|
+
@custom_config = CustomConfig.new
|
13
15
|
end
|
14
16
|
|
15
17
|
def test_set
|
16
|
-
assert
|
17
|
-
|
18
|
-
assert_equal 'abc',
|
19
|
-
|
20
|
-
assert_equal 10,
|
18
|
+
assert !@custom_config.my_symbol
|
19
|
+
@custom_config.my_symbol = 'abc'
|
20
|
+
assert_equal 'abc', @custom_config.my_symbol
|
21
|
+
@custom_config.my_var = 10
|
22
|
+
assert_equal 10, @custom_config.my_var
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_set_with_block
|
24
|
-
|
25
|
-
|
26
|
+
@custom_config.expects(:validate).times(1)
|
27
|
+
@custom_config.set do |c|
|
26
28
|
c.another = 'abc'
|
27
29
|
c.some_var = 123
|
28
30
|
c.foobar = true
|
29
31
|
end
|
30
|
-
assert_equal 'abc',
|
31
|
-
assert_equal 123,
|
32
|
-
assert
|
32
|
+
assert_equal 'abc', @custom_config.another
|
33
|
+
assert_equal 123, @custom_config.some_var
|
34
|
+
assert @custom_config.foobar
|
33
35
|
end
|
34
36
|
|
35
37
|
def test_standard_cli_options
|
36
|
-
CustomConfig.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
assert_equal "
|
41
|
-
|
42
|
-
assert
|
38
|
+
@custom_config = CustomConfig.new
|
39
|
+
@custom_config.expects(:validate).times(1)
|
40
|
+
#@custom_config.option_source = [ "-f", "test/settings", "-d", "-l", "debug", "-T" ]
|
41
|
+
@custom_config.init([ "-f", "test/settings", "-d", "-l", "debug", "-T" ])
|
42
|
+
assert_equal "test/settings", @custom_config.config_file
|
43
|
+
assert_equal "debug", @custom_config.log_file
|
44
|
+
assert @custom_config.daemon
|
45
|
+
assert @custom_config.trace
|
43
46
|
end
|
44
47
|
|
45
48
|
def test_config_file
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
assert_equal 'bar',
|
49
|
+
@custom_config.expects(:validate).times(1)
|
50
|
+
@custom_config.config_file = "test/settings"
|
51
|
+
@custom_config.init
|
52
|
+
assert_equal 'bar', @custom_config.foo
|
50
53
|
end
|
51
54
|
|
52
55
|
def test_load_config_file
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
assert_equal 'bar',
|
56
|
+
@custom_config.expects(:load_config_file).times(1)
|
57
|
+
@custom_config.config_file = "test/settings"
|
58
|
+
@custom_config.init
|
59
|
+
assert_equal 'bar', @custom_config.foo
|
57
60
|
end
|
58
61
|
|
59
62
|
def test_validations_on_cli_with_no_config_file
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
@custom_config.expects(:validate).times(1)
|
64
|
+
@custom_config.config_file = nil
|
65
|
+
@custom_config.init
|
63
66
|
end
|
64
67
|
|
65
68
|
# Command Line wins!
|
66
69
|
def test_file_overide
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
assert_equal "logfile_set_on_cli", CustomConfig.log_file
|
70
|
+
@custom_config.expects(:validate).times(1)
|
71
|
+
@custom_config.config_file = "test/settings"
|
72
|
+
@custom_config.init([ "-l", "logfile_set_on_cli" ])
|
73
|
+
assert_equal "logfile_set_on_cli", @custom_config.log_file
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_defaults
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
assert_equal 'daniel', CustomConfig.manager
|
79
|
-
CustomConfig.manager = 'james'
|
80
|
-
assert_equal 'james', CustomConfig.manager
|
77
|
+
assert_equal 'daniel', @custom_config.manager
|
78
|
+
@custom_config.manager = 'james'
|
79
|
+
assert_equal 'james', @custom_config.manager
|
81
80
|
end
|
82
81
|
|
83
82
|
def test_custom_defaults
|
84
|
-
assert_equal 'bar',
|
83
|
+
assert_equal 'bar', @custom_config.foo
|
85
84
|
end
|
86
85
|
end
|
@@ -15,19 +15,18 @@ class TestConfigHandleOptions < Test::Unit::TestCase
|
|
15
15
|
include SVUtil
|
16
16
|
|
17
17
|
def setup
|
18
|
+
@my_config = MyConfig.new
|
18
19
|
end
|
19
20
|
|
20
21
|
def test_handle_options
|
21
|
-
|
22
|
-
|
23
|
-
assert
|
24
|
-
assert
|
25
|
-
assert MyConfig.restless
|
22
|
+
@my_config.init([ "-P", "foo", "-x", "12345", "-Q" ])
|
23
|
+
assert @my_config.pid_file = "foo"
|
24
|
+
assert @my_config.x = '1234'
|
25
|
+
assert @my_config.restless
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_built_in_options
|
29
|
-
|
30
|
-
|
31
|
-
assert MyConfig.daemon
|
29
|
+
@my_config.init([ "-d", "-P", "foo" ])
|
30
|
+
assert @my_config.daemon
|
32
31
|
end
|
33
32
|
end
|
data/test/test_helper.rb
CHANGED
@@ -3,3 +3,15 @@ require 'stringio'
|
|
3
3
|
require 'test/unit'
|
4
4
|
require 'mocha'
|
5
5
|
require File.dirname(__FILE__) + '/../lib/svutil'
|
6
|
+
|
7
|
+
class Test::Unit::TestCase
|
8
|
+
def assert_exit
|
9
|
+
exited = false
|
10
|
+
begin
|
11
|
+
yield if block_given?
|
12
|
+
rescue SystemExit => e
|
13
|
+
exited = true
|
14
|
+
end
|
15
|
+
assert(exited, "Did not exit")
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
|
2
|
+
|
3
|
+
class ServerConfig < SVUtil::Config
|
4
|
+
end
|
5
|
+
|
6
|
+
class TestProcesManager < Test::Unit::TestCase
|
7
|
+
include SVUtil
|
8
|
+
|
9
|
+
def setup
|
10
|
+
Signal.stubs(:trap)
|
11
|
+
Log.stubs(:info)
|
12
|
+
@instance = mock()
|
13
|
+
@klass = mock
|
14
|
+
@klass.expects(:new).returns(@instance)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_initialize
|
18
|
+
config = ServerConfig.new
|
19
|
+
ProcessManager.new(@klass, config)
|
20
|
+
end
|
21
|
+
|
22
|
+
# TODO: Could probably test this better by actually forking
|
23
|
+
def test_start_as_daemon
|
24
|
+
config = ServerConfig.new
|
25
|
+
config.daemon = true
|
26
|
+
pm = ProcessManager.new(@klass, config)
|
27
|
+
pm.expects(:daemonize)
|
28
|
+
pm.expects(:write_pid_file)
|
29
|
+
pm.expects(:shutdown)
|
30
|
+
@instance.expects(:run)
|
31
|
+
pm.start
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_start_with_trace
|
35
|
+
config = ServerConfig.new
|
36
|
+
config.trace = true
|
37
|
+
pm = ProcessManager.new(@klass, config)
|
38
|
+
pm.expects(:write_pid_file)
|
39
|
+
@instance.expects(:run).raises(Exception)
|
40
|
+
Log.expects(:error).times(2)
|
41
|
+
assert_exit { pm.start }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_shutdown
|
45
|
+
config = ServerConfig.new
|
46
|
+
pm = ProcessManager.new(@klass, config)
|
47
|
+
pm.expects(:write_pid_file)
|
48
|
+
@instance.expects(:run)
|
49
|
+
assert_exit { pm.start }
|
50
|
+
|
51
|
+
# Shutdown
|
52
|
+
@instance.expects(:shutdown)
|
53
|
+
pm.expects(:remove_pid_file)
|
54
|
+
assert_exit { pm.send(:shutdown) }
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_shutdown_with_trace
|
58
|
+
config = ServerConfig.new
|
59
|
+
config.trace = true
|
60
|
+
pm = ProcessManager.new(@klass, config)
|
61
|
+
pm.expects(:write_pid_file)
|
62
|
+
@instance.expects(:run)
|
63
|
+
assert_exit { pm.start }
|
64
|
+
|
65
|
+
# Shutdown
|
66
|
+
@instance.expects(:shutdown).raises(Exception)
|
67
|
+
Log.expects(:error).times(2)
|
68
|
+
pm.expects(:remove_pid_file)
|
69
|
+
assert_exit { pm.send(:shutdown) }
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
# TODO: Test all of the exceptions
|
74
|
+
end
|
data/test/test_validations.rb
CHANGED
@@ -10,17 +10,18 @@ class TestValidations < Test::Unit::TestCase
|
|
10
10
|
include SVUtil
|
11
11
|
|
12
12
|
def setup
|
13
|
+
@validated_config = ValidatedConfig.new
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_custom_validation_error
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
@validated_config.expects(:err).times(1)
|
18
|
+
@validated_config.output_dir = nil
|
19
|
+
@validated_config.validate
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_custom_validation
|
22
|
-
|
23
|
-
|
24
|
-
assert
|
23
|
+
@validated_config.expects(:err).never
|
24
|
+
@validated_config.output_dir = "foo"
|
25
|
+
assert @validated_config.validate
|
25
26
|
end
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svutil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: newgem
|
16
|
-
requirement: &
|
16
|
+
requirement: &70111340337380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.5.3
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70111340337380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &70111340336180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70111340336180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70111336070020 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '3.10'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70111336070020
|
47
47
|
description: A simple managed process builder for Ruby projects
|
48
48
|
email:
|
49
49
|
- daniel@netfox.com
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- test/test_config.rb
|
69
69
|
- test/test_config_handle_options.rb
|
70
70
|
- test/test_defaults.rb
|
71
|
+
- test/test_process_manager.rb
|
71
72
|
- test/test_validations.rb
|
72
73
|
- .gemtest
|
73
74
|
homepage: http://svutil.rubyforge.org
|
@@ -83,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
84
|
requirements:
|
84
85
|
- - ! '>='
|
85
86
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
87
|
+
version: 1.9.0
|
87
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
89
|
none: false
|
89
90
|
requirements:
|
@@ -101,5 +102,6 @@ test_files:
|
|
101
102
|
- test/test_config_handle_options.rb
|
102
103
|
- test/test_defaults.rb
|
103
104
|
- test/test_helper.rb
|
105
|
+
- test/test_process_manager.rb
|
104
106
|
- test/test_svutil.rb
|
105
107
|
- test/test_validations.rb
|