Class: Webrat::Selenium::ApplicationServers::Rack

Inherits:
Base
  • Object
show all
Defined in:
lib/webrat/selenium/application_servers/rack.rb

Instance Method Summary collapse

Methods inherited from Base

#boot, #prepare_pid_file, #stop_at_exit, #wait, #wait_for_socket

Methods included from SilenceStream

#silence_stream

Instance Method Details

#failObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/webrat/selenium/application_servers/rack.rb', line 22

def fail
  $stderr.puts
  $stderr.puts
  $stderr.puts "==> Failed to boot the application server... exiting!"
  $stderr.puts
  $stderr.puts "Verify you can start a server on port #{Webrat.configuration.application_port} with the following command:"
  $stderr.puts
  $stderr.puts "    #{start_command}"
  exit
end

#startObject



8
9
10
11
12
13
14
15
16
# File 'lib/webrat/selenium/application_servers/rack.rb', line 8

def start
  @pid = fork do
    if File.exist?("log")
      redirect_io(STDOUT, File.join("log", "webrat.webrick.stdout.log"))
      redirect_io(STDERR, File.join("log", "webrat.webrick.stderr.log"))
    end
    exec start_command
  end
end

#start_commandObject



33
34
35
# File 'lib/webrat/selenium/application_servers/rack.rb', line 33

def start_command
  "#{bundler} rackup -s webrick --port #{Webrat.configuration.application_port} --env #{Webrat.configuration.application_environment}".strip
end

#stopObject



18
19
20
# File 'lib/webrat/selenium/application_servers/rack.rb', line 18

def stop
  Process.kill("INT", @pid)
end