Skip to content

Instantly share code, notes, and snippets.

@knoxjeffrey
Created October 23, 2018 23:19
Show Gist options
  • Save knoxjeffrey/7f4bd69f6cd3c387068d16236a42e674 to your computer and use it in GitHub Desktop.
Save knoxjeffrey/7f4bd69f6cd3c387068d16236a42e674 to your computer and use it in GitHub Desktop.
Pull media from specified environment to development
# rake media:pull[<environment to pull from>]
# eg. rake media:pull[staging]
namespace :media do
desc 'Pull media from specified environment to development'
task :pull, :environment do |_t, args|
environment = args[:environment].to_sym
ssh = Rails.application.credentials[environment][:ssh]
ssh_port = Rails.application.credentials[environment][:ssh_port]
media_remote = Rails.application.credentials[environment.to_sym][:media_remote]
puts 'Copying media from specified environment...'
system "scp -r -P #{ssh_port} #{ssh}:#{media_remote}/current/public/uploads/store/mediaupload/ #{Rails.root}/public/uploads/store/"
puts 'Done!'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment