goodguide-pinglish 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzVmMGY0ODBmZTRmZGMwOTI3OTg2MDY5MGU5NDllMzNjZjkwZTk1OQ==
4
+ N2QyYmIwZjlmNjU0ODk0MDk4NDAzMWI5NDEyYzkyNzU4NWI5YzUyYg==
5
5
  data.tar.gz: !binary |-
6
- NzI2YTdjODVlYTk4YmRiYjU1OGZhZjg2OWIwYWRkZGE5ZWU1YmRlNg==
6
+ NmVlMmFjNDhmY2JjZTdiN2U1M2Q5ZjBlMTY2OTU5MDJjYTg5ZDI4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2Q0M2RlYWUyOWI0NDVkMDQxZTQ0NWU4Nzg1M2NkZGMyMTkwZDdiZDE4MmQz
10
- MjI4ZmZmZmQ3MmViNWVhNjk5MWYzZjdhYzRkNzJkYjk2YzQ2ODczMzhhYjg1
11
- NzA5YTk3Yjc5YTVjM2E1MTI1ZjlhMWJiNzk5Y2U5ZWNhMmQ2NGY=
9
+ OTRmMmJiOTkyNzFlYmRkMjFmOTAyYTBhY2FmZGJjNDlhYmVkZDVmNWNkYjMx
10
+ NWE2YjUwOTFlZThlNjIwMDk4MTExOWUwZTExODkyODYzZWNkNGFmNDRkN2M0
11
+ ZDI1MjAyMDZjNGFjYzI2NjU4NGQ3NzA4MzgxNzM5ZmY0OTJiZGE=
12
12
  data.tar.gz: !binary |-
13
- ZGI5MWVhYmE0ZDI0NGRhYThjNTIxMDJkMDQ2NWVkZWZhMGIzZDA2MGM1NGMy
14
- MjRjZjRlNDI3M2ZiNmQ0MThmZGI3ZTlhMjVmZTZkNGFlYTc4YzA1MDcxY2My
15
- Yjc5OTFhYzU1NWIxYjk1YjM0YWI5NGY3MzZlMmY2MWY0MDhhY2E=
13
+ NWNlYmY5NzcwZmNjNDc0YTE1YWE1NDI0Mzc0NTUwMWU1Mzk0YTgzYTNhODVh
14
+ OTIzZWVkY2EzZmY3MzEwZDVmNjRlZmE3NGExOGExYzMzYzU0Mzg0ODI5OTM3
15
+ M2VlYjNmNWIwYjliYmY0NGM2MWI4YTAzOTk3N2RiMTUwNzY0NWY=
data/.travis.yml CHANGED
@@ -7,8 +7,11 @@ rvm:
7
7
  - rbx-2
8
8
  - ruby-head
9
9
  - jruby-head
10
- before_install: gem install bundler
11
10
 
11
+ env:
12
+ - TRAVIS_CI=true
13
+
14
+ before_install: gem install bundler
12
15
  bundler_args: --jobs=4 --retry=5
13
16
 
14
17
  deploy:
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/README.md CHANGED
@@ -11,9 +11,6 @@ A simple Rack app for checking application health. Pinglish responds to `GET` re
11
11
  agains my MySQL database," "Can I create/read keys in Redis," or "How
12
12
  many docs are in my ElasticSearch index?"
13
13
 
14
- 0. The response __must__ return within 29 seconds. This is one second
15
- less than the default timeout for many monitoring services.
16
-
17
14
  0. The response __must__ return an `HTTP 200 OK` status code if all
18
15
  health checks pass.
19
16
 
@@ -1,20 +1,20 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |gem|
4
- gem.name = "goodguide-pinglish"
5
- gem.version = "1.1.0"
6
- gem.authors = ["John Barnette", "Will Farrington"]
7
- gem.email = ["jbarnette@github.com", "wfarr@github.com"]
8
- gem.description = "A simple Rack middleware for checking app health."
9
- gem.summary = "/_ping your way to freedom."
10
- gem.homepage = "https://github.com/goodguide/pinglish"
4
+ gem.name = 'goodguide-pinglish'
5
+ gem.version = '1.2.0'
6
+ gem.authors = ['John Barnette', 'Will Farrington', 'Ryan Long']
7
+ gem.email = ['jbarnette@github.com', 'wfarr@github.com', 'ryan@rtlong.com']
8
+ gem.description = 'A simple Rack middleware for checking app health.'
9
+ gem.summary = '/_ping your way to freedom.'
10
+ gem.homepage = 'https://github.com/goodguide/pinglish'
11
11
 
