izzup 0.0.1 → 0.0.2

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/izzup.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = ["maxsharples@gmail.com"]
10
10
  s.homepage = "http://github.com/msharp/izzup"
11
11
  s.summary = %q{checks for needed processes}
12
- s.description = %q{use to ensure other *nix processes are up when executing code}
12
+ s.description = %q{use to ensure that required *nix processes are up when executing code}
13
13
 
14
14
  s.rubyforge_project = "izzup"
15
15
 
@@ -17,8 +17,9 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
-
20
+
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
23
  # s.add_runtime_dependency "rest-client"
24
+
24
25
  end
@@ -0,0 +1,30 @@
1
+ module Izzup
2
+
3
+
4
+ # require these or fail with izzup error
5
+ def self.demand(*args)
6
+ args.each do |p|
7
+ raise IzzupError, "#{self.name} dying because #{p} is not up" unless izzup(p)
8
+ end
9
+ end
10
+
11
+ # see if they are up true/false
12
+ def self.assert(*args)
13
+ found = true
14
+ args.each {|p| found = found && izzup(p)}
15
+ found
16
+ end
17
+
18
+ def self.izzup(process, count=1)
19
+ up = 0
20
+ begin
21
+ up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip().to_i
22
+ rescue
23
+ raise StandardError, "#{self.name} will probably only work on a *NIX machine"
24
+ end
25
+ up == count
26
+ end
27
+
28
+ end
29
+
30
+
@@ -0,0 +1,7 @@
1
+
2
+ module Izzup
3
+
4
+ class IzzupError < StandardError
5
+ end
6
+
7
+ end
data/lib/izzup/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Izzup
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/izzup.rb CHANGED
@@ -1,31 +1,7 @@
1
1
  require "izzup/version"
2
-
3
2
  module Izzup
4
3
 
5
- # require these or fail
6
- def self.require(*args)
7
- args.each do |p|
8
- raise "#{self.name} dying because #{p} is not up" unless izzup(p) == 1
9
- end
10
- end
11
-
12
- # see if they are up
13
- def self.request(*args)
14
- found = 0
15
- args.each do |p|
16
- found = found + izzup(p)
17
- end
18
- found == args.length
19
- end
20
-
21
- def self.izzup(process)
22
- up = 0
23
- begin
24
- up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip().to_i
25
- rescue
26
- raise "#{self.name} will probably only work on a *NIX machine"
27
- end
28
- up
29
- end
4
+ require "izzup/izzup"
5
+ require "izzup/izzup_error"
30
6
 
31
7
  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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - max sharples
@@ -15,10 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-01 00:00:00 Z
18
+ date: 2011-09-05 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
- description: use to ensure other *nix processes are up when executing code
21
+ description: use to ensure that required *nix processes are up when executing code
22
22
  email:
23
23
  - maxsharples@gmail.com
24
24
  executables: []
@@ -33,6 +33,8 @@ files:
33
33
  - Rakefile
34
34
  - izzup.gemspec
35
35
  - lib/izzup.rb
36
+ - lib/izzup/izzup.rb
37
+ - lib/izzup/izzup_error.rb
36
38
  - lib/izzup/version.rb
37
39
  homepage: http://github.com/msharp/izzup
38
40
  licenses: []