Module: Wtails::Browser

Extended by:
Browser
Included in:
Browser
Defined in:
lib/wtails/browser.rb

Instance Method Summary collapse

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wtails/browser.rb', line 5

def run
  if Wtails.config[:serve]
    puts "serve on http://localhost:#{Wtails.config[:port]}"
  else
    # ugly, but there is nothing for it but to poll
    # because thin has no start callback
    while true
      if Wtails.http_server && Wtails.http_server.running?
        break
      end
      sleep(0.1)
    end
    ::Launchy.open("http://localhost:#{Wtails.config[:port]}") rescue nil
  end
end