health_check 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,6 +15,7 @@ before_install:
15
15
  - gem update --system $RUBYGEMS_VERSION
16
16
  - gem --version
17
17
  - gem install bundler ${BUNDLER_VERSION:+-v} ${BUNDLER_VERSION}
18
+ - gem install smarter_bundler
18
19
  - bundle --version
19
20
  - mkdir -p tmp/bundle
20
21
 
@@ -25,29 +26,10 @@ script: ./test/test_with_railsapp
25
26
  matrix:
26
27
  fast_finish: true
27
28
 
28
- allow_failures:
29
- - rvm: 2.3.1
30
- gemfile: test/rails_edge.gemfile
31
- env: RAILS_VERSION=edge MIDDLEWARE=YES
32
-
33
- - rvm: ruby-head
34
- gemfile: test/rails_5.0.gemfile
35
- env: RAILS_VERSION=5.0 MIDDLEWARE=YES
36
-
37
29
  include:
38
30
  # -------------------------------------
39
31
  # Standard
40
32
 
41
- # ruby 5.0 Jun. 2016
42
-
43
- - rvm: 2.3.1
44
- gemfile: test/rails_5.0.gemfile
45
- env: RAILS_VERSION=5.0 MIDDLEWARE=no
46
-
47
- - rvm: 2.2.2
48
- gemfile: test/rails_5.0.gemfile
49
- env: RAILS_VERSION=5.0 MIDDLEWARE=no
50
-
51
33
  # rails 4.2 Dec, 2014
52
34
 
53
35
  - rvm: 2.2.0
@@ -98,26 +80,6 @@ matrix:
98
80
  # -------------------------------------
99
81
  # INSTALLED AS MIDDLEWARE
100
82
 
101
- # ruby / rails edge
102
-
103
- - rvm: 2.3.1
104
- gemfile: test/rails_edge.gemfile
105
- env: RAILS_VERSION=edge MIDDLEWARE=YES
106
-
107
- # ruby 5.0 Jun. 2016
108
-
109
- - rvm: 2.3.1
110
- gemfile: test/rails_5.0.gemfile
111
- env: RAILS_VERSION=5.0 MIDDLEWARE=YES
112
-
113
- - rvm: 2.2.2
114
- gemfile: test/rails_5.0.gemfile
115
- env: RAILS_VERSION=5.0 MIDDLEWARE=YES
116
-
117
- - rvm: ruby-head
118
- gemfile: test/rails_5.0.gemfile
119
- env: RAILS_VERSION=5.0 MIDDLEWARE=YES
120
-
121
83
  # rails 4.2 Dec, 2014
122
84
 
123
85
  - rvm: 2.2.0
data/CHANGELOG CHANGED
@@ -1,5 +1,12 @@
1
1
  = Change Log =
2
2
 
3
+ * 2.8.0
4
+ * First release on renamed rails4 branch
5
+ * redis_url now defaults to nil (url determined by redis gem)
6
+ * Depends on railties rather than rails so it can be used with trimmed down stacks
7
+ * Cleaned up README, made install instructions version specific
8
+ * Cleaned up test code, uses smarter_bundler to handle gem ruby version isssues
9
+
3
10
  * 2.7.0
4
11
  * Add ability to check health of redis when url is non-standard redis url
5
12
  * 2.6.0
data/Gemfile CHANGED
@@ -18,3 +18,6 @@ group :development, :test do
18
18
  gem 'mime-types', defined?(JRUBY_VERSION) || RUBY_VERSION < '2.0' ? '< 3' : '>= 3.0'
19
19
 
20
20
  end
21
+
22
+ gem 'rake', '< 12.3.0' if RUBY_VERSION < '2.0' # REQUIRED
23
+ gem 'nokogiri', [">=0", "< 1.7.0"] if RUBY_VERSION < '2.0' # REQUIRED
@@ -1,14 +1,11 @@
1
- = health_check gem
1
+ = health_check gem (rails4)
2
2
 