12
12
  gem.files = `git ls-files`.split($/)
13
13
  gem.test_files = gem.files.grep(/^test/)
14
- gem.require_paths = ["lib"]
14
+ gem.require_paths = ['lib']
15
15
 
16
- gem.add_dependency "rack"
16
+ gem.add_dependency 'rack'
17
17
  gem.add_development_dependency 'rake', '~> 10.4.0'
18
- gem.add_development_dependency "minitest", "~> 4.5"
19
- gem.add_development_dependency "rack-test", "~> 0.6"
18
+ gem.add_development_dependency 'minitest', '~> 4.5'
19
+ gem.add_development_dependency 'rack-test', '~> 0.6'
20
20
  end
data/lib/pinglish.rb CHANGED
@@ -1,7 +1,6 @@
1
- require "json"
2
- require "pinglish/check"
3
- require "rack/request"
4
- require "timeout"
1
+ require 'json'
2
+ require 'pinglish/check'
3
+ require 'rack/request'
5
4
 
6
5
  # This Rack app provides an endpoint for configurable
7
6
  # system health checks. It's intended to be consumed by machines.
@@ -10,96 +9,97 @@ class Pinglish
10
9
 
11
10
  # The HTTP headers sent for every response.
12
11
  HEADERS = {
13
- "Content-Type" => "application/json; charset=UTF-8"
12
+ 'Content-Type' => 'application/json; charset=UTF-8'
14
13
  }
15
14
 
16
- # Raised when a check exceeds its timeout.
17
- class TooLong < RuntimeError; end
18
-
19
- # Create a new instance of the app, with optional parameter `:max` timeout in seconds (default: `29`); yields itself to an optional block for configuring checks.
15
+ # Create a new instance of the app; yields itself to an optional block for configuring checks.
20
16
  def initialize(options=nil, &block)
21
17
  options ||= {}
22
18
 
23
19
  @checks = {}
24
- @max = options[:max] || 29 # seconds
25
20
 
26
- yield self if block_given?
21
+ yield(self) if block_given?
27
22
  end
28
23
 
29
24
  def call(env)
30
25
  request = Rack::Request.new(env)
26
+ results = {}
31
27
 
32
- begin
33
- timeout @max do
34
- results = {}
35
-
36
- selected_checks(request.params).each do |check|
37
- begin
38
- timeout(check.timeout) do
39
- results[check.name] = check.call
40
- end
41
- rescue => e
42
- results[check.name] = e
43
- end
44
- end
28
+ selected_checks(request.params).each do |check|
29
+ check_thread = Thread.new do
30
+ check.call
31
+ end
32
+ sleep_thread = Thread.new do
33
+ sleep check.timeout
34
+ check_thread.kill
35
+ :timeout
36
+ end
37
+ begin
38
+ val = check_thread.value
39
+ rescue => e
40
+ val = e
41
+ end
42
+ sleep_thread.kill
43
+ results[check.name] = sleep_thread.value || val
44
+ end
45
45
 
46
- failed = results.values.any? { |v| failure? v }
47
- http_status = failed ? 503 : 200
48
- text_status = failed ? "failures" : "ok"
46
+ failed = results.values.any? { |v| failure?(v) }
47
+ http_status = failed ? 503 : 200
48
+ text_status = failed ? 'failures' : 'ok'
49
49
 
50
- data = {
51
- :now => Time.now.to_i.to_s,
52
- :status => text_status
53
- }
50
+ data = {
51
+ now: Time.now.to_i,
52
+ status: text_status,
53
+ }
54
+
55
+ results.each do |name, value|
56
+ if timeout?(value)
57
+ # If the check failed because it timed out, its name is
58
+ # added to a `timeouts` array instead.
59
+ (data[:timeouts] ||= []) << name
60
+
61
+ elsif failure?(value)
62
+ # If a check fails its name is added to a `failures` array.
54
63
 
55
- results.each do |name, value|
56
- if failure?(value)
57
- # If a check fails its name is added to a `failures` array.
58
- # If the check failed because it timed out, its name is
59
- # added to a `timeouts` array instead.
60
-
61
- key = timeout?(value) ? :timeouts : :failures
62
- (data[key] ||= []) << name
63
-
64
- if key == :failures and value.is_a?(Exception)
65
- data[name] = {
66
- state: :error,
67
- exception: value.class.name,
68
- message: value.message,
69
- }
70
- end
71
-
72
- elsif value
73
- # If the check passed and returned a value, the stringified
74
- # version of the value is returned under the `name` key.
75
-
76
- data[name] = value
77
- end
64
+ (data[:failures] ||= []) << name
65
+
66
+ if value.is_a?(Exception)
67
+ data[name] = {
68
+ state: :error,
69
+ exception: value.class.name,
70
+ message: value.message,
71
+ }
78
72
  end
79
73
 
80
- [http_status, HEADERS, [JSON.generate(data)]]
74
+ elsif value
75
+ # If the check passed and returned a value, the stringified
76
+ # version of the value is returned under the `name` key.
77
+
78
+ data[name] = value
81
79
  end
80
+ end
82
81
 
83
- rescue Exception => ex
84
- # Something catastrophic happened. We can't even run the checks
85
- # and render a JSON response. Fall back on a pre-rendered string
86
- # and interpolate the current epoch time.
82
+ [http_status, HEADERS, [JSON.generate(data)]]
87
83
 
88
- now = Time.now.to_i.to_s
84
+ rescue Exception => ex
85
+ # Something catastrophic happened. We can't even run the checks
86
+ # and render a JSON response. Fall back on a pre-rendered string
87
+ # and interpolate the current epoch time.
89
88
 
90
- body = <<-EOF.gsub(/^ {6}/, '')
89
+ now = Time.now.to_i
90
+
91
+ body = <<-EOF.gsub(/^ {6}/, '')
91
92
  {
92
93
  "status": "failures",
93
- "now": "#{now}",
94
+ "now": #{now},
94
95
  "error": {
95
96
  "class": "#{ex.class.name}",
96
97
  "message": "#{ex.message.tr('"', '')}"
97
98
  }
98
99
  }
99
- EOF
100
+ EOF
100
101
 
101
- [500, HEADERS, [body]]
102
- end
102
+ [500, HEADERS, [body]]
103
103
  end
104
104
 
105
105
  def selected_checks(params)
@@ -124,23 +124,10 @@ class Pinglish
124
124
  # Subclasses can override this method for different behavior.
125
125
 
126
126
  def failure?(value)
127
- value.is_a?(Exception) || value == false
127
+ value.is_a?(Exception) || value == false || timeout?(value)
128
128
  end
129
129
 
130
- # Raise Pinglish::TooLong after `seconds` has elapsed. This default
131
- # implementation uses Ruby's built-in Timeout class. Subclasses can
132
- # override this method for different behavior, but any new
133
- # implementation must raise Pinglish::TooLong when the timeout is
134
- # exceeded or override `timeout?` appropriately.
135
-
136
- def timeout(seconds, &block)
137
- Timeout.timeout seconds, Pinglish::TooLong, &block
138
- end
139
-
140
- # Does `value` represent a check timeout? Returns `true` for any
141
- # value that is an instance of Pinglish::TooLong.
142
-
143
130
  def timeout?(value)
144
- value.is_a? Pinglish::TooLong
131
+ value == :timeout
145
132
  end
146
133
  end
data/test/helper.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  require "minitest/autorun"
2
2
  require "pinglish"
3
+
4
+ TIME_UNIT = ENV['TRAVIS_CI'] ? 1 : 0.001
@@ -1,8 +1,8 @@
1
- require "helper"
2
- require "rack/test"
1
+ require 'helper'
2
+ require 'rack/test'
3
3
 
4
4
  class PinglishTest < MiniTest::Unit::TestCase
5
- FakeApp = lambda { |env| [200, {}, ["fake"]] }
5
+ FakeApp = lambda { |env| [200, {}, ['fake']] }
6
6
 
7
7
  def build_app(*args, &block)
8
8
  Rack::Builder.new do |builder|
@@ -18,7 +18,7 @@ class PinglishTest < MiniTest::Unit::TestCase
18
18
  builder.map '/_ping' do
19
19
  run Pinglish.new(*args, &block)
20
20
  end
21
- builder.run lambda { |env| raise "boom" }
21
+ builder.run lambda { |env| raise 'boom' }
22
22
  end
23
23
  end
24
24
 
@@ -27,7 +27,7 @@ class PinglishTest < MiniTest::Unit::TestCase
27
27
  session = Rack::Test::Session.new(app)
28
28
 
29
29
  assert_raises RuntimeError do
30
- session.get "/something"
30
+ session.get '/something'
31
31
  end
32
32
  end
33
33
 
@@ -35,14 +35,14 @@ class PinglishTest < MiniTest::Unit::TestCase
35
35
  app = build_app
36
36
 
37
37
  session = Rack::Test::Session.new(app)
38
- session.get "/_ping"
38
+ session.get '/_ping'
39
39
  assert_equal 200, session.last_response.status
40
- assert_equal "application/json; charset=UTF-8",
40
+ assert_equal 'application/json; charset=UTF-8',
41
41
  session.last_response.content_type
42
42
 
43
43
  json = JSON.load(session.last_response.body)
44
- assert json.key?("now")
45
- assert_equal "ok", json["status"]
44
+ assert json.key?('now')
45
+ assert_equal 'ok', json['status']
46
46
  end
47
47
 
48
48
  def test_with_good_check
@@ -52,16 +52,16 @@ class PinglishTest < MiniTest::Unit::TestCase
52
52
  end
53
53
 
54
54
  session = Rack::Test::Session.new(app)
55
- session.get "/_ping"
55
+ session.get '/_ping'
56
56
 
57
- assert_equal "application/json; charset=UTF-8",
57
+ assert_equal 'application/json; charset=UTF-8',
58
58
  session.last_response.content_type
59
59
 
60
60
  json = JSON.load(session.last_response.body)
61
- assert json.key?("now")
62
- assert_equal "ok", json["status"]
63
- assert_equal "up_and_at_em", json["db"]
64
- assert_equal "pushin_and_poppin", json["queue"]
61
+ assert json.key?('now')
62
+ assert_equal 'ok', json['status']
63
+ assert_equal 'up_and_at_em', json['db']
64
+ assert_equal 'pushin_and_poppin', json['queue']
65
65
  end
66
66
 
67
67
  def test_with_unnamed_check
@@ -70,62 +70,62 @@ class PinglishTest < MiniTest::Unit::TestCase
70
70
  end
71
71
 
72
72
  session = Rack::Test::Session.new(app)
73
- session.get "/_ping"
73
+ session.get '/_ping'
74
74
 
75
- assert_equal "application/json; charset=UTF-8",
75
+ assert_equal 'application/json; charset=UTF-8',
76
76
  session.last_response.content_type
77
77
 
78
78
  json = JSON.load(session.last_response.body)
79
- assert json.key?("now")
80
- assert_equal "ok", json["status"]
81
- assert_equal "yohoho", json["default"]
79
+ assert json.key?('now')
80
+ assert_equal 'ok', json['status']
81
+ assert_equal 'yohoho', json['default']
82
82
  end
83
83
 
84
84
  def test_with_unnamed_check_that_raises
85
85
  app = build_app do |ping|
86
- ping.check { raise "nooooope" }
86
+ ping.check { raise 'nooooope' }
87
87
  end
88
88
 
89
89
  session = Rack::Test::Session.new(app)
90
- session.get "/_ping"
90
+ session.get '/_ping'
91
91
 
92
- assert_equal "application/json; charset=UTF-8",
92
+ assert_equal 'application/json; charset=UTF-8',
93
93
  session.last_response.content_type
94
94
 
