Last active
August 29, 2015 14:23
-
-
Save sheharyarn/70fa04dd3647163e89b0 to your computer and use it in GitHub Desktop.
Paperclip Refresh Tasks for Capistrano 3
This file contains hidden or 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
# 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