pingable 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,7 +3,7 @@ Pingable
3
3
 
4
4
  Pingable is a simple framework to implement a 'ping' URL in Rack-based web applications.
5
5
 
6
- For example, a Rails or Sinatra app's `config.ru` may look like this:
6
+ For example, a Rails or Sinatra app's `config.ru` may look like this (Rack 1.4.0 and later):
7
7
 
8
8
  map '/ping' do
9
9
  use Pingable::Handler
@@ -44,6 +44,11 @@ Something a bit more complex:
44
44
 
45
45
  Pingable.add_check TwitterCheck.new(:url => "http://twitter.com/")
46
46
 
47
+ Rack compatibility
48
+ ------------------
49
+
50
+ Pre-Rack 1.4.0, `map` seems broken, and requires jumping through a few hoops to mount different paths. See `example/config.ru` for an example.
51
+
47
52
  Configuration
48
53
  -------------
49
54
 
@@ -59,7 +64,7 @@ Ping check
59
64
 
60
65
  `/ping` is implemented by running all registered checks.
61
66
 
62
- On failure, an HTTP `500` is returned, with the body of the response being a `text/plain` text with each error on separate lines.
67
+ On failure, an HTTP `503` is returned, with the body of the response being a `text/plain` text with each error on separate lines.
63
68
 
64
69
  On success, a `200 OK` is returned, with either the application's name as the body (if defined), or an empty body.
65
70
 
data/example/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+ gem 'activerecord'
3
+ gem 'thin'
4
+ gem 'pingable'
@@ -0,0 +1,36 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.2.1)
5
+ activesupport (= 3.2.1)
6
+ builder (~> 3.0.0)
7
+ activerecord (3.2.1)
8
+ activemodel (= 3.2.1)
9
+ activesupport (= 3.2.1)
10
+ arel (~> 3.0.0)
11
+ tzinfo (~> 0.3.29)
12
+ activesupport (3.2.1)
13
+ i18n (~> 0.6)
14
+ multi_json (~> 1.0)
15
+ arel (3.0.0)
16
+ builder (3.0.0)
17
+ daemons (1.1.6)
18
+ eventmachine (0.12.10)
19
+ i18n (0.6.0)
20
+ multi_json (1.0.4)
21
+ pingable (0.0.3)
22
+ rack (>= 1.0.0)
23
+ rack (1.4.0)
24
+ thin (1.3.1)
25
+ daemons (>= 1.0.9)
26
+ eventmachine (>= 0.12.6)
27
+ rack (>= 1.0.0)
28
+ tzinfo (0.3.31)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ activerecord
35
+ pingable
36
+ thin
data/example/config.ru CHANGED
@@ -6,9 +6,23 @@ Pingable.add_check lambda {
6
6
  {:message => "oh noes"}
7
7
  }
8
8
 
9
- map '/ping' do
10
- use Pingable::Handler, "myapp"
11
- end
12
- run lambda { |env|
13
- [200, {'Content-Type' => 'text/plain'}, ['OK']]
14
- }
9
+ if true
10
+ # Rack 1.4.0 and later
11
+ map '/ping' do
12
+ use Pingable::Handler, "myapp"
13
+ end
14
+ run lambda { |env|
15
+ [200, {'Content-Type' => 'text/plain'}, ['OK']]
16
+ }
17
+ else
18
+ # Earlier Rack versions barf without this
19
+ map '/ping' do
20
+ use Pingable::Handler, "myapp"
21
+ run nil
22
+ end
23
+ map '/' do
24
+ run lambda { |env|
25
+ [200, {'Content-Type' => 'text/plain'}, ['OK']]
26
+ }
27
+ end
28
+ end
data/example/run.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ bundle install
4
+ bundle exec thin -p 3000 -R config.ru start
@@ -10,7 +10,7 @@ module Pingable
10
10
  def call(env)
11
11
  failures = Pingable.run_checks!
12
12
  if failures.any?
13
- [500, HEADERS, failures.map { |f| f[:message] }.join("\n")]
13
+ [503, HEADERS, failures.map { |f| f[:message] }.join("\n")]
14
14
  else
15
15
  [200, HEADERS, @name ||= '']
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Pingable
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,68 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pingable
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Alexander Staubo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-27 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-27 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70205298320220 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rack
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70205298320220
25
+ - !ruby/object:Gem::Dependency
26
+ name: rack
27
+ requirement: &70205298319720 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 23
43
- segments:
44
- - 1
45
- - 0
46
- - 0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
47
32
  version: 1.0.0
48
33
  type: :runtime
49
- version_requirements: *id002
50
- description: Pingable is a Rack handler that let an app respond to a path /ping, with pluggable checks.
51
- email:
34
+ prerelease: false
35
+ version_requirements: *70205298319720
36
+ description: Pingable is a Rack handler that let an app respond to a path /ping, with
37
+ pluggable checks.
38
+ email:
52
39
  - alex@origo.no
53
40
  executables: []
54
-
55
41
  extensions: []
56
-
57
42
  extra_rdoc_files: []
58
-
59
- files:
43
+ files:
60
44
  - .gitignore
61
45
  - Gemfile
62
46
  - LICENSE
63
47
  - README.md
64
48
  - Rakefile
49
+ - example/Gemfile
50
+ - example/Gemfile.lock
65
51
  - example/config.ru
52
+ - example/run.sh
66
53
  - lib/pingable.rb
67
54
  - lib/pingable/common_checks.rb
68
55
  - lib/pingable/core.rb
@@ -71,36 +58,27 @@ files:
71
58
  - pingable.gemspec
72
59
  homepage: http://github.com/origo/pingable
73
60
  licenses: []
74
-
75
61
  post_install_message:
76
62
  rdoc_options: []
77
-
78
- require_paths:
63
+ require_paths:
79
64
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
65
+ required_ruby_version: !ruby/object:Gem::Requirement
81
66
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
72
  none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
98
77
  requirements: []
99
-
100
78
  rubyforge_project: pingable
101
- rubygems_version: 1.8.6
79
+ rubygems_version: 1.8.15
102
80
  signing_key:
103
81
  specification_version: 3
104
- summary: Pingable is a Rack handler that let an app respond to a path /ping, with pluggable checks.
82
+ summary: Pingable is a Rack handler that let an app respond to a path /ping, with
83
+ pluggable checks.
105
84
  test_files: []
106
-