oop_rails_server 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64166a5f8c1b10c4954ae6fbee47d79fee0c1065
4
- data.tar.gz: b9e67fb02b818e4d65a5189a91096d82f33733e9
3
+ metadata.gz: 1c9e054823517aa7b937701217e7cc349d6140d7
4
+ data.tar.gz: 9b2f63bc076d13fdeefe0ad08fcd82fff4ca6238
5
5
  SHA512:
6
- metadata.gz: 06e6d7d246ddb75ed3e6866505f34f2714c7ad8b94bb8d79899eb916c514dbd877bbd82b8fa8bc27959733e4abeed60edebb0ce19058a558350fbbb0a61bdaa1
7
- data.tar.gz: c362495d9d4b97c349dd60d87c7953d55b61c8eff112f3166fd793a76067e77452e42d56a6b90d8cd95d86cf96916022e7f2649550ccb50859b5489a288a0e5d
6
+ metadata.gz: 50a5b00e9f12ad296bb12a292deba5e173b8dc99f51387b7375c1914427327e08650f2043ef4b7310c3f7ab6723c069331873068d8cf2805d7369a8851f42607
7
+ data.tar.gz: 41b3c402d613e50c9866f7c358d64450b56de08fdb3f9ef39276414b555f30a6d5f784dbee6ecb3d30a05af390d76e77eae99caeab0c638fcdbed5dc398d0914
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # `oop_rails_server` Releases
2
2
 
3
+ ## 0.0.13, 6 October 2015
4
+
5
+ * A significantly longer timeout (30 seconds, rather than 15) for starting up the Rails server; some versions of JRuby
6
+ in some environments seem to require this.
7
+ * Much better error messages when the server fails to start up, or fails verification.
8
+ * Added a workaround for the fact that Rails 3.1.x requires `rack-cache`, but a new version (1.3.0) was just released
9
+ that's incompatible with Ruby < 2.x. We now pin `rack-cache` to `< 1.3.0` when using Rails 3.1.x.
10
+
3
11
  ## 0.0.12, 4 October 2015
4
12
 
5
13
  * Much better error output if the Rails server fails to start up, and willingness to keep trying if it returns an
@@ -201,6 +201,7 @@ gem 'rails'#{rails_version_spec}
201
201
  EOS
202
202
 
203
203
  f.puts "gem 'i18n', '< 0.7.0'" if RUBY_VERSION =~ /^1\.8\./
204
+ f.puts "gem 'rack-cache', '< 1.3.0'" if RUBY_VERSION =~ /^1\./
204
205
  end
205
206
 
206
207
  run_bundle_install!(:bootstrap)
@@ -229,6 +230,12 @@ EOS
229
230
  gemfile_contents << "\ngem 'i18n', '< 0.7.0'\n"
230
231
  end
231
232
 
233
+ # Since Rails 3.1.12 was released, a new version of the rack-cache gem, 1.3.0, was released that requires
234
+ # Ruby 2.0 or above. So, if we're running Rails 3.1.x, we lock the 'rack-cache' gem to an earlier version.
235
+ if rails_version && rails_version =~ /^3\.1\./
236
+ gemfile_contents << "\ngem 'rack-cache', '< 1.3.0'\n"
237
+ end
238
+
232
239
  # Apparently execjs released a version 2.2.0 that will happily install on Ruby 1.8.7, but which contains some
233
240
  # new-style hash syntax. As a result, we pin the version backwards in this one specific case.
234
241
  gemfile_contents << "\ngem 'execjs', '~> 2.0.0'\n" if RUBY_VERSION =~ /^1\.8\./
@@ -283,6 +290,8 @@ EOS
283
290
  @server_output_file ||= File.join(rails_root, 'log', 'rails-server.out')
284
291
  end
285
292
 
293
+ START_SERVER_TIMEOUT = 30
294
+
286
295
  def start_server!
287
296
  output = server_output_file
288
297
  cmd = "bundle exec rails server -p #{port} > '#{output}' 2>&1"
@@ -291,7 +300,7 @@ EOS
291
300
  server_pid_file = File.join(rails_root, 'tmp', 'pids', 'server.pid')
292
301
 
293
302
  start_time = Time.now
294
- while Time.now < start_time + 15
303
+ while Time.now < start_time + START_SERVER_TIMEOUT
295
304
  if File.exist?(server_pid_file)
296
305
  server_pid = File.read(server_pid_file).strip
297
306
  if server_pid =~ /^(\d{1,10})$/i
@@ -299,18 +308,24 @@ EOS
299
308
  break
300
309
  end
301
310
  end
311
+
302
312
  sleep 0.1
303
313
  end
314
+
315
+ unless server_pid
316
+ raise "Unable to start the Rails server even after #{Time.now - start_time} seconds; there seems to be no file at '#{server_pid_file}', or no PID in that file if it does exist. Help!"
317
+ end
304
318
  end
305
319
 
306
320
  def verify_server_and_shut_down_if_fails!
307
321
  begin
308
322
  verify_server!
309
323
  rescue Exception => e
324
+ say "Verification of Rails server failed:\n #{e.message} (#{e.class.name})\n #{e.backtrace.join("\n ")}"
310
325
  begin
311
326
  stop_server!
312
327
  rescue Exception => e
313
- say "WARNING: Verification of server failed, so we tried to stop it, but we couldn't do that. Proceeding, but you may have a Rails server left around anyway..."
328
+ say "WARNING: Verification of server failed, so we tried to stop it, but we couldn't do that. Proceeding, but you may have a Rails server left around anyway. The exception from trying to stop the server was:\n #{e.message} (#{e.class.name})\n #{e.backtrace.join("\n ")}"
314
329
  end
315
330
 
316
331
  raise
@@ -365,11 +380,11 @@ The last #{last_lines.length} lines of this log are:
365
380
  sleep 0.1
366
381
  begin
367
382
  data = Net::HTTP.get_response(uri)
383
+ last_exception = nil
368
384
  rescue Errno::ECONNREFUSED, EOFError => e
369
385
  last_exception = e
370
386
  end
371
387
 
372
- $stderr.puts "TRYING..."
373
388
  break if data && data.code && data.code.to_s == '200'
374
389
  end
375
390
 
@@ -1,3 +1,3 @@
1
1
  module OopRailsServer
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oop_rails_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Geweke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-04 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json