Created
October 23, 2018 23:19
-
-
Save knoxjeffrey/7f4bd69f6cd3c387068d16236a42e674 to your computer and use it in GitHub Desktop.
Pull media from specified environment to development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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