what 0.3.5 → 0.3.6
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.
- checksums.yaml +4 -4
- data/lib/what/helpers.rb +17 -7
- data/lib/what/modules.rb +2 -0
- data/lib/what/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caebdb83a2b6cec1541c7b2ec45630db05a7befe
|
4
|
+
data.tar.gz: 3c953a8a838ec1583272569c4da7da3dabf4b0f2
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85712eea83510e0052cb44cabd828e9645948d8ca6ffcf6225687c362dd1a5def6368b873d43ed3964a217447082984bdb9d97c64b6c3754486665ca4462e361
|
7
|
+
data.tar.gz: 6af36b9d606608572913a284ad93bb929d885add6cb6661e8b2b0af062bda4edb16034f629487dfde3a2ea71d9b34df31555de8674fee3f2269e2e6cefe07e43
|
data/lib/what/helpers.rb
CHANGED
@@ -4,14 +4,15 @@ module What
|
|
4
4
|
# the principle that overall health == the worst sub-health.
|
5
5
|
HEALTH = %w(ok warning alert)
|
6
6
|
def self.overall_health(healths)
|
7
|
-
worst_health
|
8
|
-
|
9
|
-
end.max
|
7
|
+
worst_health(healths)
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
def self.worst_health(healths)
|
11
|
+
ordered_healths(healths).last
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.best_health(healths)
|
15
|
+
ordered_healths(healths).first
|
15
16
|
end
|
16
17
|
|
17
18
|
# Stolen from Rails (http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html)
|
@@ -41,5 +42,14 @@ module What
|
|
41
42
|
def self.process_lines
|
42
43
|
`ps aux`.encode('UTF-16', invalid: :replace, undef: :replace).encode('UTF-8').split("\n")
|
43
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def self.ordered_healths(healths)
|
49
|
+
healths.sort_by do |health|
|
50
|
+
HEALTH.index(health) || HEALTH.index('alert')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
44
54
|
end
|
45
55
|
end
|
data/lib/what/modules.rb
CHANGED
data/lib/what/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Fitzgerald
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project: what
|
127
|
-
rubygems_version: 2.0.
|
127
|
+
rubygems_version: 2.0.3
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Simple server monitoring tool
|