rails_health_check 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ Don't remove
@@ -0,0 +1,11 @@
1
+ class CreateCountries < ActiveRecord::Migration[5.0]
2
+ def self.up
3
+ create_table :countries do |t|
4
+ t.column :name, :string
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :countries
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateRoles < ActiveRecord::Migration[5.0]
2
+ def self.up
3
+ create_table :roles do |t|
4
+ t.column :name, :string
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :roles
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateUsers < ActiveRecord::Migration[5.0]
2
+ def self.up
3
+ create_table "users", :force => true do |t|
4
+ t.column :name, :string
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :users
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateCountries < ActiveRecord::Migration[5.0]
2
+ def self.up
3
+ create_table :countries do |t|
4
+ t.column :name, :string
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :countries
10
+ end
11
+ 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
@@ -0,0 +1,26 @@
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.1.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
+
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,440 @@
1
+ #!/bin/bash
2
+
3
+ route_prefix=medical_check
4
+
5
+ err_report() {
6
+ echo "$0: Error on line $1 - aborted"
7
+ exit 1
8
+ }
9
+
10
+ trap 'err_report $LINENO' ERR
11
+
12
+ # Any failure causes exit
13
+ set -e
14
+
15
+ case "$1" in
16
+ [0-9]*)
17
+ export BUNDLE_GEMFILE=$PWD/test/rails_$1.gemfile
18
+ ;;
19
+ esac
20
+ while :
21
+ do
22
+ case "$BUNDLE_GEMFILE" in
23
+ */test/rails_[Qq].gemfile)
24
+ echo "Aborting..."
25
+ exit 2
26
+ ;;
27
+ */test/rails_edge.gemfile|*/test/rails_[0-9].[0-9]*.gemfile)
28
+ if [ -f "$BUNDLE_GEMFILE" ]; then
29
+ break
30
+ fi
31
+ ;;
32
+ esac
33
+ echo "== SELECT GEMFILE =="
34
+ echo
35
+ echo "Please select the gemfile for the required rails series:"
36
+ (cd test ; ls rails*gemfile | ruby -p -e '$_.sub!(/rails_(.*).gemfile/, " \\1")' )
37
+ echo
38
+ echo -n "Enter choice (or q to quit): "
39
+ read x
40
+ export BUNDLE_GEMFILE=$PWD/test/rails_$x.gemfile
41
+ done
42
+
43
+ if [ -z "$MIDDLEWARE" ]; then
44
+ echo -n "Add as middleware [N/y] : "
45
+ read MIDDLEWARE
46
+ export MIDDLEWARE
47
+ fi
48
+ rm -rf tmp/Gemfile* tmp/railsapp tmp/bin tmp/gems test/bin test/rails*.gemfile.lock
49
+
50
+ mkdir -p tmp/gems
51
+
52
+ . test/init_variables
53
+
54
+ if $rbenv_which bundle ; then
55
+ echo Bundler is installed
56
+ else
57
+ gem install bundler
58
+ $rehash
59
+ fi
60
+
61
+ echo "Running bundle with BUNDLE_GEMFILE=$BUNDLE_GEMFILE ..."
62
+ if ! smarter_bundle ; then
63
+ echo "Test aborted (missing required gems)"
64
+ exit 2
65
+ fi
66
+ $rehash
67
+
68
+ rails="$base_dir/test/bin/rails"
69
+ rake="$base_dir/test/bin/rake"
70
+
71
+ echo Checking $rails is present ...
72
+ [ -f $rails -a -f $rake ] || bundle exec rake rails:update:bin || echo '(ignored rake rails:update:bin exit status)'
73
+ [ -f $rails ] || bundle binstubs railties || echo '(ignored bundle exit status)'
74
+ [ -f $rails ] || bundle binstubs rails || echo '(ignored bundle exit status)'
75
+ if [ ! -f $rails ]; then
76
+ echo "Test aborted (unable to create $rails)"
77
+ exit 2
78
+ fi
79
+
80
+ if [ ! -f $rake ]; then
81
+ echo "Running bundle binstubs rake ..."
82
+ if ! bundle binstubs rake || [ ! -f $rake ]; then
83
+ echo "Test aborted (unable to create $rake)"
84
+ exit 2
85
+ fi
86
+ fi
87
+
88
+ actual_rails_version=`$rails -v`
89
+
90
+ [ -d lib/health_check ] || exec echo setup_railsapp MUST be executed in the base of the health_check gem/clone of git repository
91
+
92
+ export GEM_PATH="$tmp_dir/gems:`gem environment gempath`"
93
+ echo Set GEM_PATH=$GEM_PATH
94
+
95
+ echo Installing health_check as a gem into $tmp_dir/gems
96
+ rm -f pkg/health_check-*.gem
97
+ if env GEM_HOME=$tmp_dir/gems $rake install
98
+ then
99
+ echo rake install passed
100
+ else
101
+ echo rake install failed! running gem install pkg/health_check-*.gem manually to see error message:
102
+ env GEM_HOME=$tmp_dir/gems gem install pkg/health_check-*.gem
103
+ echo gem install worked, but flagging it as a FAIL anyway since rake install failed!
104
+ exit 2
105
+ fi
106
+
107
+ echo Gems in tmp/gems:
108
+ ls tmp/gems
109
+
110
+ echo Environment:
111
+ env | egrep 'TRAVIS|RAILS|RUBY|_ENV|GEM|BUNDLE' || echo "No relevant variables set"
112
+
113
+ cd $tmp_dir
114
+
115
+ case `ruby -e 'puts JRUBY_VERSION' 2> /dev/null` in
116
+ [0-9]*)
117
+ db=jdbcsqlite3
118
+ # Appears to need a bit extra time
119
+ ;;
120
+ *)
121
+ db=sqlite3
122
+ ;;
123
+ esac
124
+
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 --skip-bundle -d $db --edge
134
+ ;;
135
+ *)
136
+ $rails new railsapp --skip-bundle -d $db
137
+ ;;
138
+ esac
139
+ ;;
140
+ *)
141
+ echo "Unknown rails version"
142
+ ;;
143
+ esac
144
+
145
+ cd $railsapp
146
+
147
+ [ -z "$rehash" ] || rbenv local `rbenv version-name`
148
+
149
+ echo "Changed current directory to railsapp root: $railsapp"
150
+
151
+ echo "Fixing rdoc require in Rakefile if needed"
152
+ ruby -p -i.bak -e '$_.gsub!(/rake.rdoctask/, "rdoc/task")' Rakefile
153
+
154
+ echo "Configuring mailer to point to fake_smtp_server port 3555"
155
+ cat >> config/environment.rb <<'!EOF!'
156
+
157
+ ActionMailer::Base.delivery_method = :smtp
158
+ ActionMailer::Base.smtp_settings = { :address => "localhost", :port => 3555 }
159
+
160
+ !EOF!
161
+
162
+ echo Adding an initializer for health_check gem ...
163
+ mkdir -p config/initializers
164
+ tee config/initializers/health_check.rb <<!
165
+ HealthCheck.setup do |config|
166
+ config.success = "$success"
167
+ config.smtp_timeout = 60.0
168
+ config.http_status_for_error_text = 550
169
+ config.http_status_for_error_object = 555
170
+ config.uri = '$route_prefix'
171
+ config.origin_ip_whitelist = ENV['IP_WHITELIST'].split(',') unless ENV['IP_WHITELIST'].blank?
172
+ config.basic_auth_username = ENV['AUTH_USER'] unless ENV['AUTH_USER'].blank?
173
+ config.basic_auth_password = ENV['AUTH_PASSWORD'] unless ENV['AUTH_PASSWORD'].blank?
174
+
175
+ config.add_custom_check do
176
+ File.exists?("$custom_file") ? '' : '$custom_file is missing!'
177
+ end
178
+
179
+ config.add_custom_check('pass') do
180
+ ''
181
+ end
182
+
183
+ config.include_error_in_response_body = false if ENV['HIDE_ERROR_RESPONSE'].present?
184
+ end
185
+ !
186
+
187
+ echo Setting INITIAL_BUNDLE_GEMFILE=$BUNDLE_GEMFILE
188
+ INITIAL_BUNDLE_GEMFILE="$BUNDLE_GEMFILE"
189
+ echo Unsetting BUNDLE_GEMFILE '(so Gemfile for rails application will be used)'
190
+ unset BUNDLE_GEMFILE
191
+
192
+ if [ ! -s Gemfile ]
193
+ then
194
+ echo Missing Gemfile!
195
+ exit 2
196
+ fi
197
+ echo Adding health_check as gem to Gemfile...
198
+ echo "gem 'health_check', :path => '$base_dir'" >> Gemfile
199
+
200
+ case "$RAILS_SERVER" in
201
+ webrick|'')
202
+ echo "Using default webrick server"
203
+ ;;
204
+ *)
205
+ echo "Adding $RAILS_SERVER gem to Gemfile (for use as server)"
206
+ echo "gem '$RAILS_SERVER'" >> Gemfile
207
+ ;;
208
+ esac
209
+ egrep REQUIRED < ${INITIAL_BUNDLE_GEMFILE} >> Gemfile || echo No required gems found...
210
+ echo
211
+ echo ================= Gemfile ===================
212
+ cat Gemfile
213
+ echo
214
+ echo running bundle install
215
+ smarter_bundle ${BUNDLER_VERSION:+_${BUNDLER_VERSION}_} install
216
+ $rehash
217
+ echo "Using binstubs in $railsapp/bin for rails and rake commands"
218
+ rails="$railsapp/bin/rails"
219
+ rake="$railsapp/bin/rake"
220
+
221
+ echo Checking $rails is present ...
222
+ [ -f $rails -a -f $rake ] || bundle exec rake rails:update:bin || echo '(ignored rake rails:update:bin exit status)'
223
+ [ -f $rails ] || bundle binstubs railties || echo '(ignored bundle exit status)'
224
+ [ -f $rails ] || bundle binstubs rails || echo '(ignored bundle exit status)'
225
+ if [ ! -f $rails ]; then
226
+ echo "Test aborted (unable to create $rails)"
227
+ exit 2
228
+ fi
229
+
230
+ echo Checking $rake is present ...
231
+ [ -f $rake ] || bundle binstubs rake || echo '(ignored bundle exit status)'
232
+ if [ ! -f $rake ]; then
233
+ echo "Test aborted (unable to create $rake)"
234
+ exit 2
235
+ fi
236
+
237
+ $rehash
238
+ # Fix for rvm, otherwise bundle run from rails create fails
239
+ export PATH="`pwd`/bin:$PATH"
240
+ echo ================= Gemfile.lock ===================
241
+ cat Gemfile.lock
242
+ echo
243
+
244
+ for e in test ${RAILS_ENV2:-production}
245
+ do
246
+ if [ -f config/environments/$e.rb ]; then
247
+ echo ======== config/environments/$e.rb ================
248
+ sed -i.bak -e 's/config.serve_static_assets = false/config.serve_static_assets = true # NOTE: health_check test: changed to true/' \
249
+ -e 's/config.active_record.migration_error = :page_load/# & # NOTE: health_check test: commented out/' \
250
+ config/environments/$e.rb
251
+ cat config/environments/$e.rb || true
252
+ echo
253
+ fi
254
+ done
255
+ echo "============== config/environment.rb ============="
256
+ cat config/environment.rb
257
+ echo
258
+
259
+ echo ========================
260
+ case $db in
261
+ jdbcsqlite3)
262
+ for e in test ${RAILS_ENV2:-production}
263
+ do
264
+ echo
265
+ export RAILS_ENV=$e RACK_ENV=$e
266
+ echo "Jruby requires the database to be created before the server is started: running RAILS_ENV=$e rake db:migrate"
267
+ $rake db:migrate
268
+ echo
269
+ done
270
+ ;;
271
+ esac
272
+
273
+ echo STATIC-FILE > public/static.txt
274
+
275
+ cat > public/ajax_example.html <<'EOF'
276
+ <html>
277
+ <head>
278
+ <title>Example static and dynamic calls to health_check</title>
279
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
280
+ <script>
281
+ function parse_result(result, callback) {
282
+ $("#html_status_"+callback).text(result.status);
283
+ $("#html_body_"+callback).text(result.responseText);
284
+ alert(callback + " callback called");
285
+ };
286
+
287
+ function dynamic_call(dataType, url) {
288
+ $.ajax({
289
+ dataType: dataType,
290
+ url: url,
291
+ success: function(data, textStatus, result) {
292
+ $("#data_success").text(data);
293
+ parse_result(result, "success");
294
+ },
295
+ error: function(result, textStatus) {
296
+ parse_result(result, "error");
297
+ },
298
+ complete: function(result, textStatus) {
299
+ parse_result(result, "complete");
300
+ }
301
+ });
302
+ };
303
+ </script>
304
+ </head>
305
+ <body>
306
+ <h1>Static calls</h1>
307
+ <ul>
308
+ <li><a href="http://localhost:3000/health_check/site" target="_blank">Minimal health check should always work</a>
309
+ (<a href="http://localhost:3000/health_check/site.json" target="_blank">json</a>,
310
+ <a href="http://localhost:3000/health_check/site.xml" target="_blank">xml</a>,
311
+ <a href="http://localhost:3000/health_check/site.html" target="_blank">html</a>)
312
+ <li><a href="http://localhost:3000/health_check/fail" target="_blank">Force health check to fail!</a>
313
+ (<a href="http://localhost:3000/health_check/fail.json" target="_blank">json</a>,
314
+ <a href="http://localhost:3000/health_check/fail.xml" target="_blank">xml</a>,
315
+ <a href="http://localhost:3000/health_check/fail.html" target="_blank">html</a>)
316
+ </ul>
317
+ <h1>Dynamic calls</h1>
318
+ <ul>
319
+ <li><a href="#" onclick="dynamic_call('text', 'http://localhost:3000/health_check/site');">Minimal health check should always work</a>
320
+ (<a href="#" onclick="dynamic_call('json', 'http://localhost:3000/health_check/site.json');">json</a>,
321
+ <a href="#" onclick="dynamic_call('xml', 'http://localhost:3000/health_check/site.xml');">xml</a>,
322
+ <a href="#" onclick="dynamic_call('text', 'http://localhost:3000/health_check/site.html');">html</a>)
323
+
324
+ <li><a href="#" onclick="dynamic_call('text', 'http://localhost:3000/health_check/fail');">Force health check to fail!</a>
325
+ (<a href="#" onclick="dynamic_call('json', 'http://localhost:3000/health_check/fail.json');">json</a>,
326
+ <a href="#" onclick="dynamic_call('xml', 'http://localhost:3000/health_check/fail.xml');">xml</a>,
327
+ <a href="#" onclick="dynamic_call('text', 'http://localhost:3000/health_check/fail.html');">html</a>)
328
+ <li>Last results sent to success:<ul>
329
+ <li><b>Data:</b><span id=data_success></span>
330
+ <li><b>result.status:</b><span id=html_status_success></span>
331
+ <li><b>result.responseText:</b><span id=html_body_success></span>
332
+ </ul>
333
+ <li>Last results sent to error:<ul>
334
+ <li><b>result.status:</b><span id=html_status_error></span>
335
+ <li><b>result.responseText:</b><span id=html_body_error></span>
336
+ </ul>
337
+ <li>Last results sent to complete:<ul>
338
+ <li><b>result.status:</b><span id=html_status_complete></span>
339
+ <li><b>result.responseText:</b><span id=html_body_complete></span>
340
+ </ul>
341
+ </ul>
342
+ </body>
343
+ </html>
344
+ EOF
345
+
346
+ cat > app/controllers/example_controller.rb <<'EOF'
347
+ class ExampleController < ApplicationController
348
+
349
+ def index
350
+ render :plain => 'example page'
351
+ end
352
+
353
+ def catchall
354
+ render :plain => 'catch all route'
355
+ end
356
+
357
+ end
358
+
359
+ EOF
360
+
361
+ echo =======================================
362
+
363
+ case "$MIDDLEWARE" in
364
+ [Yy]*)
365
+ if [ -s config/application.rb ]; then
366
+ mv -f config/application.rb config/application.rb-old
367
+ (
368
+ ruby -n -e 'print if not /^ *end/..9999' config/application.rb-old | tee /tmp/t$$
369
+ if [ ! -s /tmp/t$$ ]; then
370
+ echo "WARNING: ruby -n -e failed silently - using sed instead!! (rbx-19mode has that problem)" >&3
371
+ sed -e '/^ *end/,$d' config/application.rb-old
372
+ fi
373
+
374
+ echo " # -----------------------------------------"
375
+ echo " # START OF SECTION FOR TESTING HEALTH_CHECK"
376
+ echo " config.middleware.insert_after Rails::Rack::Logger, HealthCheck::MiddlewareHealthcheck"
377
+ echo " # END OF SECTION FOR TESTING HEALTH_CHECK"
378
+ echo " # ---------------------------------------"
379
+ ruby -n -e 'print if /^ *end/..9999' config/application.rb-old | tee /tmp/t$$
380
+ if [ ! -s /tmp/t$$ ]; then
381
+ echo "WARNING: ruby -n -e failed silently - using sed instead!! (rbx-19mode has that problem)" >&3
382
+ sed -n -e '/^ *end/,$p' config/application.rb-old
383
+ fi
384
+ ) 3>&1 > config/application.rb
385
+
386
+ #echo =============== config/application.rb-old ========================
387
+ #cat config/application.rb-old
388
+ echo =============== config/application.rb ========================
389
+ cat config/application.rb
390
+ else
391
+ echo FAILED: NO config/application.rb file!!
392
+ exit 2
393
+ fi
394
+
395
+ echo =======================================
396
+
397
+ ;;
398
+ esac
399
+
400
+ if [ -s config/routes.rb ]; then
401
+ mv -f config/routes.rb config/routes.rb-old
402
+ (
403
+ ruby -n -e 'print if not /^end/..9999' config/routes.rb-old | tee /tmp/t$$
404
+ if [ ! -s /tmp/t$$ ]; then
405
+ echo "WARNING: ruby -n -e failed silently - using sed instead!! (rbx-19mode has that problem)" >&3
406
+ sed -e '/^end/,$d' config/routes.rb-old
407
+ fi
408
+
409
+ # rails 3.0+
410
+ echo " # -----------------------------------------"
411
+ echo " # START OF SECTION FOR TESTING HEALTH_CHECK"
412
+ echo " get 'example(/:action(/:id))(.:format)' => 'example'"
413
+ echo " if File.exists?('$catchall_file')"
414
+ echo " health_check_routes"
415
+ echo " # CATCH ALL ROUTE"
416
+ echo " get '*path', :to => 'example#catchall'"
417
+ echo " end"
418
+ echo " # END OF SECTION FOR TESTING HEALTH_CHECK"
419
+ echo " # ---------------------------------------"
420
+ ruby -n -e 'print if /^end/..9999' config/routes.rb-old | tee /tmp/t$$
421
+ if [ ! -s /tmp/t$$ ]; then
422
+ echo "WARNING: ruby -n -e failed silently - using sed instead!! (rbx-19mode has that problem)" >&3
423
+ sed -n -e '/^end/,$p' config/routes.rb-old
424
+ fi
425
+ ) 3>&1 > config/routes.rb
426
+
427
+ #echo =============== config/routes.rb-old ========================
428
+ #cat config/routes.rb-old
429
+ echo =============== config/routes.rb ========================
430
+ cat config/routes.rb
431
+ else
432
+ echo FAILED: NO config/routes.rb file!!
433
+ exit 2
434
+ fi
435
+ echo =======================================
436
+
437
+ echo
438
+ echo "Created $actual_rails_version app in $railsapp using adapter $db"
439
+ echo -n "Using "
440
+ ruby --version