class DerailSpecs::Boot

Public Instance Methods

run() click to toggle source
# File lib/derail_specs/boot.rb, line 5
def run
  DerailSpecs.hooks.run(:before_server_start)
  Transaction.begin
  set_exit_hooks!

  Server.new.tap(&:boot)

  if command.present?
    puts "Run: #{command}"
    exit system(command)
  else
    loop { sleep 60 }
  end
end

Private Instance Methods

command() click to toggle source
# File lib/derail_specs/boot.rb, line 22
def command
  DerailSpecs.configuration.command
end
set_exit_hooks!() click to toggle source
# File lib/derail_specs/boot.rb, line 26
def set_exit_hooks!
  at_exit do
    Transaction.rollback
    DerailSpecs.hooks.run(:before_server_stop)
  end
  Signal.trap("INT") do
    puts "Exiting derail_specs…"
    exit
  end
end