Sha256: 101754cb205b1095955c92c41359c71603ac8c5fc522364376ef91f0e16dab2f

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 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 -rv --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

2 entries across 2 versions & 1 rubygems

Version Path
awestruct-0.0.6 lib/awestruct/commands/deploy.rb
awestruct-0.0.5 lib/awestruct/commands/deploy.rb