Module: Forward

Defined in:
lib/forward.rb,
lib/forward/api.rb,
lib/forward/cli.rb,
lib/forward/error.rb,
lib/forward/client.rb,
lib/forward/config.rb,
lib/forward/tunnel.rb,
lib/forward/version.rb,
lib/forward/api/user.rb,
lib/forward/api/tunnel.rb,
lib/forward/api/resource.rb,
lib/forward/api/client_log.rb,
lib/forward/api/tunnel_key.rb

Defined Under Namespace

Modules: Api Classes: ApiError, CLI, CLIError, Client, ClientError, Config, ConfigError, Tunnel, TunnelError

Constant Summary collapse

DEFAULT_SSL =
true
DEFAULT_SSH_PORT =
22
DEFAULT_SSH_USER =
'tunnel'
VERSION =
'0.3.1'

Class Method Summary collapse

Class Method Details

.clientObject



58
59
60
# File 'lib/forward.rb', line 58

def self.client
  @client
end

.client=(client) ⇒ Object



54
55
56
# File 'lib/forward.rb', line 54

def self.client=(client)
  @client = client
end

.client_stringObject

Returns a string representing a detailed client version.

Returns a String representing the client.



98
99
100
101
102
103
# File 'lib/forward.rb', line 98

def self.client_string
  os     = RbConfig::CONFIG['host_os']
  engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'

  "[#{os}]::[#{engine}-#{RUBY_VERSION}]::[ruby-client-#{Forward::VERSION}]"
end

.configObject



50
51
52
# File 'lib/forward.rb', line 50

def self.config
  @config
end

.config=(config) ⇒ Object



46
47
48
# File 'lib/forward.rb', line 46

def self.config=(config)
  @config = config
end

.debug!Object



62
63
64
65
66
# File 'lib/forward.rb', line 62

def self.debug!
  @logdev   = STDOUT
  @debug    = true
  log.level = Logger::DEBUG
end

.debug?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/forward.rb', line 68

def self.debug?
  @debug
end

.debug_remotely!Object



76
77
78
79
80
81
# File 'lib/forward.rb', line 76

def self.debug_remotely!
  @logdev         = stringio_log
  @debug          = true
  @debug_remotely = true
  log.level       = Logger::DEBUG
end

.debug_remotely?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/forward.rb', line 83

def self.debug_remotely?
  @debug_remotely ||= false
end

.logObject



91
92
93
# File 'lib/forward.rb', line 91

def self.log
  @log ||= Logger.new(logdev)
end

.logdevObject



87
88
89
# File 'lib/forward.rb', line 87

def self.logdev
  @logdev ||= (windows? ? 'NUL:' : '/dev/null')
end

.ssh_portObject

Returns either a ssh port set in the environment or a set default.

Returns a String containing the ssh port.



38
39
40
# File 'lib/forward.rb', line 38

def self.ssh_port
  ENV['FORWARD_SSH_PORT'] || DEFAULT_SSH_PORT
end

.ssh_userObject

Returns either a ssh user set in the environment or a set default.

Returns a String containing the ssh user.



31
32
33
# File 'lib/forward.rb', line 31

def self.ssh_user
  ENV['FORWARD_SSH_USER'] || DEFAULT_SSH_USER
end

.stringio_logObject



72
73
74
# File 'lib/forward.rb', line 72

def self.stringio_log
  @stringio_log ||= StringIO.new
end

.windows?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/forward.rb', line 42

def self.windows?
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
end