Sha256: c5f6716722c23fb19e838ab40856116804bc654a5e9d6bebcf4871b1ea67f6f6

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

namespace :files do
  desc 'Download remote shared files to local machine.'
  task :download, :path do |task, args|

    if args[:path].nil?
      puts "You should provide the file path.\nExample: `cap #{fetch(:stage)} \"files:download[config/database.yml]\"`"
      puts "If you want to download share folder use next: `cap #{fetch(:stage)} \"files:download[.]\"`"
      exit
    end

    on primary fetch(:migration_role) do
      info "Started downloading remote file '#{args[:path]}'"
      within shared_path do
        archive_path = '/tmp/download.tar'
        info "Archive to #{archive_path}"
        execute :tar,  '-cvf', archive_path, args[:path]
        info 'Downloading...'
        download! archive_path, '.', recursive: true, verbose: true
        info "Remove archive file #{archive_path}"
        execute :rm, archive_path
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
j-cap-recipes-0.0.18 lib/j-cap-recipes/tasks/files.rake
j-cap-recipes-0.0.17 lib/j-cap-recipes/tasks/files.rake