Skip to content

Instantly share code, notes, and snippets.

@cllns
Last active August 29, 2015 14:14
Show Gist options
  • Save cllns/a43e35b5bc96c8fe5b26 to your computer and use it in GitHub Desktop.
Save cllns/a43e35b5bc96c8fe5b26 to your computer and use it in GitHub Desktop.
Capistrano task for pulling attachments from production (namely images with paperclip)
namespace :images do
desc "Pull images from production to dev"
task :pull do
on roles(:app) do
within shared_path do
with rails_env: fetch(:rails_env) do
info "Downloading images"
download! "#{shared_path}/public/assets/**/*.{png,jpg,jpeg,gif}", "public/", recursive: true
end
end
end
end
end
# USAGE:
# cap production images:pull
# (or bundle exec cap production images:pull)
#
#
# Note: it only grabs files ending with png,jpg,jpeg, and gif. Feel free to add your own
# Also note that you do *not* want to grab CSS and JS files, since they'll get included in your local rails dev environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment