Sha256: edb77fe9ddffde5b9196c19085e5dac28383c2f2c437c114ef9ee62ccf4d34e8

Contents?: true

Size: 1.04 KB

Versions: 7

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 "files:pull"
    invoke "db:pull"
  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

7 entries across 7 versions & 1 rubygems

Version Path
prun-ops-0.0.8 lib/prun-ops/cap/pull.rb
prun-ops-0.0.7 lib/prun-ops/cap/pull.rb
prun-ops-0.0.6 lib/prun-ops/cap/pull.rb
prun-ops-0.0.5 lib/prun-ops/cap/pull.rb
prun-ops-0.0.4 lib/prun-ops/cap/pull.rb
prun-ops-0.0.3 lib/prun-ops/cap/pull.rb
prun-ops-0.0.2 lib/prun-ops/cap/pull.rb