Module: Wtails

Extended by:
Wtails
Included in:
Wtails
Defined in:
lib/wtails.rb,
lib/wtails/tail.rb,
lib/wtails/stdin.rb,
lib/wtails/browser.rb,
lib/wtails/version.rb,
lib/wtails/web_server.rb,
lib/wtails/web_socket.rb

Defined Under Namespace

Modules: Browser, Stdin, Tail, WebServer, WebSocket

Constant Summary collapse

VERSION =
"0.2.1"

Instance Method Summary collapse

Instance Method Details

#channel(path) ⇒ Object



32
33
34
35
# File 'lib/wtails.rb', line 32

def channel(path)
  @channel ||= {}
  @channel[path] ||= EM::Channel.new
end

#configObject



37
38
39
# File 'lib/wtails.rb', line 37

def config
  @config
end

#http_serverObject



41
42
43
# File 'lib/wtails.rb', line 41

def http_server
  @http_server
end

#http_server=(http_server) ⇒ Object



45
46
47
# File 'lib/wtails.rb', line 45

def http_server=(http_server)
  @http_server = http_server
end

#run(opts, files) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wtails.rb', line 20

def run(opts, files)
  configure(opts)

  Thread.abort_on_exception = true
  EM.run do
    EM.defer { WebSocket.run(opts, files) }
    EM.defer { WebServer.run(opts, files) }
    EM.defer { Browser.run }
    Tail.run(opts, files) 
  end
end