Excerpt from deploy.rb
task :prod1 do set :deploy_to, "/home/project/src/prod1" end task :prod2 do set :deploy_to, "/home/project/src/prod2" end
I have 2 tasks as above. Now, instead of manually starting "cap prod1 deploy" or "cap prod2 deploy", I want to create a task "prod" that sets the required "deploy_to" based on the existence of the file on the server.
sort of:
task :prod do if (A_FILE_IN_SERVER_EXISTS) set :deploy_to, "/home/project/src/prod2" else set :deploy_to, "/home/project/src/prod1" end
How to do it?
source share