izzup 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in izzup.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/izzup.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "izzup/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "izzup"
7
+ s.version = Izzup::VERSION
8
+ s.authors = ["max sharples"]
9
+ s.email = ["maxsharples@gmail.com"]
10
+ s.homepage = "http://github.com/msharp/izzup"
11
+ s.summary = %q{checks for needed processes}
12
+ s.description = %q{use to ensure other *nix processes are up when executing code}
13
+
14
+ s.rubyforge_project = "izzup"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,3 @@
1
+ module Izzup
2
+ VERSION = "0.0.1"
3
+ end
data/lib/izzup.rb ADDED
@@ -0,0 +1,31 @@
1
+ require "izzup/version"
2
+
3
+ module Izzup
4
+
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
30
+
31
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: izzup
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - max sharples
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-01 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: use to ensure other *nix processes are up when executing code
22
+ email:
23
+ - maxsharples@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Rakefile
34
+ - izzup.gemspec
35
+ - lib/izzup.rb
36
+ - lib/izzup/version.rb
37
+ homepage: http://github.com/msharp/izzup
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ hash: 3
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project: izzup
66
+ rubygems_version: 1.8.10
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: checks for needed processes
70
+ test_files: []
71
+