Sha256: 9e34b027dbded9311a389b98313e20390522a76fdca8e13a3d6e8ac686db2494

Contents?: true

Size: 1.37 KB

Versions: 23

Compression:

Stored size: 1.37 KB

Contents

class Capistrano::Configuration
  def execute(command, failure_message = "Command failed")
    puts "Executing: #{command}"
    system(command) || raise(failure_message)
  end
end

Capistrano::Configuration.instance(:must_exist).load do
  namespace :rsync do
    desc <<-DESC
    use rsync to sync assets locally or between servers
    DESC
    task :pull_shared , :roles => :app do
      servers = find_servers :roles => :app, :except => { :no_release => true }
      server = servers.first
      if server
        symlink_dirs.each do |share|
          `echo '#{password}' | /usr/bin/pbcopy`
          execute( "rsync -P -a -h -e 'ssh -p #{server.port || 22}' #{user}@#{server.host}:#{shared_path}/#{share}/* #{share}", "unable to run rsync files")
        end
      else
        puts 'no server found'
      end
    end

    desc <<-DESC
    use rsync to sync assets locally or between servers
    DESC
    task :push_shared , :roles => :app do
      servers = find_servers :roles => :app, :except => { :no_release => true }
      server = servers.first
      if server
        symlink_dirs.each do |share|
          `echo '#{password}' | /usr/bin/pbcopy`
          execute( "rsync -P -a -h -e 'ssh -p #{server.port || 22}' #{share}/* #{user}@#{server.host}:#{shared_path}/#{share}/", "unable to run rsync files")
        end
      else
        puts 'no server found'
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
factorylabs-fdlcap-0.3.28 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.17 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.15 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.14 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.13 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.12 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.11 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.10 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.9 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.7 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.6 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.5 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.4 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.3 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.2 lib/fdlcap/recipes/rsync.rb
fdlcap-0.4.0 lib/fdlcap/recipes/rsync.rb
fdlcap-0.3.35 lib/fdlcap/recipes/rsync.rb
fdlcap-0.3.34 lib/fdlcap/recipes/rsync.rb
fdlcap-0.3.33 lib/fdlcap/recipes/rsync.rb
fdlcap-0.3.31 lib/fdlcap/recipes/rsync.rb