health_check 1.6.3 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +49 -11
- data/CHANGELOG +6 -5
- data/Gemfile +4 -1
- data/README.rdoc +35 -56
- data/config/routes.rb +3 -6
- data/health_check.gemspec +1 -3
- data/lib/health_check/health_check_routes.rb +10 -8
- data/lib/health_check/version.rb +1 -1
- data/lib/health_check.rb +2 -4
- data/test/init_variables +0 -2
- data/test/rails_3.0.gemfile +23 -0
- data/test/rails_3.1.gemfile +27 -0
- data/test/{rails_2.3.gemfile → rails_3.2.gemfile} +13 -18
- data/test/setup_railsapp +20 -32
- data/test/test_with_railsapp +1 -1
- metadata +83 -119
- data/Vagrantfile +0 -20
- data/test/provision_vagrant +0 -79
- data/test/rails_2.3_lts.gemfile +0 -41
data/.travis.yml
CHANGED
@@ -8,28 +8,66 @@ before_install:
|
|
8
8
|
- gem update --system $RUBYGEMS_VERSION
|
9
9
|
- gem --version
|
10
10
|
- gem install bundler ${BUNDLER_VERSION:+-v} ${BUNDLER_VERSION}
|
11
|
-
- gem install smarter_bundler
|
12
11
|
- bundle --version
|
12
|
+
- bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} --version
|
13
13
|
- mkdir -p tmp/bundle
|
14
14
|
|
15
15
|
bundler_args: "--binstubs"
|
16
16
|
|
17
17
|
script: ./test/test_with_railsapp
|
18
18
|
|
19
|
+
rvm:
|
20
|
+
- 1.9.3
|
21
|
+
|
22
|
+
gemfile:
|
23
|
+
- test/rails_3.2.gemfile
|
24
|
+
|
19
25
|
matrix:
|
20
26
|
allow_failures:
|
21
|
-
- rvm: 1.8.7
|
22
|
-
gemfile: test/rails_2.3_lts.gemfile
|
23
|
-
env: RUBYGEMS_VERSION=1.8.25 RAILS_VERSION=2.3
|
24
27
|
|
25
28
|
include:
|
26
|
-
# rails 2
|
27
|
-
|
28
|
-
- rvm: 1.
|
29
|
-
gemfile: test/
|
30
|
-
env:
|
29
|
+
# rails 3.2 jan 20, 2012 - ruby 1.8.7 or 1.9.2
|
30
|
+
|
31
|
+
- rvm: 1.9.3
|
32
|
+
gemfile: test/rails_3.2.gemfile
|
33
|
+
env: RAILS_SERVER=puma RAILS_VERSION=3.2
|
34
|
+
|
35
|
+
- rvm: 1.9.3
|
36
|
+
gemfile: test/rails_3.2.gemfile
|
37
|
+
env: RAILS_SERVER=passenger RAILS_VERSION=3.2
|
38
|
+
|
39
|
+
- rvm: 1.9.3
|
40
|
+
gemfile: test/rails_3.2.gemfile
|
41
|
+
env: RAILS_SERVER=thin RAILS_VERSION=3.2
|
42
|
+
|
43
|
+
- rvm: 1.9.3
|
44
|
+
gemfile: test/rails_3.2.gemfile
|
45
|
+
env: RAILS_SERVER=unicorn RAILS_VERSION=3.2
|
46
|
+
|
47
|
+
# Excluded since it takes way too long!
|
48
|
+
#- rvm: jruby-19mode
|
49
|
+
# gemfile: test/rails_3.2.gemfile
|
50
|
+
# env: BUNDLER_VERSION=1.12.5 RAILS_VERSION=3.2
|
51
|
+
|
52
|
+
- rvm: 2.2.0
|
53
|
+
gemfile: test/rails_3.2.gemfile
|
54
|
+
env: RAILS_VERSION=3.2
|
55
|
+
|
56
|
+
- rvm: 1.9.3
|
57
|
+
gemfile: test/rails_3.2.gemfile
|
58
|
+
env: RAILS_VERSION=3.2
|
59
|
+
|
60
|
+
# Excluded since it takes way too long!
|
61
|
+
#- rvm: jruby-19mode
|
62
|
+
# gemfile: test/rails_3.2.gemfile
|
63
|
+
# env: BUNDLER_VERSION=1.12.5 RAILS_VERSION=3.2
|
64
|
+
|
65
|
+
# rails 3.1 aug 31, 2011 - ruby 1.8.7 or 1.9.2
|
66
|
+
- rvm: 1.9.3
|
67
|
+
gemfile: test/rails_3.1.gemfile
|
68
|
+
env: RAILS_VERSION=3.1
|
31
69
|
|
32
70
|
- rvm: 1.8.7
|
33
|
-
gemfile: test/
|
34
|
-
env:
|
71
|
+
gemfile: test/rails_3.0.gemfile
|
72
|
+
env: RAILS_VERSION=3.0
|
35
73
|
|
data/CHANGELOG
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
= Change Log =
|
2
2
|
|
3
|
-
*
|
4
|
-
*1.
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
3
|
+
* pre_rails4 branch
|
4
|
+
*1.7.0
|
5
|
+
* Split away from rails2.3 branch
|
6
|
+
* removed rails 2.3 and 4.0 artifacts
|
7
|
+
* Fixed route reload issue
|
8
|
+
|
8
9
|
*1.6.0
|
9
10
|
* Added basic auth support - Thanks Kyle Conarro <kyle.conarro@gmail.com>
|
10
11
|
* Explicitly limit rails to < 4.0 for this branch
|
data/Gemfile
CHANGED
@@ -25,9 +25,12 @@ group :development, :test do
|
|
25
25
|
end
|
26
26
|
# run travis-lint to check .travis.yml
|
27
27
|
gem 'travis-lint'
|
28
|
+
platforms :ruby_18 do
|
29
|
+
# mime-types 2.0 requires Ruby version >= 1.9.2
|
30
|
+
gem "mime-types", "< 2.0"
|
31
|
+
end
|
28
32
|
#gem 'rake', ">= 0.8.3", "< 11.0"
|
29
33
|
#gem 'rack', "< 2.0"
|
30
34
|
|
31
35
|
end
|
32
36
|
|
33
|
-
gem 'json', [">=0", "< 2.0.0"] if RUBY_VERSION < '1.9.3' # REQUIRED - Added by SmarterBundler
|
data/README.rdoc
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
= health_check gem (
|
1
|
+
= health_check gem (pre_rails4 branch)
|
2
2
|
|
3
|
-
Simple health check of Rails
|
3
|
+
Simple health check of Rails app for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.
|
4
4
|
|
5
|
-
|
5
|
+
Use
|
6
|
+
* {pre_rails4}[https://github.com/ianheggie/health_check/tree/pre_rails4] branch or gem versions ~> 1.7 for Rails 3.*
|
7
|
+
* {master}[https://github.com/ianheggie/health_check/tree/master] branch or gem versions >= 2.0 for Rails 4.0+
|
8
|
+
* {rails2.3}[https://github.com/ianheggie/health_check/tree/rails2.3] branch or gem versions ~> 1.6.1 for Rails 2.3.*
|
6
9
|
|
7
|
-
|
8
|
-
We recommend {RAILS LTS}[https://railslts.com/] rather than the unsupported 2.3 version.
|
10
|
+
The basic goal is to quickly check that rails is up and running and that it has access to correctly configured resources (database, email gateway)
|
9
11
|
|
10
12
|
health_check provides various monitoring URIs, for example:
|
11
13
|
|
@@ -46,11 +48,9 @@ Specify full or include email in the list of checks to verify the smtp settings
|
|
46
48
|
|
47
49
|
== Installation
|
48
50
|
|
49
|
-
=== As a Gem from rubygems (if you have modified your rails to use bundler)
|
50
|
-
|
51
51
|
Add the following line to Gemfile
|
52
52
|
|
53
|
-
gem "health_check"
|
53
|
+
gem "health_check"
|
54
54
|
|
55
55
|
And then execute
|
56
56
|
|
@@ -58,24 +58,7 @@ And then execute
|
|
58
58
|
|
59
59
|
Or install it yourself as:
|
60
60
|
|
61
|
-
gem install
|
62
|
-
|
63
|
-
=== As a Gem from rubygems (Rails 2.3)
|
64
|
-
|
65
|
-
Install the gem using the following command
|
66
|
-
|
67
|
-
gem install --version '~> 1.6.3' health_check
|
68
|
-
|
69
|
-
Then add the following line to config/environment.rb within the config block
|
70
|
-
|
71
|
-
config.gem "health_check"
|
72
|
-
|
73
|
-
=== As a Plugin (Rails 2.3.x)
|
74
|
-
|
75
|
-
Run the following commands from the root of your rails application
|
76
|
-
|
77
|
-
cd vendor/plugins
|
78
|
-
git clone git://github.com/ianheggie/health_check.git
|
61
|
+
gem install health_check
|
79
62
|
|
80
63
|
== Configuration
|
81
64
|
|
@@ -174,6 +157,16 @@ Will return a result with Content-Type: application/xml and body like:
|
|
174
157
|
|
175
158
|
See https://github.com/ianheggie/health_check/wiki/Ajax-Example for an Ajax example
|
176
159
|
|
160
|
+
== Note on Patches/Pull Requests
|
161
|
+
|
162
|
+
<em>Feedback welcome! Especially with suggested replacement code and corresponding tests</em>
|
163
|
+
|
164
|
+
1. Fork it
|
165
|
+
2. Create your feature branch (<tt>git checkout -b my-new-feature</tt>)
|
166
|
+
3. Commit your changes (<tt>git commit -am 'Add some feature'</tt>)
|
167
|
+
4. Push to the branch (<tt>git push origin my-new-feature</tt>)
|
168
|
+
5. Create new Pull Request.
|
169
|
+
|
177
170
|
== Known Issues
|
178
171
|
|
179
172
|
* No inline documentation for methods
|
@@ -185,50 +178,38 @@ See https://github.com/ianheggie/health_check/wiki/Ajax-Example for an Ajax exam
|
|
185
178
|
|
186
179
|
== Testing
|
187
180
|
|
188
|
-
=== Automated testing
|
181
|
+
=== Automated testing and other checks
|
189
182
|
|
190
|
-
* {<img src="https://
|
183
|
+
* {<img src="https://badge.fury.io/rb/health_check.png" alt="Gem Version" />}[http://badge.fury.io/rb/health_check] - Latest Gem
|
184
|
+
* {<img src="https://travis-ci.org/ianheggie/health_check.png">}[https://travis-ci.org/ianheggie/health_check] - Travis CI
|
185
|
+
* {<img src="https://codeclimate.com/github/ianheggie/health_check.png" />}[https://codeclimate.com/github/ianheggie/health_check] - Code quality
|
186
|
+
* {<img src="https://gemnasium.com/ianheggie/health_check.png">}[https://gemnasium.com/ianheggie/health_check] - Gem dependencies
|
191
187
|
|
192
188
|
=== Manual testing
|
193
189
|
|
194
|
-
The
|
190
|
+
The test will package up and install the gem under a temporary path, create a dummy rails app configured for sqlite,
|
191
|
+
install the gem, and then run up tests against the server.
|
192
|
+
This will require TCP port 3456 to be free.
|
193
|
+
|
194
|
+
Using rbenv or rvm, install and set the version of ruby you wish to test against.
|
195
|
+
You will need to install the bundler gem if using rbenv.
|
196
|
+
See the <tt>.travis.yml</tt> file for the list of ruby versions that we test against.
|
195
197
|
|
196
|
-
|
198
|
+
* rbenv command: <tt>rbenv shell 1.8.7-p371</tt>
|
199
|
+
* rvm command: <tt>rvm use 1.9.3</tt>
|
197
200
|
|
198
201
|
Create a temp directory for throw away testing, and clone the health_check gem into it
|
199
202
|
|
200
203
|
mkdir -p ~/tmp
|
201
204
|
cd ~/tmp
|
202
|
-
git clone https://github.com/ianheggie/health_check.git
|
203
|
-
|
204
|
-
The Vagrantfile includes provisioning rules to install chruby (ruby version control),
|
205
|
-
ruby-build will also be installed and run to build various rubies under /opt/rubies.
|
206
|
-
|
207
|
-
Use <tt>vagrant ssh</tt> to connect to the virtual box and run tests.
|
208
|
-
|
209
|
-
The test script will package up and install the gem under a temporary path, create a dummy rails app configured for sqlite,
|
210
|
-
install the gem, and then run up tests against the server.
|
211
|
-
This will require TCP port 3456 to be free.
|
205
|
+
git clone https://github.com/ianheggie/health_check.git
|
212
206
|
|
213
207
|
Cd to the checked out health_check directory and then run the test as follows:
|
214
208
|
|
215
209
|
cd ~/tmp/health_check
|
216
210
|
|
217
|
-
vagrant up # this will also run vagrant provision and take some time
|
218
|
-
# chruby and various ruby versions will be installed
|
219
|
-
|
220
|
-
vagrant ssh
|
221
|
-
|
222
|
-
cd /vagrant # the current directory on your host is mounted here on the virtual machine
|
223
|
-
|
224
|
-
chruby 1.8.7
|
225
|
-
# or
|
226
|
-
chruby 1.9.3
|
227
|
-
|
228
211
|
test/test_with_railsapp
|
229
212
|
|
230
|
-
exit # from viretual machine when finished
|
231
|
-
|
232
213
|
The script will first call `test/setup_railsapp` to setup a rails app with health_check installed and then
|
233
214
|
run up the rails server and perform veraious tests.
|
234
215
|
|
@@ -239,7 +220,7 @@ The command `rake test` will also launch these tests, except it cannot install t
|
|
239
220
|
|
240
221
|
== Copyright
|
241
222
|
|
242
|
-
Copyright (c) 2010-
|
223
|
+
Copyright (c) 2010-2015 Ian Heggie, released under the MIT license.
|
243
224
|
See MIT-LICENSE for details.
|
244
225
|
|
245
226
|
== Contributors
|
@@ -254,5 +235,3 @@ Thanks go to the various people who have given feedback and suggestions via the
|
|
254
235
|
4. Push to the branch (`git push origin my-new-feature`)
|
255
236
|
5. Create new Pull Request (Code with BDD tests are favoured)
|
256
237
|
|
257
|
-
<em>Feedback welcome! Especially with suggested replacement code and corresponding tests!</em>
|
258
|
-
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Rails.application.routes.draw do
|
5
|
-
health_check_routes(false)
|
6
|
-
end
|
1
|
+
unless HealthCheck::Engine.routes_explicitly_defined
|
2
|
+
Rails.application.routes.draw do
|
3
|
+
add_health_check_routes()
|
7
4
|
end
|
8
5
|
end
|
data/health_check.gemspec
CHANGED
@@ -20,9 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
21
|
gem.extra_rdoc_files = [ "README.rdoc" ]
|
22
22
|
gem.require_paths = ["lib"]
|
23
|
-
gem.
|
24
|
-
gem.add_dependency(%q<rails>, ['~> 2.3.0'])
|
25
|
-
gem.add_development_dependency(%q<smarter_bundler>, [">= 0.1.0"])
|
23
|
+
gem.add_dependency(%q<rails>, ['~> 3.0'])
|
26
24
|
gem.add_development_dependency(%q<rake>, [">= 0.8.3", "< 11.0"])
|
27
25
|
gem.add_development_dependency(%q<shoulda>, ["~> 2.11.0"])
|
28
26
|
gem.add_development_dependency(%q<bundler>, ["~> 1.2"])
|
@@ -1,12 +1,14 @@
|
|
1
|
-
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
def health_check_routes(prefix = nil)
|
5
|
+
HealthCheck::Engine.routes_explicitly_defined = true
|
6
|
+
add_health_check_routes(prefix)
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_health_check_routes(prefix = nil)
|
10
|
+
get "#{prefix || 'health_check'}(/:checks)(.:format)", :to => 'health_check/health_check#index'
|
9
11
|
end
|
10
|
-
end
|
11
12
|
|
13
|
+
end
|
12
14
|
end
|
data/lib/health_check/version.rb
CHANGED
data/lib/health_check.rb
CHANGED
data/test/init_variables
CHANGED
@@ -20,8 +20,6 @@ if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
|
20
20
|
echo "Detected user installed rvm"
|
21
21
|
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
22
22
|
echo "Detected root installed rvm"
|
23
|
-
elif [[ -s /usr/local/share/chruby/chruby.sh ]] ; then
|
24
|
-
echo "Detected root installed chruby"
|
25
23
|
elif [[ -d "$HOME/.rbenv" ]] ; then
|
26
24
|
echo "Detected rbenv: `rbenv version`"
|
27
25
|
rehash='rbenv rehash'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Gemfile for health_test testing
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gem 'rails', "~> 3.0.19"
|
6
|
+
gem 'rake', '>= 0.8.3', '< 11.0' # REQUIRED
|
7
|
+
|
8
|
+
# mime-types 2.0 requires Ruby version >= 1.9.2
|
9
|
+
gem "mime-types", "< 2.0" if RUBY_VERSION < '1.9.2' # REQUIRED
|
10
|
+
# 0.7 requires ruby 1.9.3
|
11
|
+
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # REQUIRED
|
12
|
+
# rack 2.0 requires ruby 2.2.2
|
13
|
+
gem 'rack', "< 2.0" if RUBY_VERSION < '2.2.2' # REQUIRED
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
if defined?(JRUBY_VERSION)
|
17
|
+
gem 'jruby-openssl'
|
18
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
19
|
+
else
|
20
|
+
gem 'sqlite3', "~> 1.3.7"
|
21
|
+
end
|
22
|
+
gem 'shoulda', "~> 2.11.0"
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Gemfile for health_test testing
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gem 'rails', "~> 3.1.0"
|
6
|
+
gem 'rake', '>= 0.8.3', '< 11.0' # REQUIRED
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
if defined?(JRUBY_VERSION)
|
10
|
+
gem 'jruby-openssl'
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
12
|
+
else
|
13
|
+
gem 'sqlite3', "~> 1.3.7"
|
14
|
+
end
|
15
|
+
gem 'shoulda', "~> 2.11.0"
|
16
|
+
end
|
17
|
+
|
18
|
+
# mime-types 2.0 requires Ruby version >= 1.9.2
|
19
|
+
gem "mime-types", "< 2.0" if RUBY_VERSION < '1.9.2' # REQUIRED
|
20
|
+
# 0.7 requires ruby 1.9.3
|
21
|
+
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # REQUIRED
|
22
|
+
# rack 2.0 requires ruby 2.2.2
|
23
|
+
gem 'rack', "< 2.0" if RUBY_VERSION < '2.2.2' # REQUIRED
|
24
|
+
|
25
|
+
# Initial Gemfile has therubyracer commented out
|
26
|
+
gem 'therubyrhino', :platform => :jruby # REQUIRED
|
27
|
+
gem 'therubyracer', :platform => :ruby # REQUIRED
|
@@ -2,24 +2,8 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
ruby "1.8.7"
|
9
|
-
|
10
|
-
gem 'rails', '~>2.3.18'
|
11
|
-
|
12
|
-
gem 'rake', ">= 0.8.3", "< 11.0" # REQUIRED
|
13
|
-
|
14
|
-
gem 'rdoc', '~> 4.2.2'
|
15
|
-
gem 'rdoc-data'
|
16
|
-
|
17
|
-
# mime-types 2.0 requires Ruby version >= 1.9.2
|
18
|
-
gem "mime-types", "< 2.0" if RUBY_VERSION < '1.9.2' # REQUIRED
|
19
|
-
# 0.7 requires ruby 1.9.3
|
20
|
-
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # REQUIRED
|
21
|
-
# rack 2.0 requires ruby 2.2.2, rails 3.2 requires rack ~> 1.4.5
|
22
|
-
gem 'rack', "< 1.5" # REQUIRED
|
5
|
+
gem 'rails', "~> 3.2.0"
|
6
|
+
gem 'rake', '>= 0.8.3'
|
23
7
|
|
24
8
|
group :development, :test do
|
25
9
|
if defined?(JRUBY_VERSION)
|
@@ -30,3 +14,14 @@ group :development, :test do
|
|
30
14
|
end
|
31
15
|
gem 'shoulda', "~> 2.11.0"
|
32
16
|
end
|
17
|
+
|
18
|
+
# mime-types 2.0 requires Ruby version >= 1.9.2
|
19
|
+
gem "mime-types", "< 2.0" if RUBY_VERSION < '1.9.2' # REQUIRED
|
20
|
+
# 0.7 requires ruby 1.9.3
|
21
|
+
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # REQUIRED
|
22
|
+
# rack 2.0 requires ruby 2.2.2
|
23
|
+
gem 'rack', "< 2.0" if RUBY_VERSION < '2.2.2' # REQUIRED
|
24
|
+
|
25
|
+
# Initial Gemfile has therubyracer commented out
|
26
|
+
gem 'therubyrhino', :platform => :jruby # REQUIRED
|
27
|
+
gem 'therubyracer', :platform => :ruby # REQUIRED
|
data/test/setup_railsapp
CHANGED
@@ -45,7 +45,7 @@ else
|
|
45
45
|
fi
|
46
46
|
|
47
47
|
echo "Running bundle with BUNDLE_GEMFILE=$BUNDLE_GEMFILE ..."
|
48
|
-
if !
|
48
|
+
if ! bundle install ; then
|
49
49
|
echo "Test aborted (missing required gems)"
|
50
50
|
exit 2
|
51
51
|
else
|
@@ -58,8 +58,8 @@ $rehash
|
|
58
58
|
rails="$base_dir/test/bin/rails"
|
59
59
|
|
60
60
|
echo Checking $rails is present ...
|
61
|
-
[ -f $rails ] || bundle binstub railties || echo '(ignored bundle exit status)'
|
62
|
-
[ -f $rails ] || bundle binstub rails || echo '(ignored bundle exit status)'
|
61
|
+
[ -f $rails ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub railties || echo '(ignored bundle exit status)'
|
62
|
+
[ -f $rails ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub rails || echo '(ignored bundle exit status)'
|
63
63
|
if [ ! -f $rails ]; then
|
64
64
|
echo "Test aborted (unable to create $rails)"
|
65
65
|
exit 2
|
@@ -68,7 +68,7 @@ fi
|
|
68
68
|
rake="$base_dir/test/bin/rake"
|
69
69
|
|
70
70
|
echo Checking $rake is present ...
|
71
|
-
[ -f $rake ] || bundle binstub rake || echo '(ignored bundle exit status)'
|
71
|
+
[ -f $rake ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub rake || echo '(ignored bundle exit status)'
|
72
72
|
if [ ! -f $rake ]; then
|
73
73
|
echo "Test aborted (unable to create $rake)"
|
74
74
|
exit 2
|
@@ -84,7 +84,7 @@ echo Set GEM_PATH=$GEM_PATH
|
|
84
84
|
case "$BUNDLE_GEMFILE" in
|
85
85
|
*_lts*)
|
86
86
|
echo "Re-running bundle with changed GEM_PATH (required by git install of rails lts) ..."
|
87
|
-
if !
|
87
|
+
if ! bundle install ; then
|
88
88
|
echo "Test aborted (missing required gems)"
|
89
89
|
exit 2
|
90
90
|
else
|
@@ -125,23 +125,13 @@ case `ruby -e 'puts JRUBY_VERSION' 2> /dev/null` in
|
|
125
125
|
esac
|
126
126
|
|
127
127
|
echo "Creating $actual_rails_version app in $tmp_dir/railsapp using adapter $db"
|
128
|
-
case "$
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
$rails new railsapp -d $db --edge
|
136
|
-
;;
|
137
|
-
*)
|
138
|
-
$rails new railsapp -d $db
|
139
|
-
;;
|
140
|
-
esac
|
141
|
-
;;
|
142
|
-
*)
|
143
|
-
echo "Unknown rails version"
|
144
|
-
;;
|
128
|
+
case "$BUNDLE_GEMFILE" in
|
129
|
+
*rails_edge.gemfile)
|
130
|
+
$rails new railsapp -d $db --edge
|
131
|
+
;;
|
132
|
+
*)
|
133
|
+
$rails new railsapp -d $db
|
134
|
+
;;
|
145
135
|
esac
|
146
136
|
|
147
137
|
cd $railsapp
|
@@ -201,14 +191,14 @@ then
|
|
201
191
|
cat Gemfile
|
202
192
|
echo
|
203
193
|
echo running bundle install
|
204
|
-
|
194
|
+
bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} install
|
205
195
|
$rehash
|
206
196
|
echo "Using binstubs in $railsapp/bin for rails and rake commands"
|
207
197
|
rails="$railsapp/bin/rails"
|
208
198
|
|
209
199
|
echo Checking $rails is present ...
|
210
|
-
[ -f $rails ] || bundle binstub railties || echo '(ignored bundle exit status)'
|
211
|
-
[ -f $rails ] || bundle binstub rails || echo '(ignored bundle exit status)'
|
200
|
+
[ -f $rails ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub railties || echo '(ignored bundle exit status)'
|
201
|
+
[ -f $rails ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub rails || echo '(ignored bundle exit status)'
|
212
202
|
if [ ! -f $rails ]; then
|
213
203
|
echo "Test aborted (unable to create $rails)"
|
214
204
|
exit 2
|
@@ -217,7 +207,7 @@ then
|
|
217
207
|
rake="$railsapp/bin/rake"
|
218
208
|
|
219
209
|
echo Checking $rake is present ...
|
220
|
-
[ -f $rake ] || bundle binstub rake || echo '(ignored bundle exit status)'
|
210
|
+
[ -f $rake ] || bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} binstub rake || echo '(ignored bundle exit status)'
|
221
211
|
if [ ! -f $rake ]; then
|
222
212
|
echo "Test aborted (unable to create $rake)"
|
223
213
|
exit 2
|
@@ -365,7 +355,6 @@ EOF
|
|
365
355
|
|
366
356
|
if [ -s config/routes.rb ]; then
|
367
357
|
mv -f config/routes.rb config/routes.rb-old
|
368
|
-
var=`ruby -n -e 'print $1 if /^[^#]+ do \|([^\|]+)\|/' config/routes.rb-old`
|
369
358
|
(
|
370
359
|
ruby -n -e 'print if not /^end/..9999' config/routes.rb-old | tee /tmp/t$$
|
371
360
|
if [ ! -s /tmp/t$$ ]; then
|
@@ -373,15 +362,14 @@ if [ -s config/routes.rb ]; then
|
|
373
362
|
sed -e '/^end/,$d' config/routes.rb-old
|
374
363
|
fi
|
375
364
|
|
376
|
-
# rails
|
365
|
+
# rails 3.0+
|
377
366
|
echo " # -----------------------------------------"
|
378
367
|
echo " # START OF SECTION FOR TESTING HEALTH_CHECK"
|
379
|
-
echo "
|
380
|
-
echo " ${var}.connect 'example(/:action(/:id))(.:format)', :controller => 'example'"
|
368
|
+
echo " get 'example(/:action(/:id))(.:format)' => 'example'"
|
381
369
|
echo " if File.exists?('$catchall_file')"
|
382
|
-
echo "
|
370
|
+
echo " health_check_routes"
|
383
371
|
echo " # CATCH ALL ROUTE"
|
384
|
-
echo "
|
372
|
+
echo " get '*path', :to => 'example#catchall'"
|
385
373
|
echo " end"
|
386
374
|
echo " # END OF SECTION FOR TESTING HEALTH_CHECK"
|
387
375
|
echo " # ---------------------------------------"
|
data/test/test_with_railsapp
CHANGED
metadata
CHANGED
@@ -1,119 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: health_check
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 6
|
9
|
-
- 3
|
10
|
-
version: 1.6.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ian Heggie
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rails
|
23
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: 2.3.0
|
34
|
-
prerelease: false
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
35
22
|
type: :runtime
|
36
|
-
requirement: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: smarter_bundler
|
39
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 27
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 1
|
48
|
-
- 0
|
49
|
-
version: 0.1.0
|
50
23
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
54
31
|
name: rake
|
55
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
56
33
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 57
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 8
|
64
|
-
- 3
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
65
37
|
version: 0.8.3
|
66
38
|
- - <
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
segments:
|
70
|
-
- 11
|
71
|
-
- 0
|
72
|
-
version: "11.0"
|
73
|
-
prerelease: false
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '11.0'
|
74
41
|
type: :development
|
75
|
-
|
76
|
-
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.8.3
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '11.0'
|
52
|
+
- !ruby/object:Gem::Dependency
|
77
53
|
name: shoulda
|
78
|
-
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
79
55
|
none: false
|
80
|
-
requirements:
|
56
|
+
requirements:
|
81
57
|
- - ~>
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
hash: 35
|
84
|
-
segments:
|
85
|
-
- 2
|
86
|
-
- 11
|
87
|
-
- 0
|
58
|
+
- !ruby/object:Gem::Version
|
88
59
|
version: 2.11.0
|
89
|
-
prerelease: false
|
90
60
|
type: :development
|
91
|
-
|
92
|
-
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.11.0
|
68
|
+
- !ruby/object:Gem::Dependency
|
93
69
|
name: bundler
|
94
|
-
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
95
71
|
none: false
|
96
|
-
requirements:
|
72
|
+
requirements:
|
97
73
|
- - ~>
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
segments:
|
101
|
-
- 1
|
102
|
-
- 2
|
103
|
-
version: "1.2"
|
104
|
-
prerelease: false
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
105
76
|
type: :development
|
106
|
-
|
107
|
-
|
108
|
-
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ~>
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.2'
|
84
|
+
description: ! " \tSimple health check of Rails app for uptime monitoring with Pingdom,
|
85
|
+
NewRelic, EngineYard or uptime.openacs.org etc.\n"
|
86
|
+
email:
|
109
87
|
- ian@heggie.biz
|
110
88
|
executables: []
|
111
|
-
|
112
89
|
extensions: []
|
113
|
-
|
114
|
-
extra_rdoc_files:
|
90
|
+
extra_rdoc_files:
|
115
91
|
- README.rdoc
|
116
|
-
files:
|
92
|
+
files:
|
117
93
|
- .document
|
118
94
|
- .gitignore
|
119
95
|
- .travis.yml
|
@@ -123,7 +99,6 @@ files:
|
|
123
99
|
- README.rdoc
|
124
100
|
- Rakefile
|
125
101
|
- VERSION
|
126
|
-
- Vagrantfile
|
127
102
|
- config/routes.rb
|
128
103
|
- health_check.gemspec
|
129
104
|
- init.rb
|
@@ -140,52 +115,41 @@ files:
|
|
140
115
|
- test/migrate/twelve/011_create_roles.roles.rb
|
141
116
|
- test/migrate/twelve/012_create_users.rb
|
142
117
|
- test/migrate/twelve/9_create_countries.rb
|
143
|
-
- test/
|
144
|
-
- test/
|
145
|
-
- test/
|
118
|
+
- test/rails_3.0.gemfile
|
119
|
+
- test/rails_3.1.gemfile
|
120
|
+
- test/rails_3.2.gemfile
|
146
121
|
- test/setup_railsapp
|
147
122
|
- test/test_helper.rb
|
148
123
|
- test/test_with_railsapp
|
149
124
|
- test/testurl
|
150
125
|
- test/unit/health_check_controller_test.rb
|
151
126
|
- test/unit/routes_test.rb
|
152
|
-
has_rdoc: true
|
153
127
|
homepage: https://github.com/ianheggie/health_check
|
154
128
|
licenses: []
|
155
|
-
|
156
129
|
post_install_message:
|
157
130
|
rdoc_options: []
|
158
|
-
|
159
|
-
require_paths:
|
131
|
+
require_paths:
|
160
132
|
- lib
|
161
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
134
|
none: false
|
163
|
-
requirements:
|
164
|
-
- -
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
|
168
|
-
- 1
|
169
|
-
- 8
|
170
|
-
- 7
|
171
|
-
version: 1.8.7
|
172
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
140
|
none: false
|
174
|
-
requirements:
|
175
|
-
- -
|
176
|
-
- !ruby/object:Gem::Version
|
177
|
-
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
version: "0"
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
181
145
|
requirements: []
|
182
|
-
|
183
146
|
rubyforge_project:
|
184
|
-
rubygems_version: 1.
|
147
|
+
rubygems_version: 1.8.23.2
|
185
148
|
signing_key:
|
186
149
|
specification_version: 3
|
187
|
-
summary: Simple health check of Rails app for uptime monitoring with Pingdom, NewRelic,
|
188
|
-
|
150
|
+
summary: Simple health check of Rails app for uptime monitoring with Pingdom, NewRelic,
|
151
|
+
EngineYard or uptime.openacs.org etc.
|
152
|
+
test_files:
|
189
153
|
- test/fake_smtp_server
|
190
154
|
- test/init_variables
|
191
155
|
- test/migrate/empty/do_not_remove.txt
|
@@ -193,9 +157,9 @@ test_files:
|
|
193
157
|
- test/migrate/twelve/011_create_roles.roles.rb
|
194
158
|
- test/migrate/twelve/012_create_users.rb
|
195
159
|
- test/migrate/twelve/9_create_countries.rb
|
196
|
-
- test/
|
197
|
-
- test/
|
198
|
-
- test/
|
160
|
+
- test/rails_3.0.gemfile
|
161
|
+
- test/rails_3.1.gemfile
|
162
|
+
- test/rails_3.2.gemfile
|
199
163
|
- test/setup_railsapp
|
200
164
|
- test/test_helper.rb
|
201
165
|
- test/test_with_railsapp
|
data/Vagrantfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
Vagrant.configure("2") do |config|
|
5
|
-
# For a complete reference, please see the online documentation at
|
6
|
-
# https://docs.vagrantup.com.
|
7
|
-
|
8
|
-
config.vm.box = "ubuntu/xenial64"
|
9
|
-
|
10
|
-
# set auto_update to false, if you do NOT want to check the correct
|
11
|
-
# additions version when booting this machine
|
12
|
-
config.vbguest.auto_update = false
|
13
|
-
|
14
|
-
# do NOT download the iso file from a webserver
|
15
|
-
config.vbguest.no_remote = true
|
16
|
-
|
17
|
-
# provision with a shell script.
|
18
|
-
config.vm.provision "shell", path: "./test/provision_vagrant"
|
19
|
-
|
20
|
-
end
|
data/test/provision_vagrant
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
case `id` in
|
4
|
-
*root*)
|
5
|
-
;;
|
6
|
-
*)
|
7
|
-
exec echo Must be run as root
|
8
|
-
;;
|
9
|
-
esac
|
10
|
-
|
11
|
-
chruby_version=0.3.9
|
12
|
-
chruby=chruby-${chruby_version}
|
13
|
-
|
14
|
-
set -xe
|
15
|
-
id
|
16
|
-
pwd
|
17
|
-
export DEBIAN_FRONTEND=noninteractive
|
18
|
-
find /tmp/got-apt-update -mtime -1 || ( apt-get update && touch /tmp/got-apt-update )
|
19
|
-
apt install --yes --force-yes -q ruby ruby-dev sqlite3 libsqlite3-dev nodejs subversion git git-core
|
20
|
-
# https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
21
|
-
# using default gcc-5 since xenial doesn't have gcc-6
|
22
|
-
apt install --yes --force-yes -q gcc-5 autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
|
23
|
-
|
24
|
-
# The following is not required for testing, install if you are doing manual tests with extra gems
|
25
|
-
# apt install --yes --force-yes -q mysql-client mysql-server libmysqlclient-dev
|
26
|
-
# apt install --yes --force-yes -q libcurl4-openssl-dev libncurses5-dev libxml2-dev libxslt1-dev
|
27
|
-
(
|
28
|
-
echo Install chruby
|
29
|
-
[ -s ${chruby}.tar.gz ] || wget -q -O ${chruby}.tar.gz https://github.com/postmodern/chruby/archive/v${chruby_version}.tar.gz
|
30
|
-
[ -d ${chruby} ] || tar -xzf ${chruby}.tar.gz
|
31
|
-
cd ${chruby}/
|
32
|
-
./scripts/setup.sh
|
33
|
-
cat > /etc/profile.d/chruby.sh <<'EOF'
|
34
|
-
if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
|
35
|
-
source /usr/local/share/chruby/chruby.sh
|
36
|
-
#source /usr/local/share/chruby/auto
|
37
|
-
fi
|
38
|
-
EOF
|
39
|
-
chmod a+r /etc/profile.d/chruby.sh
|
40
|
-
)
|
41
|
-
|
42
|
-
(
|
43
|
-
[ -d ruby-build ] || git clone https://github.com/rbenv/ruby-build.git
|
44
|
-
which ruby-build || PREFIX=/usr/local ./ruby-build/install.sh
|
45
|
-
|
46
|
-
mkdir -p /opt/rubies
|
47
|
-
v=1.8.7-p375
|
48
|
-
[ -x /opt/rubies/${v}/bin/bundle ] || ( ruby-build ${v} /opt/rubies/${v} && /opt/rubies/${v}/bin/gem update --system 1.8.25 && /opt/rubies/${v}/bin/gem install bundler )
|
49
|
-
|
50
|
-
v=1.9.3-p551
|
51
|
-
[ -x /opt/rubies/${v}/bin/bundle ] || ( ruby-build ${v} /opt/rubies/${v} && /opt/rubies/${v}/bin/gem install bundler )
|
52
|
-
|
53
|
-
#for v in 2.2.0
|
54
|
-
#do
|
55
|
-
# [ -x /opt/rubies/${v}/bin/bundle ] || ( ruby-build ${v} /opt/rubies/${v} && /opt/rubies/${v}/bin/gem install bundler )
|
56
|
-
#done
|
57
|
-
)
|
58
|
-
|
59
|
-
echo Setup system ruby
|
60
|
-
which bundle || gem install bundler
|
61
|
-
bundle --version
|
62
|
-
set +x
|
63
|
-
cat <<EOF
|
64
|
-
|
65
|
-
Now test by running the following commands:
|
66
|
-
|
67
|
-
vagrant ssh
|
68
|
-
cd /vagrant
|
69
|
-
|
70
|
-
chruby RUBY_VERSION
|
71
|
-
or
|
72
|
-
chruby system # for system version 2.3.1
|
73
|
-
|
74
|
-
./test/test_with_railsapp
|
75
|
-
|
76
|
-
exit
|
77
|
-
|
78
|
-
EOF
|
79
|
-
exit
|
data/test/rails_2.3_lts.gemfile
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# Gemfile for health_test testing
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
# Last rubygems version before 2.0.0 (which breaks rails 2.3)
|
6
|
-
#rubygems 1.8.25
|
7
|
-
|
8
|
-
ruby "1.8.7"
|
9
|
-
|
10
|
-
git 'https://github.com/makandra/rails.git', :branch => '2-3-lts' do
|
11
|
-
gem 'rails', '~>2.3.18'
|
12
|
-
gem 'actionmailer', :require => false
|
13
|
-
gem 'actionpack', :require => false
|
14
|
-
gem 'activerecord', :require => false
|
15
|
-
gem 'activeresource', :require => false
|
16
|
-
gem 'activesupport', :require => false
|
17
|
-
gem 'railties', :require => false
|
18
|
-
gem 'railslts-version', :require => false
|
19
|
-
end
|
20
|
-
|
21
|
-
gem 'rake', ">= 0.8.3", "< 11.0" # REQUIRED
|
22
|
-
|
23
|
-
gem 'rdoc', '~> 4.2.2'
|
24
|
-
gem 'rdoc-data'
|
25
|
-
|
26
|
-
# mime-types 2.0 requires Ruby version >= 1.9.2
|
27
|
-
gem "mime-types", "< 2.0" if RUBY_VERSION < '1.9.2' # REQUIRED
|
28
|
-
# 0.7 requires ruby 1.9.3
|
29
|
-
gem 'i18n', '< 0.7' if RUBY_VERSION < '1.9.3' # REQUIRED
|
30
|
-
# rack 2.0 requires ruby 2.2.2, rails 3.2 requires rack ~> 1.4.5
|
31
|
-
gem 'rack', "< 1.5" # REQUIRED
|
32
|
-
|
33
|
-
group :development, :test do
|
34
|
-
if defined?(JRUBY_VERSION)
|
35
|
-
gem 'jruby-openssl'
|
36
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
37
|
-
else
|
38
|
-
gem 'sqlite3', "~> 1.3.7"
|
39
|
-
end
|
40
|
-
gem 'shoulda', "~> 2.11.0"
|
41
|
-
end
|