Last active
August 29, 2015 14:23
-
-
Save bestlong/638402be69649ddac181 to your computer and use it in GitHub Desktop.
Touches all linked files if not exist, use Capistrano 3.4.0
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
### part of config/deploy.rb | |
namespace :deploy do | |
namespace :check do | |
# desc 'Touches all linked files' | |
task :touch_all_linked_files do | |
on release_roles :all do | |
fetch(:linked_files, []).each do |file| | |
target = shared_path.join(file) | |
unless File.file?(target) | |
info "File.file?('#{target}') : #{File.file?(target)}" | |
execute :touch, target | |
info "Touched : #{target}" | |
end | |
end | |
end | |
end | |
end | |
before 'deploy:check:linked_files', 'deploy:check:touch_all_linked_files' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File.file?() is running at local, not remote, so always get false.
need change to above:
unless test("[ -f #{target} ]")
end