server_health_check-rails 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: a7d004c34bd54d630334a90042a8020289d73aae50d5678879c3558bb1d8e556
4
- data.tar.gz: f08afd952b0ab29194f4ea5943b3a8a6c54db15a968170d9a56e6839c6f7d13d
2
+ SHA1:
3
+ metadata.gz: a4134d4a7eb67af5bccc2b95826d434feb9b3aaa
4
+ data.tar.gz: e588cc8e89148d7ae56a7a61f588e45dc0fb8ebd
5
5
  SHA512:
6
- metadata.gz: dff22d544059fdb3c138454dea864dfcee8641b478ec2d5b63c5361d9c2a2209211244fd4f6ef42d77f63ffd9ab8f4432405f1a47e49f0bc286a4aaf024cbe36
7
- data.tar.gz: 2d73e4a3bd9b8864db2e6a982af4f32f6caca37cc283ca6a82a1a5a178acec687cda0dbab9bc3154899cceb01cf042c4551468d5f3197569ee99c75004f487cd
6
+ metadata.gz: 9d71156179804ef8aa43361c924836da6f24dee93b94a8cb79d45d7164435fc764a4abc20bc008a7d2e02b1a92375fb759b102d3529ea7f8ef43f2cbbcd56aa7
7
+ data.tar.gz: 7e2e69e502828185d8463c92d6a115b884c2902305a268d5ee67cc64a3b76987dce929f9db59512f31206b1246893a3f160524bab441f22ee4476d75d9ffa89e
@@ -1,60 +1,27 @@
1
- require "server_health_check"
1
+ require "server_health_check/rack"
2
2
  require "server_health_check_rails/version"
3
3
  require "server_health_check_rails/engine"
4
- require "set"
5
4
 
6
5
  module ServerHealthCheckRails
7
6
  class << self
8
- def all_checks
9
- raise ArgumentError, "Please configure server_health_check-rails!" if @checks.nil?
10
- @checks.keys
7
+ def method_missing(method, *args, &block)
8
+ ServerHealthCheckRack::Checks.send(method, *args, &block)
11
9
  end
12
10
 
13
- def apply_checks(server_health_check, checks)
14
- raise ArgumentError, "Please configure server_health_check-rails!" if @checks.nil?
15
- checks = Set.new(checks)
16
-
17
- @checks.each do |name, check|
18
- next unless checks.include?(name)
19
- check.call(server_health_check)
20
- end
21
- end
22
-
23
- def check(name, &block)
24
- add_check name do |server_health_check|
25
- server_health_check.check!(name, &block)
26
- end
27
- end
28
-
29
- def check_active_record!
30
- add_check "active_record" do |server_health_check|
31
- server_health_check.active_record!
32
- end
33
- end
34
-
35
- def check_redis!(host: nil, port: 6379)
36
- add_check "redis" do |server_health_check|
37
- server_health_check.redis! host: host, port: port
38
- end
11
+ def respond_to_missing?(method, include_private = false)
12
+ ServerHealthCheckRack::Checks.respond_to?(method)
39
13
  end
14
+ end
40
15
 
41
- def check_aws_s3!(bucket = nil)
42
- add_check "aws_s3" do |server_health_check|
43
- server_health_check.aws_s3! bucket
16
+ class Config
17
+ class << self
18
+ def method_missing(method, *args, &block)
19
+ ServerHealthCheckRack::Config.send(method, *args, &block)
44
20
  end
45
- end
46
21
 
47
- def check_aws_creds!
48
- add_check "aws_creds" do |server_health_check|
49
- server_health_check.aws_creds!
22
+ def respond_to_missing?(method, include_private = false)
23
+ ServerHealthCheckRack::Config.respond_to?(method)
50
24
  end
51
25
  end
52
-
53
- private
54
-
55
- def add_check(name, &block)
56
- @checks ||= {}
57
- @checks[name] = block
58
- end
59
26
  end
60
27
  end
@@ -1,5 +1,9 @@
1
1
  module ServerHealthCheckRails
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace ServerHealthCheckRails
4
+
5
+ initializer "ServerHealthCheckRails.add_middleware" do |app|
6
+ app.middleware.unshift ServerHealthCheckRack::Middleware
7
+ end
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module ServerHealthCheckRails
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_health_check-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Virata-Stone
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-04 00:00:00.000000000 Z
11
+ date: 2017-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '3.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.0'
22
+ version: '6.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,41 +29,35 @@ dependencies:
29
29
  version: '3.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.0'
32
+ version: '6.0'
33
33
  - !ruby/object:Gem::Dependency
34
- name: server_health_check
34
+ name: server_health_check-rack
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.0'
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
- version: 1.0.1
39
+ version: '0'
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.0'
50
44
  - - ">="
51
45
  - !ruby/object:Gem::Version
52
- version: 1.0.1
46
+ version: '0'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: bundler
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
- - - ">="
51
+ - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '1.17'
53
+ version: '1.13'
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
57
  requirements:
64
- - - ">="
58
+ - - "~>"
65
59
  - !ruby/object:Gem::Version
66
- version: '1.17'
60
+ version: '1.13'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: rake
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -102,10 +96,6 @@ extra_rdoc_files: []
102
96
  files:
103
97
  - CODE_OF_CONDUCT.md
104
98
  - LICENSE.txt
105
- - app/controllers/server_health_check_rails/application_controller.rb
106
- - app/controllers/server_health_check_rails/health_controller.rb
107
- - app/models/server_health_check_rails/health_check.rb
108
- - config/routes.rb
109
99
  - lib/server_health_check-rails.rb
110
100
  - lib/server_health_check/rails.rb
111
101
  - lib/server_health_check_rails.rb
@@ -130,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
120
  - !ruby/object:Gem::Version
131
121
  version: '0'
132
122
  requirements: []
133
- rubygems_version: 3.0.6
123
+ rubyforge_project:
124
+ rubygems_version: 2.4.8
134
125
  signing_key:
135
126
  specification_version: 4
136
127
  summary: Healthcheck for Rails apps.
@@ -1,5 +0,0 @@
1
- module ServerHealthCheckRails
2
- class ApplicationController < ActionController::Base
3
- protect_from_forgery with: :exception
4
- end
5
- end
@@ -1,13 +0,0 @@
1
- module ServerHealthCheckRails
2
- class HealthController < ServerHealthCheckRails::ApplicationController
3
- def index
4
- check = ServerHealthCheckRails::HealthCheck.all
5
- render status: check.http_status, json: check.to_h
6
- end
7
-
8
- def show
9
- check = ServerHealthCheckRails::HealthCheck.new(params[:id])
10
- render status: check.http_status, json: check.to_h
11
- end
12
- end
13
- end
@@ -1,26 +0,0 @@
1
- module ServerHealthCheckRails
2
- class HealthCheck
3
- def initialize(*checks, logger: Rails.logger)
4
- @check = ServerHealthCheck.new(logger: logger)
5
- ServerHealthCheckRails.apply_checks(@check, checks)
6
- end
7
-
8
- def self.all
9
- new(*ServerHealthCheckRails.all_checks)
10
- end
11
-
12
- def http_status
13
- if @check.ok?
14
- 200
15
- else
16
- 500
17
- end
18
- end
19
-
20
- def to_h
21
- {
22
- status: @check.results
23
- }
24
- end
25
- end
26
- end
data/config/routes.rb DELETED
@@ -1,3 +0,0 @@
1
- ServerHealthCheckRails::Engine.routes.draw do
2
- resources :health, only: [:index, :show]
3
- end