Sha256: a38d23986e0601d0238fcd89b4a52ced97fac0effc24859d146c9ed5cf8a7915
Contents?: true
Size: 818 Bytes
Versions: 3
Compression:
Stored size: 818 Bytes
Contents
require 'net/ssh' module Ajimi class Server class Ssh def initialize(options = {}) @host = options[:host] @user = options[:user] @key = options[:key] end def net_ssh Net::SSH end def command_exec(cmd) ssh_options_default = {} ssh_options_override = { keys: @key } ssh_options = ssh_options_default.merge(ssh_options_override) stdout = "" stderr = "" net_ssh.start(@host, @user, ssh_options) do |session| session.exec!(cmd) do |channel, stream, data| stdout << data if stream == :stdout stderr << data if stream == :stderr end end $stderr.puts stderr unless stderr == "" stdout end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ajimi-0.2.1 | lib/ajimi/server/ssh.rb |
ajimi-0.2.0 | lib/ajimi/server/ssh.rb |
ajimi-0.1.0 | lib/ajimi/server/ssh.rb |