Module: RailsTestServing::Bootstrap
- Included in:
- RailsTestServing
- Defined in:
- lib/rails_test_serving/bootstrap.rb
Constant Summary collapse
- SOCKET_PATH =
['tmp', 'sockets', 'test_server.sock']
Instance Method Summary collapse
Instance Method Details
#active? ⇒ Boolean
45 46 47 |
# File 'lib/rails_test_serving/bootstrap.rb', line 45 def active? @active end |
#boot(argv = ARGV) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rails_test_serving/bootstrap.rb', line 5 def boot(argv=ARGV) if argv.delete('--serve') start_server elsif !argv.delete('--local') Client.run_tests end end |
#options ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/rails_test_serving/bootstrap.rb', line 37 def ||= begin = || {} [:reload] ||= [] end end |
#service_uri ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails_test_serving/bootstrap.rb', line 13 def service_uri @service_uri ||= begin # Determine RAILS_ROOT root, max_depth = Pathname('.'), Pathname.pwd..to_s.split(File::SEPARATOR).size until root.join('config', 'boot.rb').file? root = root.parent if root.to_s.split(File::SEPARATOR).size >= max_depth raise "RAILS_ROOT could not be determined" end end root = root.cleanpath # Adjust load path $: << root.to_s << root.join('test').to_s # Ensure socket directory exists path = root.join(*SOCKET_PATH) path.dirname.mkpath # URI "drbunix:#{path}" end end |