stalk-boss 0.1.3 → 0.1.4

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/bin/bossed_stalk CHANGED
File without changes
data/bin/stalk_boss CHANGED
@@ -16,20 +16,20 @@ require file
16
16
 
17
17
  trap('INT') do
18
18
  puts "\rExiting"
19
- StalkBoss.term
19
+ term
20
20
  exit
21
21
  end
22
22
 
23
23
  trap('QUIT') do
24
- StalkBoss.soft_quit
24
+ soft_quit
25
25
  end
26
26
 
27
27
  trap('USR2') do
28
- StalkBoss.soft_quit
29
- StalkBoss.start
28
+ soft_quit
29
+ start
30
30
  end
31
31
 
32
- StalkBoss.start
32
+ start
33
33
 
34
34
  # go to sleep forever!
35
35
  sleep
data/lib/stalk_boss.rb CHANGED
@@ -35,8 +35,9 @@ module StalkBoss
35
35
  end
36
36
 
37
37
  def start
38
+ puts @workers
38
39
  (1..@workers).each do
39
- @pipes << IO.popen("bossed_stalk #{@worker} #{@log}")
40
+ pipes << IO.popen("bossed_stalk #{@worker} #{@log}")
40
41
  end
41
42
  end
42
43
 
@@ -55,23 +56,26 @@ module StalkBoss
55
56
  end
56
57
 
57
58
  def term
58
- stalk_jobs.each do |s|
59
- s.pids.each do |pid|
60
- Process.kill 'INT', pid
61
- end
62
- end
59
+ send_signal('INT')
63
60
  end
64
61
 
65
62
  def soft_quit
63
+ send_signal('QUIT')
64
+ end
65
+
66
+ def start
67
+ stalk_jobs.each{ |s| s.start }
68
+ end
69
+
70
+ private
71
+
72
+ def send_signal(sig)
66
73
  stalk_jobs.each do |s|
67
74
  s.pids.each do |pid|
68
- Process.kill 'QUIT', pid
75
+ Process.kill sig, pid
69
76
  end
70
77
  end
71
- end
72
-
73
- def start
74
- stalk_jobs.each{ |s| s.start }
78
+ stalk_jobs = []
75
79
  end
76
80
 
77
81
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ryan Dew