Sha256: b096d5e04055ad0b48f4ccca30a1dfa71747aaf4f844e13d10faa53fd0043c1d

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

namespace :local do

  desc <<-DESC
    Rsyncs the your production content (identified by the :shared_content and
    :content_directories properties) from a deployable environment (RAILS_ENV) to the local filesystem.
  DESC
  task :rsync_content do
    from = ENV['FROM'] || 'production'
    system("rsync -avz -e ssh '#{user}@#{domain}:#{content_path}' '#{rails_root}/tmp/'")
  end

  desc <<-DESC
    Creates a symlink to public/system from tmp/system
  DESC
  task :rsync_restore_content do
    # from = ENV['FROM'] || 'production'
    print "\033[1;45m Linking Assets to public directory \033[0m\n"
    system "ln -nfs #{rails_root}/tmp/system #{rails_root}/public/system"
  end


  desc <<-DESC
    Wrapper for local:rsync_content and local:rsync_restore_content
    $> cap local:rsync RAILS_ENV=production
  DESC
  task :rsync do
    transaction do
      rsync_content
      rsync_restore_content
    end
  end
end


def generate_remote_content_backup
  run "cd #{shared_path} && tar czf #{rsync_content_backup_file} 'system'"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blavosync-0.0.2 recipes/content_rsync.rb
blavosync-0.0.1 recipes/content_rsync.rb