izzup 0.1.0 → 0.2.0
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/lib/izzup/izzup.rb +10 -10
- data/lib/izzup/version.rb +1 -1
- metadata +3 -3
data/lib/izzup/izzup.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
module Izzup
|
2
|
-
|
3
2
|
|
4
3
|
# require these or fail with izzup error
|
5
|
-
def self.
|
4
|
+
def self.insist(*args)
|
6
5
|
IzzupArguments.new(args).each do |p,n|
|
7
|
-
raise IzzupError, "#{self.name}
|
6
|
+
raise IzzupError, "#{self.name} died because #{n} instance(s) of #{p} not available" unless izzup(p,n)
|
8
7
|
end
|
9
8
|
end
|
10
9
|
|
@@ -17,14 +16,15 @@ module Izzup
|
|
17
16
|
found
|
18
17
|
end
|
19
18
|
|
19
|
+
# test for given number of processes
|
20
20
|
def self.izzup(process, count=1)
|
21
|
-
up =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip()
|
22
|
+
not_nix! if up.length == 0 # windows will return "" from ps command
|
23
|
+
up.to_i == count
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.not_nix!
|
27
|
+
raise StandardError, "#{self.name} will probably only work on a *NIX machine"
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
data/lib/izzup/version.rb
CHANGED
metadata
CHANGED