Sha256: 1e2d54e7ed64af995fe58c3ee54fecea1dfee78844514381146a44d77ec4fe25

Contents?: true

Size: 907 Bytes

Versions: 4

Compression:

Stored size: 907 Bytes

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}"
        puts "running #{cmd}"
        Open3.popen3( cmd ) do |stdin, stdout, stderr| 
          stdin.close
          threads = []
          threads << Thread.new(stdout) do |i|
            while ( ! i.eof? )
              line = i.readline 
              puts line
            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

4 entries across 4 versions & 1 rubygems

Version Path
awestruct-0.1.9 lib/awestruct/commands/deploy.rb
awestruct-0.1.8 lib/awestruct/commands/deploy.rb
awestruct-0.1.7 lib/awestruct/commands/deploy.rb
awestruct-0.1.6 lib/awestruct/commands/deploy.rb