3
- Simple health check of Rails 4.x+ apps for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.
4
-
5
- Use
6
- * {master}[https://github.com/ianheggie/health_check/tree/master] branch or gem versions ~> 2.0 for Rails 4.x and 5.x;
7
- * {pre_rails4}[https://github.com/ianheggie/health_check/tree/pre_rails4] branch or gem versions ~> 1.7 for Rails 3.x;
8
- * {rails2.3}[https://github.com/ianheggie/health_check/tree/rails2.3] branch or gem versions ~> 1.6.1 for Rails 2.3;
3
+ Simple health check of Rails 4.x apps for use with Pingdom, NewRelic, EngineYard or uptime.openacs.org etc.
9
4
 
10
5
  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)
11
6
 
7
+ Check the latest README {master}[https://github.com/ianheggie/health_check/tree/master] for other versions
8
+
12
9
  health_check provides various monitoring URIs, for example:
13
10
 
14
11
  curl localhost:3000/health_check
@@ -54,13 +51,13 @@ The email gateway is not checked unless the smtp settings have been changed.
54
51
  Specify full or include email in the list of checks to verify the smtp settings
55
52
  (eg use 127.0.0.1 instead of localhost).
56
53
 
57
- Note: rails 4.0 also checks migrations by default in development mode and throws an ActiveRecord::PendingMigrationError exception (http error 500) if there is an error
54
+ Note: rails also checks migrations by default in development mode and throws an ActiveRecord::PendingMigrationError exception (http error 500) if there is an error
58
55
 
59
56
  == Installation
60
57
 
61
58
  Add the following line to Gemfile
62
59
 
63
- gem "health_check"
60
+ gem "health_check", "~> 2.8"
64
61
 
65
62
  And then execute
66
63
 
@@ -68,7 +65,7 @@ And then execute
68
65
 
69
66
  Or install it yourself as:
70
67
 
71
- gem install health_check
68
+ gem install --version '~> 2.8' health_check
72
69
 
73
70
  == Configuration
74
71
 
@@ -237,16 +234,6 @@ Cache-control is set with
237
234
 
238
235
  Last-modified is set to the current time (rounded down to a multiple of max_age when max_age > 1)
239
236
 
240
- == Note on Patches/Pull Requests
241
-
242
- <em>Feedback welcome! Especially with suggested replacement code and corresponding tests</em>
243
-
244
- 1. Fork it
245
- 2. Create your feature branch (<tt>git checkout -b my-new-feature</tt>)
246
- 3. Commit your changes (<tt>git commit -am 'Add some feature'</tt>)
247
- 4. Push to the branch (<tt>git push origin my-new-feature</tt>)
248
- 5. Create new Pull Request.
249
-
250
237
  == Known Issues
251
238
 
252
239
  * No inline documentation for methods
@@ -260,36 +247,46 @@ Last-modified is set to the current time (rounded down to a multiple of max_age
260
247
 
261
248
  === Automated testing and other checks
262
249
 
263
- * {<img src="https://badge.fury.io/rb/health_check.png" alt="Gem Version" />}[http://badge.fury.io/rb/health_check] - Latest Gem
264
- * {<img src="https://travis-ci.org/ianheggie/health_check.png">}[https://travis-ci.org/ianheggie/health_check] - Travis CI
265
- * {<img src="https://codeclimate.com/github/ianheggie/health_check.png" />}[https://codeclimate.com/github/ianheggie/health_check] - Code quality
266
- * {<img src="https://gemnasium.com/ianheggie/health_check.png">}[https://gemnasium.com/ianheggie/health_check] - Gem dependencies
250
+ * {<img src="https://travis-ci.org/ianheggie/health_check.svg?branch=rails4">}[https://travis-ci.org/ianheggie/health_check.svg?branch=rails4] - Travis CI
267
251
 
268
252
  === Manual testing
269
253
 
270
- The test will package up and install the gem under a temporary path, create a dummy rails app configured for sqlite,
271
- install the gem, and then run up tests against the server.
272
- This will require TCP port 3456 to be free.
254
+ The instructions have been changed to using a vagrant virtual box for consistant results.
273
255
 
274
- Using rbenv or rvm, install and set the version of ruby you wish to test against.
275
- You will need to install the bundler gem if using rbenv.
276
- See the <tt>.travis.yml</tt> file for the list of ruby versions that we test against.
277
-
278
- * rbenv command: <tt>rbenv shell 1.8.7-p371</tt>
279
- * rvm command: <tt>rvm use 1.9.3</tt>
256
+ Install vagrant 1.9.7 or later and virtual_box or other local virtual machine providor.
280
257
 
281
258
  Create a temp directory for throw away testing, and clone the health_check gem into it
282
259
 
283
260
  mkdir -p ~/tmp
284
261
  cd ~/tmp
285
- git clone https://github.com/ianheggie/health_check.git
262
+ git clone https://github.com/ianheggie/health_check.git ~/tmp/health_check
263
+
264
+ The Vagrantfile includes provisioning rules to install chruby (ruby version control),
265
+ ruby-build will also be installed and run to build various rubies under /opt/rubies.
266
+
267
+ Use <tt>vagrant ssh</tt> to connect to the virtual box and run tests.
268
+
269
+ The test script will package up and install the gem under a temporary path, create a dummy rails app configured for sqlite,
270
+ install the gem, and then run up tests against the server.
271
+ This will require TCP port 3456 to be free.
286
272
 
287
273
  Cd to the checked out health_check directory and then run the test as follows:
288
274
 
289
275
  cd ~/tmp/health_check
290
276
 
277
+ vagrant up # this will also run vagrant provision and take some time
278
+ # chruby and various ruby versions will be installed
279
+
280
+ vagrant ssh
281
+
282
+ cd /vagrant # the current directory on your host is mounted here on the virtual machine
283
+
284
+ chruby 2.2.2 # or some other ruby version
285
+
291
286
  test/test_with_railsapp
292
287
 
288
+ exit # from viretual machine when finished
289
+
293
290
  The script will first call `test/setup_railsapp` to setup a rails app with health_check installed and then
294
291
  run up the rails server and perform veraious tests.
295
292
 
@@ -300,7 +297,7 @@ The command `rake test` will also launch these tests, except it cannot install t
300
297
 
301
298
  == Copyright
302
299
 
303
- Copyright (c) 2010-2016 Ian Heggie, released under the MIT license.
300
+ Copyright (c) 2010-2017 Ian Heggie, released under the MIT license.
304
301
  See MIT-LICENSE for details.
305
302
 
306
303
  == Contributors
@@ -314,3 +311,5 @@ Thanks go to the various people who have given feedback and suggestions via the
314
311
  3. Commit your changes (`git commit -am 'Add some feature'`)
315
312
  4. Push to the branch (`git push origin my-new-feature`)
316
313
  5. Create new Pull Request (Code with BDD tests are favoured)
314
+
315
+ <em>Feedback welcome! Especially with suggested replacement code and corresponding tests</em>
@@ -0,0 +1,20 @@
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
@@ -21,7 +21,8 @@ Gem::Specification.new do |gem|
21
21
  gem.extra_rdoc_files = [ "README.rdoc" ]
22
22
  gem.require_paths = ["lib"]
23
23
  gem.required_ruby_version = '>= 1.9.3'
24
- gem.add_dependency(%q<rails>, [">= 4.0"])
24
+ gem.add_dependency(%q<railties>, ["~> 4.0"])
25
+ gem.add_development_dependency(%q<smarter_bundler>, [">= 0.1.0"])
25
26
  gem.add_development_dependency(%q<rake>, [">= 0.8.3"])
26
27
  gem.add_development_dependency(%q<shoulda>, ["~> 2.11.0"])
27
28
  gem.add_development_dependency(%q<bundler>, ["~> 1.2"])
@@ -65,7 +65,7 @@ module HealthCheck
65
65
 
66
66
  # Allow non-standard redis url
67
67
  mattr_accessor :redis_url
68
- self.redis_url = 'redis://localhost:6379/0'
68
+ self.redis_url = nil
69
69
 
70
70
  def self.add_custom_check(name = 'custom', &block)
71
71
  custom_checks[name] ||= [ ]
@@ -1,3 +1,3 @@
1
1
  module HealthCheck
2
- VERSION = "2.7.0"
2
+ VERSION = "2.8.0"
3
3
  end
@@ -0,0 +1,61 @@
1
+ #!/bin/bash
2
+
3
+ case `id` in
4
+ *root*)
5
+ ;;
6
+ *)
7
+ exec echo Must be run as root
8
+ ;;
9
+ esac
10
+ set -xe
11
+ id
12
+ pwd
13
+ export DEBIAN_FRONTEND=noninteractive
14
+ find /tmp/got-apt-update -mtime -1 || ( apt-get update && touch /tmp/got-apt-update )
15
+ apt install --yes --force-yes -q build-essential ruby ruby-dev sqlite3 libsqlite3-dev nodejs
16
+
17
+ (
18
+ echo Install chruby
19
+ [ -s chruby-0.3.9.tar.gz ] || wget -q -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
20
+ [ chruby-0.3.9 ] || tar -xzf chruby-0.3.9.tar.gz
21
+ cd chruby-0.3.9/
22
+ ./scripts/setup.sh
23
+ cat > /etc/profile.d/chruby.sh <<'EOF'
24
+ if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
25
+ source /usr/local/share/chruby/chruby.sh
26
+ fi
27
+ EOF
28
+ chmod a+r /etc/profile.d/chruby.sh
29
+ )
30
+
31
+ (
32
+ [ -d ruby-build ] || git clone https://github.com/rbenv/ruby-build.git
33
+ which ruby-build || PREFIX=/usr/local ./ruby-build/install.sh
34
+
35
+ mkdir -p /opt/rubies
36
+ [ -x /opt/rubies/1.9.3-p551/bin/bundle ] || ( ruby-build 1.9.3-p551 /opt/rubies/1.9.3-p551 && /opt/rubies/1.9.3-p551/bin/gem install bundler )
37
+
38
+ for v in 2.2.0
39
+ do
40
+ [ -x /opt/rubies/$v/bin/bundle ] || ( ruby-build $v /opt/rubies/$v && /opt/rubies/$v/bin/gem install bundler )
41
+ done
42
+ )
43
+
44
+ echo Setup system ruby
45
+ which bundle || gem install bundler
46
+ bundle --version
47
+ set +x
48
+ cat <<EOF
49
+
50
+ Now test by running the following commands:
51
+
52
+ chruby RUBY_VERSION
53
+ or
54
+ chruby system # for system version 2.3.1
55
+
56
+ vagrant ssh
57
+ cd /vagrant
58
+ ./test/test_with_railsapp
59
+
60
+ EOF
61
+ exit
@@ -5,8 +5,8 @@ source 'https://rubygems.org'
5
5
  ruby RUBY_VERSION < '1.9.3' ? '1.9.3' : RUBY_VERSION
6
6
 
7
7
  gem 'rails', "~> 4.0.0"
8
- gem 'rake', '>= 0.8.3'
9
- gem "rack", '~> 1.5.2'
8
+ gem 'rake', '>= 0.8.3' # REQUIRED
9
+ gem "rack", '~> 1.5.2' # REQUIRED
10
10
 
11
11
  group :development, :test do
12
12
  if defined?(JRUBY_VERSION)
@@ -18,8 +18,8 @@ group :development, :test do
18
18
  gem 'shoulda'
19
19
 
20
20
  # redis based checks
21
- gem 'sidekiq', :require => !ENV['SIDEKIQ'].nil?
22
- gem 'redis', :require => !ENV['REDIS_URL'].nil?
21
+ gem 'sidekiq', '< 5.0.4',:require => !ENV['SIDEKIQ'].nil?
22
+ gem 'redis', '< 4.0', :require => !ENV['REDIS_URL'].nil?
23
23
  gem 'resque', :require => !ENV['RESQUE'].nil?
24
24
  # s3 check
25
25
  gem 'aws-sdk', :require => !ENV['AWS_ACCESS_KEY_ID'].nil?
@@ -31,3 +31,6 @@ gem 'therubyracer', :platform => :ruby # REQUIRED
31
31
  # mime-types 2.0 requires Ruby version >= 1.9.2
32
32
  # mime-types 3.0 requires Ruby version >= 2.0
33
33
  gem 'mime-types', defined?(JRUBY_VERSION) || RUBY_VERSION < '2.0' ? '< 3' : '>= 3.0' # REQUIRED
34
+
35
+
36
+ gem 'turbolinks', :github => 'turbolinks/turbolinks-classic' # REQUIRED instead of turbolinks
@@ -5,8 +5,8 @@ source 'https://rubygems.org'
5
5
  ruby RUBY_VERSION < '1.9.3' ? '1.9.3' : RUBY_VERSION
6
6
 
7
7
  gem 'rails', "~> 4.1.0"
8
- gem 'rake', '>= 0.8.3'
9
- gem "rack", '~> 1.5.2'
8
+ gem 'rake', '>= 0.8.3' # REQUIRED
9
+ gem "rack", '~> 1.5.2' # REQUIRED
10
10
 
11
11
  group :development, :test do
12
12
  if defined?(JRUBY_VERSION)
@@ -18,8 +18,8 @@ group :development, :test do
18
18
  gem 'shoulda'
19
19
 
20
20
  # redis based checks
21
- gem 'sidekiq', :require => !ENV['SIDEKIQ'].nil?
22
- gem 'redis', :require => !ENV['REDIS_URL'].nil?
21
+ gem 'sidekiq', '< 5.0.4', :require => !ENV['SIDEKIQ'].nil?
22
+ gem 'redis', '< 4.0', :require => !ENV['REDIS_URL'].nil?
23
23
  gem 'resque', :require => !ENV['RESQUE'].nil?
24
24
  # s3 check
25
25
  gem 'aws-sdk', :require => !ENV['AWS_ACCESS_KEY_ID'].nil?
@@ -5,9 +5,11 @@ source 'https://rubygems.org'
5
5
  ruby RUBY_VERSION < '1.9.3' ? '1.9.3' : RUBY_VERSION
6
6
 
7
7
  gem 'rails', "~> 4.2.0"
8
- gem 'rake', '>= 0.8.3'
8
+ gem 'rake', '>= 0.8.3' # REQUIRED
9
9
  #gem "rack", '~> 1.6.0'
10
10
 
11
+ gem 'sass', '<3.5.0'
12
+
11
13
  group :development, :test do
12
14
  if defined?(JRUBY_VERSION)
13
15
  gem 'jruby-openssl'
@@ -18,8 +20,8 @@ group :development, :test do
18
20
  gem 'shoulda'
19
21
 
20
22
  # redis based checks
21
- gem 'sidekiq', :require => !ENV['SIDEKIQ'].nil?
22
- gem 'redis', :require => !ENV['REDIS_URL'].nil?
23
+ gem 'sidekiq', '< 5.0.4', :require => !ENV['SIDEKIQ'].nil?
24
+ gem 'redis', '< 4.0', :require => !ENV['REDIS_URL'].nil?
23
25
  gem 'resque', :require => !ENV['RESQUE'].nil?
24
26
  # s3 check
25
27
  gem 'aws-sdk', :require => !ENV['AWS_ACCESS_KEY_ID'].nil?
@@ -59,7 +59,7 @@ else
59
59
  fi
60
60
 
61
61
  echo "Running bundle with BUNDLE_GEMFILE=$BUNDLE_GEMFILE ..."
62
- if ! bundle install ; then
62
+ if ! smarter_bundle ; then
63
63
  echo "Test aborted (missing required gems)"
64
64
  exit 2
65
65
  fi
@@ -123,24 +123,8 @@ case `ruby -e 'puts JRUBY_VERSION' 2> /dev/null` in
123
123
  esac
124
124
 
125
125
  echo "Creating $actual_rails_version app in $tmp_dir/railsapp using adapter $db"
126
- case "$actual_rails_version" in
127
- *' '[12].*)
128
- $rails railsapp -d $db
129
- ;;
130
- *' '[345].*)
131
- case "$BUNDLE_GEMFILE" in
132
- *rails_edge.gemfile)
133
- $rails new railsapp -d $db --edge
134
- ;;
135
- *)
136
- $rails new railsapp -d $db
137
- ;;
138
- esac
139
- ;;
140
- *)
141
- echo "Unknown rails version"
142
- ;;
143
- esac
126
+
127
+ $rails new railsapp --skip-bundle -d $db
144
128
 
145
129
  cd $railsapp
146
130
 
@@ -188,71 +172,69 @@ INITIAL_BUNDLE_GEMFILE="$BUNDLE_GEMFILE"
188
172
  echo Unsetting BUNDLE_GEMFILE '(so Gemfile for rails application will be used)'
189
173
  unset BUNDLE_GEMFILE
190
174
 
191
- if [ -s Gemfile ]
175
+ if [ ! -s Gemfile ]
192
176
  then
193
- echo Adding health_check as gem to Gemfile...
194
- echo "gem 'health_check', :path => '$base_dir'" >> Gemfile
177
+ echo Missing Gemfile!
178
+ exit 2
179
+ fi
195
180
 
196
- case "$RAILS_SERVER" in
197
- webrick|'')
198
- echo "Using default webrick server"
199
- ;;
200
- *)
201
- echo "Adding $RAILS_SERVER gem to Gemfile (for use as server)"
202
- echo "gem '$RAILS_SERVER'" >> Gemfile
203
- ;;
204
- esac
205
- egrep REQUIRED < ${INITIAL_BUNDLE_GEMFILE} >> Gemfile || echo No required gems found...
206
- echo
207
- echo ================= Gemfile ===================
208
- cat Gemfile
209
- echo
210
- echo running bundle install
211
- bundle install
212
- $rehash
213
- echo "Using binstubs in $railsapp/bin for rails and rake commands"
214
- rails="$railsapp/bin/rails"
215
- rake="$railsapp/bin/rake"
216
-
217
- echo Checking $rails is present ...
218
- [ -f $rails -a -f $rake ] || bundle exec rake rails:update:bin || echo '(ignored rake rails:update:bin exit status)'
219
- [ -f $rails ] || bundle binstubs railties || echo '(ignored bundle exit status)'
220
- [ -f $rails ] || bundle binstubs rails || echo '(ignored bundle exit status)'
221
- if [ ! -f $rails ]; then
222
- echo "Test aborted (unable to create $rails)"
223
- exit 2
224
- fi
181
+ rm -f Gemfile.lock
225
182
 
