10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/true_automation/client.rb', line 10
def start(options)
@port = options[:port]
remote = options[:remote]
ta_debug = options[:ta_debug]
if options[:ta_service]
driver_path = " --driver #{options[:ta_service]}"
elsif options[:driver]
driver_path = " --driver #{options[:driver]}"
driver_path += " --driver-version #{options[:driver_version]}" if options[:driver_version]
end
@executable = ENV['TRUEAUTOMATION_EXEC'] || 'trueautomation'
if find_executable(@executable).nil?
raise "`#{@executable}` not found. Can not find TrueAutomation.IO client"
end
trueautomation_version = `#{@executable} --version`
puts "TrueAutomation.IO client #{trueautomation_version.strip}"
Dir.mkdir('log') unless File.exist?('log')
logfile = "log/trueautomation-#{Time.now.strftime('%Y%m%dT%H%M%S')}.log"
@pid = spawn("#{@executable} --log-file #{logfile} --port #{@port}#{driver_path}#{remote}#{ta_debug}")
puts "Started TrueAutomation.IO client with pid #{@pid} listening to port #{@port}"
@pid
end
|