Skip to content

Instantly share code, notes, and snippets.

@sheharyarn
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheharyarn/70fa04dd3647163e89b0 to your computer and use it in GitHub Desktop.
Save sheharyarn/70fa04dd3647163e89b0 to your computer and use it in GitHub Desktop.
Paperclip Refresh Tasks for Capistrano 3
# Put this in your rails_app/lib/capistrano/tasks/paperclip.rake
namespace :paperclip do
namespace :refresh do
desc "Refresh All Paperclip Styles (Must Specify 'CLASS' parameter)"
task :all do
if ENV['CLASS']
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, "paperclip:refresh CLASS=#{ENV['CLASS']}"
end
end
end
else
puts "\n\nFailed! You need to specify the 'CLASS' parameter!",
"Usage: cap <stage> paperclip:refresh:all CLASS=YourClass"
end
end
desc "Refresh Missing Paperclip Styles"
task :missing do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, "paperclip:refresh:missing_styles"
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment