Sha256: f5c471a872dd1c857ee1a7daf45afc56d839579bbf1adcfbcd7738588ffb8d18

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

module Capistrano
  module Helpers
    module Rsync
      def send_files(type, server, root = 'public')
        raise "No server given" if !server
        system "rsync --progress -rue 'ssh -p #{fetch(:port)}' #{root}/#{type} #{server.user}@#{server.hostname}:#{shared_path}/#{root}/"
      end

      def get_files(type, server, root = 'public')
        raise "No server given" if !server
        puts "Importing #{type}. Please wait..."
        system "rsync --progress -rue 'ssh -p #{fetch(:port)}' #{server.user}@#{server.hostname}:#{shared_path}/#{root}/#{type} ./#{root}/"
      end

      def upload(server, source, destination)
        File.open(source, 'w') do |f|
          f.puts ERB.new(File.read("#{source}.erb"), nil, '-').result
        end
        system "rsync --rsync-path='sudo rsync' -avzO -e 'ssh -p #{fetch(:port)}' '#{source}' #{fetch(:deployer_name)}@#{server.hostname}:#{destination}"
        FileUtils.rm_f source
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-o2web-recipes-0.1.3 lib/capistrano/helpers/rsync.rb
capistrano-o2web-recipes-0.1.1 lib/capistrano/helpers/rsync.rb