226
- echo Checking $rake is present ...
227
- [ -f $rake ] || bundle binstubs rake || echo '(ignored bundle exit status)'
228
- if [ ! -f $rake ]; then
229
- echo "Test aborted (unable to create $rake)"
230
- exit 2
231
- fi
183
+ echo Adding health_check as gem to Gemfile...
184
+ echo "gem 'health_check', :path => '$base_dir'" >> Gemfile
232
185
 
233
- $rehash
234
- # Fix for rvm, otherwise bundle run from rails create fails
235
- export PATH="`pwd`/bin:$PATH"
236
- echo ================= Gemfile.lock ===================
237
- cat Gemfile.lock
238
- echo
239
- else
240
- dest=$railsapp/vendor/plugins/health_check
241
- echo Installing health_check as plugin in $dest ...
242
- mkdir -p $dest
243
- (
244
- cd $base_dir
186
+ case "$RAILS_SERVER" in
187
+ webrick|'')
188
+ echo "Using default webrick server"
189
+ ;;
190
+ *)
191
+ echo "Adding $RAILS_SERVER gem to Gemfile (for use as server)"
192
+ echo "gem '$RAILS_SERVER'" >> Gemfile
193
+ ;;
194
+ esac
245
195
 
246
- git ls-files | cpio -pdl $dest
247
-
248
- cd $dest
196
+ case "$INITIAL_BUNDLE_GEMFILE" in
197
+ */test/rails_4.0.gemfile)
198
+ sed -i.bak -e '/turbolinks/s/^/#Broken with ruby 1.9.3 # /' Gemfile
199
+ ;;
200
+ esac
201
+
202
+ egrep REQUIRED < ${INITIAL_BUNDLE_GEMFILE} >> Gemfile || echo No required gems found...
203
+
204
+ echo
205
+ echo ================= Gemfile ===================
206
+ cat Gemfile
207
+ echo
208
+ echo running bundle install
209
+ smarter_bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} install
210
+ $rehash
211
+ echo "Using binstubs in $railsapp/bin for rails and rake commands"
212
+ rails="$railsapp/bin/rails"
213
+ rake="$railsapp/bin/rake"
249
214
 