95
95
  json = JSON.load(session.last_response.body)
96
- assert json.key?("now")
97
- assert_equal 'failures', json["status"]
98
- assert_equal ['default'], json["failures"]
96
+ assert json.key?('now')
97
+ assert_equal 'failures', json['status']
98
+ assert_equal ['default'], json['failures']
99
99
  assert_equal({
100
100
  'state' => 'error',
101
101
  'exception' => 'RuntimeError',
102
102
  'message' => 'nooooope'
103
- }, json["default"])
103
+ }, json['default'])
104
104
  end
105
105
 
106
106
 
107
107
  def test_with_check_that_raises
108
108
  app = build_app do |ping|
109
109
  ping.check(:db) { :ok }
110
- ping.check(:raise) { raise "nooooope" }
110
+ ping.check(:raise) { raise 'nooooope' }
111
111
  end
112
112
 
113
113
  session = Rack::Test::Session.new(app)
114
- session.get "/_ping"
114
+ session.get '/_ping'
115
115
 
116
116
  assert_equal 503, session.last_response.status
117
- assert_equal "application/json; charset=UTF-8",
117
+ assert_equal 'application/json; charset=UTF-8',
118
118
  session.last_response.content_type
119
119
 
120
120
  json = JSON.load(session.last_response.body)
121
- assert json.key?("now")
122
- assert_equal "failures", json["status"]
123
- assert_equal ['raise'], json["failures"]
121
+ assert json.key?('now')
122
+ assert_equal 'failures', json['status']
123
+ assert_equal ['raise'], json['failures']
124
124
  assert_equal({
125
125
  'state' => 'error',
126
126
  'exception' => 'RuntimeError',
127
127
  'message' => 'nooooope'
128
- }, json["raise"])
128
+ }, json['raise'])
129
129
  end
130
130
 
131
131
  def test_with_check_that_returns_false
@@ -135,68 +135,50 @@ class PinglishTest < MiniTest::Unit::TestCase
135
135
  end
136
136
 
137
137
  session = Rack::Test::Session.new(app)
138
- session.get "/_ping"
138
+ session.get '/_ping'
139
139
 
140
140
  assert_equal 503, session.last_response.status
141
- assert_equal "application/json; charset=UTF-8",
141
+ assert_equal 'application/json; charset=UTF-8',
142
142
  session.last_response.content_type
143
143
 
144
144
  json = JSON.load(session.last_response.body)
145
- assert json.key?("now")
146
- assert_equal "failures", json["status"]
147
- assert_equal ["fail"], json["failures"]
148
- assert_equal false, json.key?("fail")
145
+ assert json.key?('now')
146
+ assert_equal 'failures', json['status']
147
+ assert_equal ['fail'], json['failures']
148
+ assert_equal false, json.key?('fail')
149
149
  end
150
150
 
151
151
  def test_with_check_that_times_out
152
152
  app = build_app do |ping|
153
153
  ping.check(:db) { :ok }
154
- ping.check(:long, :timeout => 0.001) { sleep 0.003 }
154
+ ping.check(:long, :timeout => TIME_UNIT) { sleep TIME_UNIT * 5 }
155
155
  end
156
156
 
157
157
  session = Rack::Test::Session.new(app)
158
- session.get "/_ping"
158
+ session.get '/_ping'
159
159
 
160
- assert_equal 503, session.last_response.status
161
- assert_equal "application/json; charset=UTF-8",
160
+ assert_equal 503, session.last_response.status, session.last_response.body
161
+ assert_equal 'application/json; charset=UTF-8',
162
162
  session.last_response.content_type
163
163
 
164
164
  json = JSON.load(session.last_response.body)
165
- assert json.key?("now")
166
- assert_equal "failures", json["status"]
167
- assert_equal ["long"], json["timeouts"]
168
- end
169
-
170
- def test_with_checks_taking_more_than_max
171
- app = build_app(:max => 0.001) do |ping|
172
- ping.check(:long) { sleep 0.003 }
173
- end
174
-
175
- session = Rack::Test::Session.new(app)
176
- session.get "/_ping"
177
-
178
- assert_equal 503, session.last_response.status
179
- assert_equal "application/json; charset=UTF-8",
180
- session.last_response.content_type
181
-
182
- json = JSON.load(session.last_response.body)
183
- assert json.key?("now")
184
- assert_equal "failures", json["status"]
185
- assert_equal ['long'], json["timeouts"]
165
+ assert json.key?('now')
166
+ assert_equal 'failures', json['status']
167
+ assert_equal ['long'], json['timeouts']
186
168
  end
