Sha256: a7add61a236f08e1514c146324ea17792b8f079bad7534f83b2b9dc9cb517047
Contents?: true
Size: 1.28 KB
Versions: 15
Compression:
Stored size: 1.28 KB
Contents
require 'open3' module Awestruct module Commands class Deploy def initialize(site_path, opts) @site_path = File.join( site_path, '/' ) @host = opts['host'] @path = File.join( opts['path'], '/' ) end def run cmd = "rsync -r -l -i --no-p --no-g --chmod=Dg+s,ug+w --delete #{@site_path} #{@host}:#{@path}" Open3.popen3( cmd ) do |stdin, stdout, stderr| stdin.close threads = [] threads << Thread.new(stdout) do |i| while ( ! i.eof? ) line = i.readline case line[0,9] when '<f.sT....' puts " updating #{line[10..-1]}" when 'cd+++++++' puts " creating #{line[10..-1]}" when '<f+++++++' puts " adding #{line[10..-1]}" when '<f..T....' # ignoring unchanged files # puts " no change to #{line[10..-1]}" else puts line end end end threads << Thread.new(stderr) do |i| while ( ! i.eof? ) line = i.readline puts line end end threads.each{|t|t.join} end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems