okcomputer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +29 -6
- data/app/controllers/ok_computer_controller.rb +1 -1
- data/lib/okcomputer/version.rb +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -22,7 +22,14 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
To perform the default checks (application running and database
|
25
|
+
To perform the default checks (application running and ActiveRecord database
|
26
|
+
connection), do nothing other than adding to your application's Gemfile.
|
27
|
+
|
28
|
+
If you use a database adapter other than ActiveRecord, see Registering Custom
|
29
|
+
Checks below to build your own database check and register it with the name
|
30
|
+
"database" to replace the built-in check, or use
|
31
|
+
`OKComputer::Registry.deregister "database"` to stop checking your database
|
32
|
+
altogether.
|
26
33
|
|
27
34
|
### Registering Additional Checks
|
28
35
|
|
@@ -30,15 +37,31 @@ Register additional checks in an initializer, like do:
|
|
30
37
|
|
31
38
|
```ruby
|
32
39
|
# config/initializers/okcomputer.rb
|
33
|
-
OKComputer::Registry.register "
|
34
|
-
OKComputer::Registry.register "
|
40
|
+
OKComputer::Registry.register "resque_down", OKComputer::ResqueDownCheck.new("critical", 100)
|
41
|
+
OKComputer::Registry.register "resque_backed_up", OKComputer::ResqueBackedUpCheck.new
|
35
42
|
```
|
36
43
|
|
37
|
-
TODO: Figure out interface for configuring checks (e.g., Resque looking for more than 100 jobs in the "critical" queue)
|
38
|
-
|
39
44
|
### Registering Custom Checks
|
40
45
|
|
41
|
-
|
46
|
+
The simplest way to register a check unique to your application is to subclass
|
47
|
+
OKComputer::Check and implement your own `#call` method, which returns the
|
48
|
+
output string, and calls `mark_failure` if anything is wrong.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
# config/initializers/okcomputer.rb
|
52
|
+
class MyCustomCheck < OKComputer::Check
|
53
|
+
def call
|
54
|
+
if rand(10).even?
|
55
|
+
"Even is great!"
|
56
|
+
else
|
57
|
+
mark_failure
|
58
|
+
"We don't like odd numbers"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
OKComputer::Registry.register "check_for_odds", MyCustomCheck.new
|
64
|
+
```
|
42
65
|
|
43
66
|
## Performing Checks
|
44
67
|
|
data/lib/okcomputer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okcomputer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 2772861255282844585
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: 2772861255282844585
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
114
|
rubygems_version: 1.8.24
|