svutil 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/svutil.rb CHANGED
@@ -6,5 +6,5 @@ require 'svutil/log'
6
6
  require 'svutil/process_manager'
7
7
 
8
8
  module SVUtil
9
- VERSION = '0.9.2'
9
+ VERSION = '0.9.3'
10
10
  end
data/lib/svutil/config.rb CHANGED
@@ -146,7 +146,7 @@ module SVUtil
146
146
 
147
147
  # TODO: This should be moved out to a Validator class
148
148
  def err(message)
149
- STDERR.puts(message)
149
+ Log.error(message)
150
150
  exit 1
151
151
  end
152
152
 
@@ -1,9 +1,12 @@
1
1
  module SVUtil
2
2
  class ProcessManager
3
- def initialize(klass, config)
4
- @klass = klass
3
+ def initialize(klass_or_instance, config)
4
+ @server_instance = if klass_or_instance.instance_of?(Class)
5
+ klass_or_instance.new
6
+ else
7
+ klass_or_instance
8
+ end
5
9
  @config = config
6
- @server_instance = @klass.new
7
10
 
8
11
  # TODO: Add ability for users to specify these signals
9
12
  Signal.trap("INT") { shutdown('Interupted', 1) }
@@ -11,7 +11,8 @@ class TestProcesManager < Test::Unit::TestCase
11
11
  Log.stubs(:info)
12
12
  @instance = mock()
13
13
  @klass = mock
14
- @klass.expects(:new).returns(@instance)
14
+ @klass.stubs(:new).returns(@instance)
15
+ @klass.stubs(:instance_of?).with(Class).returns(true)
15
16
  end
16
17
 
17
18
  def test_initialize
@@ -19,6 +20,13 @@ class TestProcesManager < Test::Unit::TestCase
19
20
  ProcessManager.new(@klass, config)
20
21
  end
21
22
 
23
+ def test_initialize_and_start_with_server_instance
24
+ config = ServerConfig.new
25
+ pm = ProcessManager.new(@instance, config)
26
+ @instance.expects(:run)
27
+ assert_exit { pm.start }
28
+ end
29
+
22
30
  # TODO: Could probably test this better by actually forking
23
31
  def test_start_as_daemon
24
32
  config = ServerConfig.new
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.2
4
+ version: 0.9.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: newgem
16
- requirement: &70111340337380 !ruby/object:Gem::Requirement
16
+ requirement: &70280236794800 !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: *70111340337380
24
+ version_requirements: *70280236794800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe
27
- requirement: &70111340336180 !ruby/object:Gem::Requirement
27
+ requirement: &70280236793980 !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: *70111340336180
35
+ version_requirements: *70280236793980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &70111336070020 !ruby/object:Gem::Requirement
38
+ requirement: &70280232222140 !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: *70111336070020
46
+ version_requirements: *70280232222140
47
47
  description: A simple managed process builder for Ruby projects
48
48
  email:
49
49
  - daniel@netfox.com