Module: Izzup
- Defined in:
- lib/izzup.rb,
lib/izzup/izzup.rb,
lib/izzup/version.rb,
lib/izzup/izzup_error.rb,
lib/izzup/izzup_arguments.rb
Defined Under Namespace
Classes: IzzupArguments, IzzupError
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.assert(*args) ⇒ Object
see if they are up true/false.
-
.demand(*args) ⇒ Object
require these or fail with izzup error.
- .izzup(process, count = 1) ⇒ Object
Class Method Details
.assert(*args) ⇒ Object
see if they are up true/false
12 13 14 15 16 17 18 |
# File 'lib/izzup/izzup.rb', line 12 def self.assert(*args) found = true IzzupArguments.new(args).each do |p,n| found = found && izzup(p,n) end found end |
.demand(*args) ⇒ Object
require these or fail with izzup error
5 6 7 8 9 |
# File 'lib/izzup/izzup.rb', line 5 def self.demand(*args) IzzupArguments.new(args).each do |p,n| raise IzzupError, "#{self.name} dying because #{n} instance(s) of #{p} not discovered" unless izzup(p,n) end end |
.izzup(process, count = 1) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/izzup/izzup.rb', line 20 def self.izzup(process, count=1) up = 0 begin up = %x{ps ax | grep #{process} | grep -v grep | wc -l}.strip().to_i rescue raise StandardError, "#{self.name} will probably only work on a *NIX machine" end up == count end |