Sha256: da753a07531c2ea91fca02079484039820f056ac28bc5ca5e6630a5848ecd165
Contents?: true
Size: 769 Bytes
Versions: 1
Compression:
Stored size: 769 Bytes
Contents
module Datacenter module Shell class Localhost def run(command) `#{command}`.strip end end class Ssh attr_reader :ssh_args def initialize(*args) @ssh_args = args end def run(command) if @session @session.exec!(command).strip else Net::SSH.start(*@ssh_args) { |ssh| ssh.exec! command }.strip end end def open @session = Net::SSH.start *@ssh_args unless @session end def close if @session @session.close @session = nil end end def self.open(*args, &block) shell = new *args shell.open block.call shell shell.close end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datacenter-0.0.1 | lib/datacenter/shell.rb |