187
169
 
188
170
  def test_with_script_name
189
171
  app = build_app
190
172
 
191
173
  session = Rack::Test::Session.new(app)
192
- session.get "/_ping", {}, "SCRIPT_NAME" => "/myapp"
174
+ session.get '/_ping', {}, 'SCRIPT_NAME' => '/myapp'
193
175
  assert_equal 200, session.last_response.status
194
- assert_equal "application/json; charset=UTF-8",
176
+ assert_equal 'application/json; charset=UTF-8',
195
177
  session.last_response.content_type
196
178
 
197
179
  json = JSON.load(session.last_response.body)
198
- assert json.key?("now")
199
- assert_equal "ok", json["status"]
180
+ assert json.key?('now')
181
+ assert_equal 'ok', json['status']
200
182
  end
201
183
 
202
184
  def test_with_selective_checks
@@ -207,17 +189,17 @@ class PinglishTest < MiniTest::Unit::TestCase
207
189
  end
208
190
 
209
191
  session = Rack::Test::Session.new(app)
210
- session.get "/_ping?checks=db,foo"
192
+ session.get '/_ping?checks=db,foo'
211
193
 
212
194
  assert_equal 200, session.last_response.status
213
- assert_equal "application/json; charset=UTF-8",
195
+ assert_equal 'application/json; charset=UTF-8',
214
196
  session.last_response.content_type
215
197
 
216
198
  json = JSON.load(session.last_response.body)
217
- assert json.key?("now")
218
- assert_equal "ok", json["status"]
219
- assert_equal false, json.key?("timeouts")
220
- assert_equal false, json.key?("failures")
199
+ assert json.key?('now')
200
+ assert_equal 'ok', json['status']
201
+ assert_equal false, json.key?('timeouts')
202
+ assert_equal false, json.key?('failures')
221
203
  assert_equal 'ok', json['db']
222
204
  assert_equal 'bar', json['foo']
223
205
  end
@@ -245,19 +227,13 @@ class PinglishTest < MiniTest::Unit::TestCase
245
227
  refute pinglish.failure?(:ok)
246
228
  end
247
229
 
248
- def test_timeout
249
- pinglish = Pinglish.new(FakeApp)
250
-
251
- assert_raises Pinglish::TooLong do
252
- pinglish.timeout(0.001) { sleep 0.003 }
253
- end
254
- end
255
-
256
230
  def test_timeout_boolean
257
231
  pinglish = Pinglish.new(FakeApp)
258
232
 
259
- assert pinglish.timeout?(Pinglish::TooLong.new)
260
- refute pinglish.timeout?(Exception.new)
233
+ assert pinglish.timeout?(:timeout)
234
+ refute pinglish.timeout?(:foo)
235
+ refute pinglish.timeout?(false)
236
+ refute pinglish.timeout?(StandardError.new)
261
237
  end
262
238
 
263
239
  def test_enabled_by_default_false
@@ -267,19 +243,19 @@ class PinglishTest < MiniTest::Unit::TestCase
267
243
  end
268
244
 
269
245
  session = Rack::Test::Session.new(app)
270
- session.get "/_ping"
246
+ session.get '/_ping'
271
247
 
272
248
  assert_equal 200, session.last_response.status
273
- assert_equal "application/json; charset=UTF-8",
249
+ assert_equal 'application/json; charset=UTF-8',
274
250
  session.last_response.content_type
275
251
 
276
252
  json = JSON.load(session.last_response.body)
277
- assert json.key?("now")
278
- assert_equal "ok", json["status"]
279
- assert_equal false, json.key?("timeouts")
280
- assert_equal false, json.key?("failures")
253
+ assert json.key?('now')
254
+ assert_equal 'ok', json['status']
255
+ assert_equal false, json.key?('timeouts')
256
+ assert_equal false, json.key?('failures')
281
257
  assert_equal 'ok', json['db']