250
- echo Files installed as plugin:
251
- find . -type f
252
- echo
253
- )
215
+ echo Checking $rails is present ...
216
+ [ -f $rails -a -f $rake ] || bundle exec rake rails:update:bin || echo '(ignored rake rails:update:bin exit status)'
217
+ [ -f $rails ] || bundle binstubs railties || echo '(ignored bundle exit status)'
218
+ [ -f $rails ] || bundle binstubs rails || echo '(ignored bundle exit status)'
219
+ if [ ! -f $rails ]; then
220
+ echo "Test aborted (unable to create $rails)"
221
+ exit 2
222
+ fi
223
+
224
+ echo Checking $rake is present ...
225
+ [ -f $rake ] || bundle binstubs rake || echo '(ignored bundle exit status)'
226
+ if [ ! -f $rake ]; then
227
+ echo "Test aborted (unable to create $rake)"
228
+ exit 2
254
229
  fi
255
230
 
231
+ $rehash
232
+ # Fix for rvm, otherwise bundle run from rails create fails
233
+ export PATH="`pwd`/bin:$PATH"
234
+ echo ================= Gemfile.lock ===================
235
+ cat Gemfile.lock
236
+ echo
237
+
256
238
  for e in test ${RAILS_ENV2:-production}
257
239
  do
258
240
  if [ -f config/environments/$e.rb ]; then
@@ -359,13 +341,20 @@ cat > app/controllers/example_controller.rb <<'EOF'
359
341
  class ExampleController < ApplicationController
360
342
 
361
343
  def index
362
- render :text => 'example page'
344
+ render plain_key => 'example page'
363
345
  end
364
346
 
365
347
  def catchall
366
- render :text => 'catch all route'
348
+ render plain_key => 'catch all route'
367
349
  end
368
350
 
351
+ private
352
+
353
+ def plain_key
354
+ # Rails 4.0 doesn't have :plain, but it is deprecated later on
355
+ Rails.version < '4.1' ? :text : :plain
356
+ end
357
+
369
358
  end
370
359
 
371
360
  EOF
@@ -39,6 +39,15 @@ redo)
39
39
  ;;
40
40
  esac
41
41
 
42
+ case "$actual_rails_version" in
43
+ '4.0.'*|*' 4.0.'*)
44
+ example_mime_type=text/html
45
+ ;;
46
+ *)
47
+ example_mime_type=text/plain
48
+ ;;
49
+ esac
50
+
42
51
  run_test=$2
43
52
 
44
53
  cd $railsapp
@@ -241,14 +250,14 @@ common_tests()
241
250
  test_no=`expr 1 + $test_no`
