healthety 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,20 +17,14 @@ Healthety.workers do
17
17
  host "localhost"
18
18
  port 41234
19
19
 
20
- worker :load_average do
21
- interval 0.5
22
- # Gets load average with a system call (Mac OS X)
23
- value `w | head -n1 | cut -f4 -d":" | cut -f2 -d" "`.to_f
24
- end
25
-
26
20
  worker :random do
27
- interval 2
21
+ interval 1
28
22
  value rand(10)
29
23
  end
30
24
  end
31
25
  ```
32
26
 
33
- That's all you need to do to define two different workers.
27
+ That's all you need to do to define a worker.
34
28
 
35
29
  ### Defining helpers
36
30
 
@@ -62,6 +56,12 @@ Healthety.workers do
62
56
  host "localhost"
63
57
  port 41234
64
58
 
59
+ worker :load_average do
60
+ interval 0.5
61
+ # Gets load average with a system call (Mac OS X)
62
+ value `w | head -n1 | cut -f4 -d":" | cut -f2 -d" "`.to_f
63
+ end
64
+
65
65
  worker :user_count do
66
66
  interval 5
67
67
  value mysql.query("SELECT COUNT(*) AS count FROM users").first["count"]
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.summary = s.description
14
14
 
15
15
  s.add_dependency("json", "~> 1.5.1")
16
- s.add_development_dependency("rspec", "~> 2.5.0")
17
- s.add_development_dependency("mocha", "~> 0.9.12")
16
+ s.add_dependency("daemons", "~> 1.1.3")
17
+ s.add_development_dependency("rspec", "~> 2.6.0")
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- spec/*`.split("\n")
@@ -1,3 +1,5 @@
1
+ require "daemons"
2
+
1
3
  module Healthety
2
4
  extend self
3
5
 
@@ -7,7 +9,13 @@ module Healthety
7
9
 
8
10
  instance_eval(&block)
9
11
 
10
- start
12
+ # Try to daemonize only if a command-line argument is given.
13
+ if ARGV.any?
14
+ Daemons.run_proc("healthety") { start }
15
+ else
16
+ puts message
17
+ start
18
+ end
11
19
  end
12
20
 
13
21
  def host(host)
@@ -29,7 +37,6 @@ module Healthety
29
37
  end
30
38
 
31
39
  def start
32
- puts message
33
40
  transmission = Transmission.new(@host, @port)
34
41
 
35
42
  # Catch Ctrl-C and terminate all worker threads.
@@ -1,3 +1,3 @@
1
1
  module Healthety
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: healthety
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Martin Jagusch
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-29 00:00:00 Z
13
+ date: 2011-06-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -24,25 +24,25 @@ dependencies:
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
27
- name: rspec
27
+ name: daemons
28
28
  prerelease: false
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 2.5.0
35
- type: :development
34
+ version: 1.1.3
35
+ type: :runtime
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency
38
- name: mocha
38
+ name: rspec
39
39
  prerelease: false
40
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 0.9.12
45
+ version: 2.6.0
46
46
  type: :development
47
47
  version_requirements: *id003
48
48
  description: Sends JSON wrapped data via UDP packets to a given host.