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.
Files changed (3) hide show
  1. data/lib/izzup/izzup.rb +10 -10
  2. data/lib/izzup/version.rb +1 -1
  3. 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.demand(*args)
4
+ def self.insist(*args)
6
5
  IzzupArguments.new(args).each do |p,n|
7
- raise IzzupError, "#{self.name} dying because #{n} instance(s) of #{p} not discovered" unless izzup(p,n)
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 = 0
22
- begin
23
- up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip().to_i
24
- rescue
25
- raise StandardError, "#{self.name} will probably only work on a *NIX machine"
26
- end
27
- up == count
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
@@ -1,3 +1,3 @@
1
1
  module Izzup
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: izzup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - max sharples