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
- DEFAULT_PORT =
22- VERSION =
'0.7.0'
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
98 99 100 |
# File 'lib/em-ssh.rb', line 98 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
115 116 117 118 119 |
# File 'lib/em-ssh.rb', line 115 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 |