god 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.7.7 / TBD
2
+ * Bug Fixes
3
+ * Fix detection of proc file system [raggi]
4
+
1
5
  == 0.7.6 / 2008-05-13
2
6
  * Major Enhancements
3
7
  * Implement System::Process methods for Linux based on /proc [Kevin Clark]
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'hoe'
3
3
 
4
- Hoe.new('god', '0.7.6') do |p|
4
+ Hoe.new('god', '0.7.7') do |p|
5
5
  p.rubyforge_name = 'god'
6
6
  p.author = 'Tom Preston-Werner'
7
7
  p.email = 'tom@rubyisawesome.com'
data/lib/god.rb CHANGED
@@ -133,7 +133,7 @@ class Module
133
133
  end
134
134
 
135
135
  module God
136
- VERSION = '0.7.6'
136
+ VERSION = '0.7.7'
137
137
 
138
138
  LOG_BUFFER_SIZE_DEFAULT = 100
139
139
  PID_FILE_DIRECTORY_DEFAULTS = ['/var/run/god', '~/.god/pids']
@@ -30,7 +30,7 @@ module God
30
30
  private
31
31
 
32
32
  def fetch_system_poller
33
- if test(?d, '/proc')
33
+ if SlashProcPoller.usable?
34
34
  SlashProcPoller
35
35
  else
36
36
  PortablePoller
@@ -5,11 +5,25 @@ module God
5
5
  @@hertz = 100
6
6
  @@total_mem = nil
7
7
 
8
+ MeminfoPath = '/proc/meminfo'
9
+ UptimePath = '/proc/uptime'
10
+
11
+ RequiredPaths = [MeminfoPath, UptimePath]
12
+
13
+ # FreeBSD has /proc by default, but nothing mounted there!
14
+ # So we should check for the actual required paths!
15
+ # Returns true if +RequiredPaths+ are readable.
16
+ def self.usable?
17
+ RequiredPaths.all? do |path|
18
+ test(?r, path)
19
+ end
20
+ end
21
+
8
22
  def initialize(pid)
9
23
  super(pid)
10
24
 
11
25
  unless @@total_mem # in K
12
- File.open("/proc/meminfo") do |f|
26
+ File.open(MeminfoPath) do |f|
13
27
  @@total_mem = f.gets.split[1]
14
28
  end
15
29
  end
@@ -39,7 +53,7 @@ module God
39
53
 
40
54
  # in seconds
41
55
  def uptime
42
- File.read('/proc/uptime').split[0].to_f
56
+ File.read(UptimePath).split[0].to_f
43
57
  end
44
58
 
45
59
  def stat
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: god
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.6
7
- date: 2008-05-21 00:00:00 -07:00
6
+ version: 0.7.7
7
+ date: 2008-06-17 00:00:00 -07:00
8
8
  summary: Like monit, only awesome
9
9
  require_paths:
10
10
  - lib