Class: Wemux::Pair::Commands::StartHostSession

Inherits:
Command
  • Object
show all
Defined in:
lib/wemux/pair/commands/start_host_session.rb

Instance Method Summary collapse

Methods inherited from Command

#initialize, run

Constructor Details

This class inherits a constructor from Wemux::Pair::Commands::Command

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wemux/pair/commands/start_host_session.rb', line 9

def execute
  tunnel = HostTunnel.new(offset)

  if tunnel.open
    command = "pair #{offset}"
    Clipboard.copy command
    puts ""
    puts "Host tunnel is set up, client should run (this has been copied to your clipboard):"
    puts "$ #{command}"
    puts ""
    puts "Once connected, they can use http://localhost:#{3000 + offset}/"
  else
    HostTunnel.tunnel_failure!
  end
end