Merge pull request #671 from disconn3ct/deploy-current-branch

deploy the currently checked-out branch
This commit is contained in:
Daniel Grippi 2011-07-06 10:07:44 -07:00
commit 030e7663f4

View file

@ -18,6 +18,21 @@ set :scm_verbose, true
set :repository_cache, "remote_cache" set :repository_cache, "remote_cache"
set :deploy_via, :checkout 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 namespace :deploy do
task :symlink_config_files do task :symlink_config_files do
run "ln -s -f #{shared_path}/config/database.yml #{current_path}/config/database.yml" run "ln -s -f #{shared_path}/config/database.yml #{current_path}/config/database.yml"