Class: EventMachine::Ssh
- Inherits:
-
Object
- Object
- EventMachine::Ssh
- Defined in:
- lib/em-ssh.rb,
lib/em-ssh/log.rb,
lib/em-ssh/shell.rb,
lib/em-ssh/session.rb,
lib/em-ssh/version.rb,
lib/em-ssh/callbacks.rb,
lib/em-ssh/connection.rb,
lib/em-ssh/packet-stream.rb,
lib/em-ssh/server-version.rb,
lib/em-ssh/authentication-session.rb,
lib/em-ssh/connection/channel/interactive.rb,
lib/em-ssh/connection/channel/null-logger.rb
Overview
end
Defined Under Namespace
Modules: Callbacks, Error, Log Classes: AuthenticationSession, ChannelOpenFailed, ClosedChannel, Connection, ConnectionFailed, ConnectionTerminated, ConnectionTimeout, Disconnect, Disconnected, NegotiationTimeout, PacketStream, ServerVersion, Session, Shell, SshError, TimeoutError
Constant Summary collapse
Class Attribute Summary collapse
-
.logger(level = Logger::WARN) ⇒ Logger
Creates a logger when necessary.
Class Method Summary collapse
-
.connect(host, user, opts = {}) {|Session| ... } ⇒ Session
(also: start)
Connect to an ssh server.
Class Attribute Details
.logger(level = Logger::WARN) ⇒ Logger
Creates a logger when necessary
99 100 101 |
# File 'lib/em-ssh.rb', line 99 def logger(level = Logger::WARN) @logger ||= ::Logger.new(STDERR).tap{ |l| l.level = level } end |
Class Method Details
.connect(host, user, opts = {}) {|Session| ... } ⇒ Session Also known as: start
Connect to an ssh server
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/em-ssh.rb', line 116 def connect(host, user, opts = {}, &blk) opts[:logger] || logger.debug("#{self}.connect(#{host}, #{user}, #{opts})") = { host: host, user: user, port: DEFAULT_PORT }.merge(opts) EM.connect([:host], [:port], Connection, , &blk) end |