Sha256: a221552dde85209f624d561304874f5e0e39e20af112b8030c7aa8a2ff080fd0
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module Terminus module Client autoload :Browser, ROOT + '/terminus/client/browser' autoload :PhantomJS, ROOT + '/terminus/client/phantomjs' class Base attr_reader :id def self.start(options = {}) @process = new(options) @process.start @process end def self.debugger @process.debugger end def self.save_screenshot(path, options = {}) @process.save_screenshot(path, options) end def initialize(options) @id = Faye.random @options = options @address = TCPServer.new(0).addr @connector = Connector.new(self) @port = options[:port] || @address[1] @terminus = Terminus.create(:port => @port) @browser = ChildProcess.build(*browser_args) end def debug(*args) p args if Terminus.debug end def start Terminus.ensure_reactor_running @terminus.run! @browser.start Terminus.port = @port Terminus.browser = browser_selector at_exit { stop } end def stop @terminus.stop! @browser.stop @browser.poll_for_exit(10) rescue ChildProcess::TimeoutError end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
terminus-0.6.0 | lib/terminus/client.rb |