diff --git a/config/deploy.rb b/config/deploy.rb index 76a42a3f4..1d090b2cc 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -18,6 +18,21 @@ set :scm_verbose, true set :repository_cache, "remote_cache" set :deploy_via, :checkout +# Bonus! Colors are pretty! +def red(str) + "\e[31m#{str}\e[0m" +end + +# Figure out the name of the current local branch +def current_git_branch + branch = `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\/heads\//, '') + puts "Deploying branch #{red branch}" + branch +end + +# Set the deploy branch to the current branch +set :branch, current_git_branch + namespace :deploy do task :symlink_config_files do run "ln -s -f #{shared_path}/config/database.yml #{current_path}/config/database.yml"