Created
October 2, 2013 04:53
-
-
Save brucem/6789282 to your computer and use it in GitHub Desktop.
Capistrano recipe to clear the cached repo copy. Handy if you change repos. You'll see a "fatal: Could not parse object" error if you do change git repos and don't clear the cache
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
desc "Clear cached copy" | |
task :clear_cached_copy do | |
cached_copy_path = "#{shared_path}/cached-copy" | |
cached_copy_exists = capture("if [ -d '#{cached_copy_path}' ]; then echo '1'; fi") | |
if cached_copy_exists.to_i == 1 | |
puts "Removing cached copy" | |
run "rm -fR #{cached_copy_path}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment