rack-heartbeat 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack/heartbeat/middleware.rb +17 -0
- data/lib/rack/heartbeat/railtie.rb +2 -0
- data/lib/rack/heartbeat/version.rb +1 -1
- data/lib/rack/heartbeat.rb +2 -19
- metadata +2 -3
- data/lib/..rb +0 -5
- data/lib/rack-heartbeat.rb +0 -2
@@ -0,0 +1,17 @@
|
|
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
|
data/lib/rack/heartbeat.rb
CHANGED
@@ -1,20 +1,3 @@
|
|
1
|
-
|
2
|
-
|
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
|
18
|
-
|
19
|
-
require File.expand_path('../heartbeat/railtie', __FILE__) if defined?(Rails)
|
1
|
+
require 'rack'
|
2
|
+
require 'rack/heartbeat/railtie' if defined?(Rails)
|
20
3
|
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -41,9 +41,8 @@ files:
|
|
41
41
|
- LICENSE
|
42
42
|
- README.md
|
43
43
|
- Rakefile
|
44
|
-
- lib/..rb
|
45
|
-
- lib/rack-heartbeat.rb
|
46
44
|
- lib/rack/heartbeat.rb
|
45
|
+
- lib/rack/heartbeat/middleware.rb
|
47
46
|
- lib/rack/heartbeat/railtie.rb
|
48
47
|
- lib/rack/heartbeat/version.rb
|
49
48
|
- rack-heartbeat.gemspec
|
data/lib/..rb
DELETED
data/lib/rack-heartbeat.rb
DELETED