Class: ReverseTunnel::CLI::Client

Inherits:
Configurator show all
Defined in:
lib/reverse-tunnel/cli.rb

Instance Attribute Summary

Attributes inherited from Base

#arguments

Instance Method Summary collapse

Methods inherited from Configurator

configure, #instance, #method_missing, #parse_host_port, #parse_host_port_range, #server=

Methods inherited from Base

#initialize, #options

Constructor Details

This class inherits a constructor from ReverseTunnel::CLI::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ReverseTunnel::CLI::Configurator

Instance Method Details

#api=(api) ⇒ Object



107
108
109
# File 'lib/reverse-tunnel/cli.rb', line 107

def api=(api)
  self.api_host, self.api_port = parse_host_port(api) if api
end

#configure(object = self) ⇒ Object



111
112
113
114
115
# File 'lib/reverse-tunnel/cli.rb', line 111

def configure(object = self)
  super
  self.token = token
  instance
end

#parserObject



95
96
97
98
99
100
101
# File 'lib/reverse-tunnel/cli.rb', line 95

def parser
  @parser ||= Trollop::Parser.new do
    opt :server, "Host and port of ReverseTunnel server", :type => :string
    opt :api, "Host and port of status HTTP api", :type => :string
    opt :"local-port", "Port to forward incoming connection", :default => 22
  end
end

#tokenObject



103
104
105
# File 'lib/reverse-tunnel/cli.rb', line 103

def token
  arguments.first
end