Module: Terminus

Extended by:
Forwardable
Defined in:
lib/terminus/connector/server.rb,
lib/terminus.rb,
lib/terminus/host.rb,
lib/terminus/node.rb,
lib/terminus/proxy.rb,
lib/terminus/client.rb,
lib/terminus/server.rb,
lib/terminus/browser.rb,
lib/terminus/headers.rb,
lib/terminus/timeouts.rb,
lib/terminus/connector.rb,
lib/terminus/controller.rb,
lib/terminus/application.rb,
lib/terminus/proxy/rewrite.rb,
lib/terminus/client/browser.rb,
lib/terminus/proxy/external.rb,
lib/terminus/client/phantomjs.rb,
lib/terminus/proxy/driver_body.rb,
lib/terminus/connector/socket_handler.rb

Overview

Based on code from the Poltergeist project github.com/jonleighton/poltergeist

Copyright © 2011 Jonathan Leighton

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: Client, Connector, Timeouts Classes: Application, Browser, Controller, Headers, Host, Node, ObsoleteElementError, Proxy, Server

Constant Summary collapse

FAYE_MOUNT =
'/messaging'
DEFAULT_HOST =
'localhost'
DEFAULT_PORT =
7004
LOCALHOST =
/^(localhost|0\.0\.0\.0|127\.0\.0\.1)$/
PING_PATH =
'/favicon.ico'
RETRY_LIMIT =
3
ROOT =
File.expand_path('..', __FILE__)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.debugObject

Returns the value of attribute debug.



46
47
48
# File 'lib/terminus.rb', line 46

def debug
  @debug
end

.socketsObject

Returns the value of attribute sockets.



46
47
48
# File 'lib/terminus.rb', line 46

def sockets
  @sockets
end

Class Method Details

.create(options = {}) ⇒ Object



48
49
50
# File 'lib/terminus.rb', line 48

def create(options = {})
  Server.new(options)
end

.endpoint(host = DEFAULT_HOST) ⇒ Object



52
53
54
# File 'lib/terminus.rb', line 52

def endpoint(host = DEFAULT_HOST)
  "http://#{host}:#{port}#{FAYE_MOUNT}"
end

.ensure_reactor_runningObject



56
57
58
59
# File 'lib/terminus.rb', line 56

def ensure_reactor_running
  Thread.new { EM.run unless EM.reactor_running? }
  Thread.pass until EM.reactor_running?
end

.portObject



61
62
63
# File 'lib/terminus.rb', line 61

def port
  @port || DEFAULT_PORT
end

.port=(port) ⇒ Object



65
66
67
# File 'lib/terminus.rb', line 65

def port=(port)
  @port = port.to_i
end

.start_browser(options = {}) ⇒ Object



69
70
71
# File 'lib/terminus.rb', line 69

def start_browser(options = {})
  Client::Browser.start(options)
end

.start_phantomjs(options = {}) ⇒ Object



73
74
75
# File 'lib/terminus.rb', line 73

def start_phantomjs(options = {})
  Client::PhantomJS.start(options)
end