Sha256: fcf0d68829c3d412c779a1c1db1f1809354921c98953a71551dc4f84bcabcdec

Contents?: true

Size: 870 Bytes

Versions: 4

Compression:

Stored size: 870 Bytes

Contents

namespace :files do
  desc 'Downlaod 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

4 entries across 4 versions & 1 rubygems

Version Path
j-cap-recipes-0.0.16 lib/j-cap-recipes/tasks/files.rake
j-cap-recipes-0.0.15 lib/j-cap-recipes/tasks/files.rake
j-cap-recipes-0.0.14 lib/j-cap-recipes/tasks/files.rake
j-cap-recipes-0.0.13 lib/j-cap-recipes/tasks/files.rake