Method: Ngrok::Tunnel.start

Defined in:
lib/ngrok/tunnel.rb

.start(params = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ngrok/tunnel.rb', line 23

def start(params = {})
  ensure_binary
  init(params)

  if stopped?
    @params[:log] = (@params[:log]) ? File.open(@params[:log], 'w+') : Tempfile.new('ngrok')
    @pid = spawn("exec ngrok http " + ngrok_exec_params)
    at_exit { Ngrok::Tunnel.stop }
    fetch_urls
  end

  @status = :running
  @ngrok_url
end