From 1c65d210ad347132ff7c9d6f5716fb8d80dfe076 Mon Sep 17 00:00:00 2001 From: seenmyfate Date: Sun, 24 Mar 2013 17:51:23 +0000 Subject: [PATCH] auto load scm tasks based on :scm value --- README.md | 5 +++-- lib/capistrano/setup.rb | 1 + lib/capistrano/templates/deploy.rb.erb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6aa63c22..7c83d005 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ TODO: - [x] basic configuration object - [x] basic 'capistrano/deploy' noop example - - [x] don't care too much about testing at this point (rspec included for my reference) - [x] before/after task hooks - [x] handle multi stage @@ -31,9 +30,11 @@ TODO: - [x] basic rollback - [x] support primary servers `on primary :db` - [x] rails specific tasks (see [here](https://github.com/seenmyfate/capistrano-rails)) - - [ ] auto load tasks for scm based on variable + - [x] auto load tasks for scm based on variable + - [ ] run locally - [ ] better descriptions for tasks - [ ] add examples to README + - [ ] add task packaging run through ## Installation diff --git a/lib/capistrano/setup.rb b/lib/capistrano/setup.rb index fe549209..282c9f58 100644 --- a/lib/capistrano/setup.rb +++ b/lib/capistrano/setup.rb @@ -6,6 +6,7 @@ stages.each do |stage| Rake::Task.define_task(stage) do load "config/deploy.rb" load "config/deploy/#{stage}.rb" + load "capistrano/#{fetch(:scm)}.rb" set(:stage, stage.to_sym) configure_backend end diff --git a/lib/capistrano/templates/deploy.rb.erb b/lib/capistrano/templates/deploy.rb.erb index d8a470ae..7aca95e9 100644 --- a/lib/capistrano/templates/deploy.rb.erb +++ b/lib/capistrano/templates/deploy.rb.erb @@ -1,7 +1,7 @@ set :application, 'my app name' set :repo, 'git@example.com:me/my_repo.git' -ask :branch, Proc.new { `git rev-parse --abbrev-ref HEAD`.chomp } +ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } # set :deploy_to, '/var/www/my_app' # set :scm, :git