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.
@@ -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
@@ -1,6 +1,8 @@
1
1
  module Rack
2
2
 
3
3
  class HeartBeatRailtie < Rails::Railtie
4
+ require 'middleware'
5
+
4
6
  initializer "heartbeat.initializer" do |app|
5
7
  app.middleware.insert_before('Rack::Lock', 'Rack::Heartbeat')
6
8
  end
@@ -1,3 +1,3 @@
1
1
  module Rack::Heartbeat
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,20 +1,3 @@
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
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.1
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
@@ -1,5 +0,0 @@
1
- require "./version"
2
-
3
- module .
4
- # Your code goes here...
5
- end
@@ -1,2 +0,0 @@
1
- require 'rack'
2
- require 'rack/heartbeat'