242
251
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
243
252
  echo "${test_no}: TESTING can get an example controller ..."
244
- $testurl ${host}/example 200 text/html 'example page'
253
+ $testurl ${host}/example 200 $example_mime_type 'example page'
245
254
  echo
246
255
  fi
247
256
 
248
257
  test_no=`expr 1 + $test_no`
249
258
  if [ -z "$run_test" ] || [ $test_no == "$run_test" ]; then
250
259
  echo "${test_no}: TESTING direct call to catchall method on example controller ..."
251
- $testurl ${host}/example/catchall 200 text/html 'catch all route'
260
+ $testurl ${host}/example/catchall 200 $example_mime_type 'catch all route'
252
261
  echo
253
262
  fi
254
263
 
@@ -649,7 +658,7 @@ case "$run_test" in
649
658
 
650
659
  echo
651
660
  echo 'TESTING catchall route active ...'
652
- $testurl ${host}/another/url 200 text/html 'catch all route'
661
+ $testurl ${host}/another/url 200 $example_mime_type 'catch all route'
653
662
  echo
654
663
 
655
664
  common_tests 200
@@ -661,4 +670,4 @@ rm -f $catchall_file
661
670
  finish PASSED 0
662
671
  exit 0
663
672
 
664
- # vi: sw=4 ai sm:
673
+ # vi: sw=4 ai sm:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-23 00:00:00.000000000 Z
12
+ date: 2018-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
15
+ name: railties
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: '4.0'
22
22
  type: :runtime
@@ -24,9 +24,25 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: smarter_bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.1.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.0
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rake
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +108,7 @@ files:
92
108
  - MIT-LICENSE
93
109
  - README.rdoc
94
110
  - Rakefile
111
+ - Vagrantfile
95
112
  - config/routes.rb
96
113
  - health_check.gemspec
97
114
  - init.rb
@@ -113,11 +130,10 @@ files:
113
130
  - test/migrate/twelve/011_create_roles.roles.rb
114
131
  - test/migrate/twelve/012_create_users.rb
115
132
  - test/migrate/twelve/9_create_countries.rb
133
+ - test/provision_vagrant
116
134
  - test/rails_4.0.gemfile
117
135
  - test/rails_4.1.gemfile
118
136
  - test/rails_4.2.gemfile
119
- - test/rails_5.0.gemfile
120
- - test/rails_edge.gemfile
121
137
  - test/setup_railsapp
122
138
  - test/test_with_railsapp
123
139
  - test/testurl
@@ -154,11 +170,10 @@ test_files:
154
170
  - test/migrate/twelve/011_create_roles.roles.rb
155
171
  - test/migrate/twelve/012_create_users.rb
156
172
  - test/migrate/twelve/9_create_countries.rb
173
+ - test/provision_vagrant
157
174
  - test/rails_4.0.gemfile
158
175
  - test/rails_4.1.gemfile
159
176
  - test/rails_4.2.gemfile
160
- - test/rails_5.0.gemfile
161
- - test/rails_edge.gemfile
162
177
  - test/setup_railsapp
163
178
  - test/test_with_railsapp
164
179
  - test/testurl
@@ -1,26 +0,0 @@
1
- # Gemfile for health_test testing
2
-
3
- source 'https://rubygems.org'
4
-
5
- ruby RUBY_VERSION < '2.2.2' ? '2.2.2' : RUBY_VERSION
6
-
7
- gem 'rails', '~> 5.0.0'
8
- gem 'rake', '>= 0.8.7'
9
-
10
- group :development, :test do
11
- if defined?(JRUBY_VERSION)
12
- gem 'jruby-openssl'
13
- gem 'activerecord-jdbcsqlite3-adapter'
14
- else
15
- gem 'sqlite3', "~> 1.3.7"
16
- end
17
- gem 'shoulda'
18
-
19
- # redis based checks
20
- gem 'sidekiq', :require => !ENV['SIDEKIQ'].nil?
21
- gem 'redis', :require => !ENV['REDIS_URL'].nil?
22
- gem 'resque', :require => !ENV['RESQUE'].nil?
23
- # s3 check
24
- gem 'aws-sdk', :require => !ENV['AWS_ACCESS_KEY_ID'].nil?
25
- end
26
-
@@ -1,32 +0,0 @@
1
- # Gemfile for health_test testing
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Bundle edge Rails instead:
6
-
7
- ruby RUBY_VERSION < '2.2.2' ? '2.2.2' : RUBY_VERSION
8
-
9
- gem 'rails'
10
- gem 'rake'
11
- gem 'rack'
12
-
13
- group :development, :test do
14
- if defined?(JRUBY_VERSION)
15
- gem 'jruby-openssl'
16
- gem 'activerecord-jdbcsqlite3-adapter'
17
- else
18
- gem 'sqlite3'
19
- end
20
- gem 'shoulda'
21
-
22
- # redis based checks
23
- gem 'sidekiq', :require => !ENV['SIDEKIQ'].nil?
24
- gem 'redis', :require => !ENV['REDIS_URL'].nil?
25
- gem 'resque', :require => !ENV['RESQUE'].nil?
26
- # s3 check
27
- gem 'aws-sdk', :require => !ENV['AWS_ACCESS_KEY_ID'].nil?
28
- end
29
-
30
- # Initial Gemfile has therubyracer commented out
31
- gem 'therubyrhino', :platform => :jruby # REQUIRED
32
- gem 'therubyracer', :platform => :ruby # REQUIRED