Sha256: ccc06bd66dfd23ff1b204baa5cb852bf57feb1ae005c5769d6a475acbcc96e19

Contents?: true

Size: 871 Bytes

Versions: 7

Compression:

Stored size: 871 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 -rvl --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

7 entries across 7 versions & 1 rubygems

Version Path
awestruct-0.1.4 lib/awestruct/commands/deploy.rb
awestruct-0.1.3 lib/awestruct/commands/deploy.rb
awestruct-0.1.2 lib/awestruct/commands/deploy.rb
awestruct-0.1.1 lib/awestruct/commands/deploy.rb
awestruct-0.1.0 lib/awestruct/commands/deploy.rb
awestruct-0.0.9 lib/awestruct/commands/deploy.rb
awestruct-0.0.8 lib/awestruct/commands/deploy.rb