diff --git a/CHANGELOG b/CHANGELOG index 95eaa2e9..a30c8705 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,12 @@ *1.0.2* *SVN* +* Simplify the generated capistrano.rake file, and make it easier to customize + * Use rake-like command-line semantics ("cap deploy", in addition to "cap -a deploy") * Rename to capistrano -* Make the generated switchtower.rake file use rake namespaces, and include all default tasks +* Make the generated capistrano.rake file use rake namespaces, and include all default tasks * Look for config/deploy.rb, capfile, and Capfile by default diff --git a/lib/capistrano/generators/rails/deployment/templates/capistrano.rake b/lib/capistrano/generators/rails/deployment/templates/capistrano.rake index 1555a91a..ca050bbc 100644 --- a/lib/capistrano/generators/rails/deployment/templates/capistrano.rake +++ b/lib/capistrano/generators/rails/deployment/templates/capistrano.rake @@ -3,7 +3,7 @@ # ============================================================================= # Invoke the given actions via Capistrano -def capistrano_invoke(*actions) +def cap(*parameters) begin require 'rubygems' rescue LoadError @@ -12,25 +12,18 @@ def capistrano_invoke(*actions) require 'capistrano/cli' - options = actions.last.is_a?(Hash) ? actions.pop : {} - - args = %w[-r config/deploy] - verbose = options[:verbose] || "-vvv" - args << verbose - - args.concat(actions.map { |act| ["-a", act.to_s] }.flatten) - Capistrano::CLI.new(args).execute! + Capistrano::CLI.new(parameters.map { |param| param.to_s }).execute! end namespace :remote do <%- config = Capistrano::Configuration.new config.load "standard" - options = { :show_tasks => ", :verbose => ''" } + options = { :show_tasks => ", '-q'" } config.actor.each_task do |info| -%> <%- unless info[:desc].empty? -%> desc "<%= info[:desc].scan(/.*?(?:\. |$)/).first.strip.gsub(/"/, "\\\"") %>" <%- end -%> - task(<%= info[:task].inspect %>) { capistrano_invoke <%= info[:task].inspect %><%= options[info[:task]] %> } + task(<%= info[:task].inspect %>) { cap <%= info[:task].inspect %><%= options[info[:task]] %> } <%- end -%> desc "Execute a specific action using capistrano" @@ -40,7 +33,9 @@ namespace :remote do end actions = ENV['ACTION'].split(",") - capistrano_invoke(*actions) + actions.concat(ENV['PARAMS'].split(" ")) if ENV['PARAMS'] + + cap(*actions) end end