Sha256: bb0e1867ad7df512122af34ddd5246906eef662eb8508ef05d44af9db5453c3a

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

namespace :pull do
  desc 'Pull data (db/files) from remote (i.e: production) application.'
  task :data do
    invoke "pull:files"
    invoke "pull:db"
  end

  desc 'Pull db'
  task :db do
    on roles(:app) do |host|
      debug ":   Pulling database from #{fetch(:stage)} ..."
      within "#{current_path}/tmp" do
        with rails_env: :production do
          rake "db:backup"
        end
      end
      run_locally do
        execute "scp -P #{host.port} #{host.user}@#{host.hostname}:#{current_path}/tmp/db.sql tmp/"
        rake "db:restore tmp/db.sql"
      end
    end

  end

  desc 'Pull files uploaded'
  task :files do
    on roles(:app) do |host|
      run_locally do
        debug ":   Pulling Files from #{fetch(:stage)} ..."
        if fetch(:backup_dirs).any?
          fetch(:backup_dirs).each do |dir|
            execute "scp -r -P #{host.port} #{host.user}@#{host.hostname}:#{current_path}/#{dir} #{dir}"
          end
        else
          error ":    Set key :backup_dirs to know which ones to pull"
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
prun-ops-0.0.16 lib/capistrano/pull.rake
prun-ops-0.0.15 lib/capistrano/pull.rake
prun-ops-0.0.14 lib/capistrano/pull.rake
prun-ops-0.0.13 lib/capistrano/pull.rake
prun-ops-0.0.12 lib/capistrano/pull.rake
prun-ops-0.0.11 lib/capistrano/pull.rake
prun-ops-0.0.10 lib/capistrano/pull.rake
prun-ops-0.0.9 lib/prun-ops/cap/pull.rb