rack-heartbeat 0.0.2 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack-heartbeat.rb +2 -0
- data/lib/rack/heartbeat.rb +16 -2
- data/lib/rack/heartbeat/railtie.rb +3 -5
- data/rack-heartbeat.gemspec +2 -3
- metadata +4 -6
- data/..gemspec +0 -17
- data/lib/rack/heartbeat/middleware.rb +0 -17
- data/lib/rack/heartbeat/version.rb +0 -3
data/lib/rack/heartbeat.rb
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Rack
|
2
|
+
# A heartbeat mechanism for the server. This will add a _/heartbeat_ endpoint
|
3
|
+
# that returns status 200 and content OK when executed.
|
4
|
+
class Heartbeat
|
5
|
+
def initialize(app)
|
6
|
+
@app = app
|
7
|
+
end
|
3
8
|
|
9
|
+
def call(env)
|
10
|
+
if env['PATH_INFO'] == '/heartbeat'
|
11
|
+
[200, {}, 'OK']
|
12
|
+
else
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
module Rack
|
2
2
|
|
3
|
-
class
|
4
|
-
|
5
|
-
|
6
|
-
initializer "heartbeat.initializer" do |app|
|
7
|
-
app.middleware.insert_before('Rack::Lock', 'Rack::Heartbeat')
|
3
|
+
class Heartbeat::Railtie < Rails::Railtie
|
4
|
+
initializer "rack.heartbeat.initializer" do |app|
|
5
|
+
app.middleware.insert 0, 'Rack::Heartbeat'
|
8
6
|
end
|
9
7
|
end
|
10
8
|
|
data/rack-heartbeat.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require 'rack'
|
3
|
-
require File.expand_path('../lib/rack/heartbeat/version', __FILE__)
|
2
|
+
#require 'rack'
|
4
3
|
|
5
4
|
Gem::Specification.new do |gem|
|
6
5
|
gem.authors = ["James Cox"]
|
@@ -14,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
14
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
15
14
|
gem.name = "rack-heartbeat"
|
16
15
|
gem.require_paths = ["lib"]
|
17
|
-
gem.version =
|
16
|
+
gem.version = '0.5'
|
18
17
|
|
19
18
|
# deps
|
20
19
|
gem.add_dependency('rack')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-heartbeat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.5'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -35,16 +35,14 @@ executables: []
|
|
35
35
|
extensions: []
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
|
-
- ..gemspec
|
39
38
|
- .gitignore
|
40
39
|
- Gemfile
|
41
40
|
- LICENSE
|
42
41
|
- README.md
|
43
42
|
- Rakefile
|
43
|
+
- lib/rack-heartbeat.rb
|
44
44
|
- lib/rack/heartbeat.rb
|
45
|
-
- lib/rack/heartbeat/middleware.rb
|
46
45
|
- lib/rack/heartbeat/railtie.rb
|
47
|
-
- lib/rack/heartbeat/version.rb
|
48
46
|
- rack-heartbeat.gemspec
|
49
47
|
homepage: https://github.com/imajes/rack-heartbeat
|
50
48
|
licenses: []
|
@@ -66,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
64
|
version: '0'
|
67
65
|
requirements: []
|
68
66
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.
|
67
|
+
rubygems_version: 1.8.24
|
70
68
|
signing_key:
|
71
69
|
specification_version: 3
|
72
70
|
summary: provides a simple endpoint for your rails app for a heartbeat client to connect
|
data/..gemspec
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/./version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["James Cox"]
|
6
|
-
gem.email = ["james@imaj.es"]
|
7
|
-
gem.description = %q{TODO: Write a gem description}
|
8
|
-
gem.summary = %q{TODO: Write a gem summary}
|
9
|
-
gem.homepage = ""
|
10
|
-
|
11
|
-
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = "."
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.version = .::VERSION
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
# A heartbeat mechanism for the server. This will add a _/heartbeat_ endpoint
|
3
|
-
# that returns status 200 and content OK when executed.
|
4
|
-
class Heartbeat
|
5
|
-
def initialize(app)
|
6
|
-
@app = app
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
if env['PATH_INFO'] == '/heartbeat'
|
11
|
-
[200, {}, 'OK']
|
12
|
-
else
|
13
|
-
@app.call(env)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|