Sha256: 900100da5e18d90bb5bed5dcee82b8d5960a519c6b3455e94c1d1b0a22732bef

Contents?: true

Size: 1.27 KB

Versions: 33

Compression:

Stored size: 1.27 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|
          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|
          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

33 entries across 33 versions & 1 rubygems

Version Path
factorylabs-fdlcap-0.1.0 lib/fdlcap/rsync.rb
factorylabs-fdlcap-0.2.0 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.1 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.2 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.3 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.4 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.5 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.6 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.2.7 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.0 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.1 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.10 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.11 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.15 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.16 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.17 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.18 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.19 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.2 lib/fdlcap/recipes/rsync.rb
factorylabs-fdlcap-0.3.20 lib/fdlcap/recipes/rsync.rb