Class: Webrat::Selenium::ApplicationServers::Merb

Inherits:
Base
  • Object
show all
Defined in:
lib/webrat/selenium/application_servers/merb.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


20
21
22
23
24
25
26
27
28
29
# File 'lib/webrat/selenium/application_servers/merb.rb', line 20

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

#merb_commandObject


39
40
41
42
43
44
45
# File 'lib/webrat/selenium/application_servers/merb.rb', line 39

def merb_command
  if File.exist?('bin/merb')
    merb_cmd = 'bin/merb'
  else
    merb_cmd = 'merb'
  end
end

#pid_fileObject


31
32
33
# File 'lib/webrat/selenium/application_servers/merb.rb', line 31

def pid_file
"log/merb.#{Webrat.configuration.application_port}.pid"
end

#startObject


8
9
10
# File 'lib/webrat/selenium/application_servers/merb.rb', line 8

def start
  system start_command
end

#start_commandObject


35
36
37
# File 'lib/webrat/selenium/application_servers/merb.rb', line 35

def start_command
"#{merb_command} -d -p #{Webrat.configuration.application_port} -e #{Webrat.configuration.application_environment}"
end

#stopObject


12
13
14
15
16
17
18
# File 'lib/webrat/selenium/application_servers/merb.rb', line 12

def stop
  silence_stream(STDOUT) do
    pid = File.read(pid_file)
    system("kill -9 #{pid}")
    FileUtils.rm_f pid_file
  end
end