Sha256: fec817fca3093cc689912d91b6edccff367b84423aee9da9597bf3d2ceeaede4
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 Bytes
Contents
class Run def self.ssh; @ssh; end def self.init(cmds, where) aster = '*'*24 puts "#{aster} #{where} #{aster}" @ssh = nil @cmds = cmds if where.include?('@') arr = where.split(':') host = arr.first dir = arr.length > 1 ? arr.last : nil else host = nil dir = where end @cmds = "cd; cd #{dir}\n" + @cmds unless dir && dir.empty? @ssh = "ssh #{host}" if host end def self.info My.verbose('SSH', @ssh) My.verbose('cmds', @cmds) end def self.run here = '___EOS___' silent = Doit.options[:silent] ? '>/dev/null' : '' cmd = "cat <<'#{here}\' | #{@ssh} bash -i -l #{silent} 2>&1" cmds = "#{cmd}\n#{@cmds}#{here}\n" unless Doit.options[:noop] IO.popen(cmds) { |p| p.each { |f| puts f } } else My.verbose('noop', cmds) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
doit-0.2.8 | lib/run.rb |
doit-0.2.7 | lib/run.rb |
doit-0.2.4 | lib/run.rb |