282
- assert_equal false, json.key?("intense")
258
+ assert_equal false, json.key?('intense')
283
259
  end
284
260
 
285
261
  def test_enabled_by_default_selected
@@ -289,18 +265,18 @@ class PinglishTest < MiniTest::Unit::TestCase
289
265
  end
290
266
 
291
267
  session = Rack::Test::Session.new(app)
292
- session.get "/_ping?checks=db,intense"
268
+ session.get '/_ping?checks=db,intense'
293
269
 
294
270
  assert_equal 200, session.last_response.status
295
- assert_equal "application/json; charset=UTF-8",
271
+ assert_equal 'application/json; charset=UTF-8',
296
272
  session.last_response.content_type
297
273
 
298
274
  json = JSON.load(session.last_response.body)
299
- assert json.key?("now")
300
- assert_equal "ok", json["status"]
301
- assert_equal false, json.key?("timeouts")
302
- assert_equal false, json.key?("failures")
275
+ assert json.key?('now')
276
+ assert_equal 'ok', json['status']
277
+ assert_equal false, json.key?('timeouts')
278
+ assert_equal false, json.key?('failures')
303
279
  assert_equal 'ok', json['db']
304
- assert_equal 'ok', json["intense"]
280
+ assert_equal 'ok', json['intense']
305
281
  end
306
282
  end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodguide-pinglish
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette
8
8
  - Will Farrington
9
+ - Ryan Long
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -71,6 +72,7 @@ description: A simple Rack middleware for checking app health.
71
72
  email:
72
73
  - jbarnette@github.com
73
74
  - wfarr@github.com
75
+ - ryan@rtlong.com
74
76
  executables: []
75
77
  extensions: []
76
78
  extra_rdoc_files: []
@@ -84,9 +86,6 @@ files:
84
86
  - goodguide-pinglish.gemspec
85
87
  - lib/pinglish.rb
86
88
  - lib/pinglish/check.rb
87
- - script/bootstrap
88
- - script/release
89
- - script/test
90
89
  - test/check_test.rb
91
90
  - test/helper.rb
92
91
  - test/pinglish_test.rb
data/script/bootstrap DELETED
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
- # Make sure local development dependencies are satisfied.
3
-
4
- set -e
5
-
6
- cd $(dirname "$0")/..
7
- rm -rf .bundle/config
8
-
9
- bundle install --path .bundle --binstubs .bundle/binstubs --quiet "$@"
data/script/release DELETED
@@ -1,38 +0,0 @@
1
- #!/bin/sh
2
- # Tag and push a release.
3
-
4
- set -e
5
-
6
- # Make sure we're in the project root.
7
-
8
- cd $(dirname "$0")/..
9
-
10
- # Build a new gem archive.
11
-
12
- rm -rf pinglish-*.gem
13
- gem build -q pinglish.gemspec
14
-
15
- # Make sure we're on the master branch.
16
-
17
- (git branch | grep -q '* master') || {
18
- echo "Only release from the master branch."
19
- exit 1
20
- }
21
-
22
- # Figure out what version we're releasing.
23
-
24
- tag=v`ls pinglish-*.gem | sed 's/^pinglish-\(.*\)\.gem$/\1/'`
25
-
26
- # Make sure we haven't released this version before.
27
-
28
- git fetch -t origin
29
-
30
- (git tag -l | grep -q "$tag") && {
31
- echo "Whoops, there's already a '${tag}' tag."
32
- exit 1
33
- }
34
-
35
- # Tag it and bag it.
36
-
37
- gem push pinglish-*.gem && git tag "$tag" &&
38
- git push origin master && git push origin "$tag"
data/script/test DELETED
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
- # Run the tests.
3
-
4
- set -e
5
-
6
- cd $(dirname "$0")/..
7
-
8
- script/bootstrap && ruby -I lib -I test -rubygems \
9
- -e 'require "bundler/setup"; Dir["test/**/*_test.rb"].each { |f| load f }' "$@"