1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Simplify the generated capistrano.rake file

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@3796 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2006-03-06 17:47:42 +00:00
parent 5030f20252
commit edfccb39c5
2 changed files with 10 additions and 13 deletions

View file

@ -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

View file

@ -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