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

Added opt-in "compat" and "upgrade" recipes for tasks to aid in the upgrade process to Capistrano 2

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@6467 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2007-03-27 05:17:33 +00:00
parent 09ad893c19
commit 5a893823a2
4 changed files with 75 additions and 1 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Added opt-in "compat" and "upgrade" recipes for tasks to aid in the upgrade process to Capistrano 2 [Jamis Buck]
* The deployment recipes are now opt-in. Just do 'load "deploy"' in your recipe script. [Jamis Buck]
* Added $CAPISTRANO:HOST$ placeholder in commands, which will be replaced with the name of the host on which the command is executing [Jamis Buck]

View file

@ -44,7 +44,7 @@ puts "[done] deployified!"
__END__
#file: Capfile
require 'capistrano/version'
load 'deploy' if Capistrano::Version::MAJOR >= 2 || Capistrano::Version::MAJOR == 1 && Capistrano::Version::MINOR >= 99
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
#file: config/deploy.rb

View file

@ -0,0 +1,41 @@
# A collection of compatibility scripts, to ease the transition between
# Capistrano 1.x and Capistrano 2.x.
# Depends on the deployment system
load 'deploy'
desc "DEPRECATED: See deploy:pending:diff."
task :diff_from_last_deploy do
warn "[DEPRECATION] `diff_from_last_deploy' is deprecated. Use `deploy:pending:diff' instead."
deploy.pending.diff
end
desc "DEPRECATED: See deploy:update."
task :update do
warn "[DEPRECATION] `update' is deprecated. Use `deploy:update' instead."
deploy.update
end
desc "DEPRECATED: See deploy:update_code."
task :update_code do
warn "[DEPRECATION] `update_code' is deprecated. Use `deploy:update_code' instead."
deploy.update_code
end
desc "DEPRECATED: See deploy:symlink."
task :symlink do
warn "[DEPRECATION] `symlink' is deprecated. Use `deploy:symlink' instead."
deploy.symlink
end
desc "DEPRECATED: See deploy:restart."
task :restart do
warn "[DEPRECATION] `restart' is deprecated. Use `deploy:restart' instead."
deploy.restart
end
desc "DEPRECATED: See deploy:rollback."
task :rollback do
warn "[DEPRECATION] `rollback' is deprecated. Use `deploy:rollback' instead."
deploy.rollback
end

View file

@ -0,0 +1,31 @@
# Tasks to aid the migration of an established Capistrano 1.x installation to
# Capistrano 2.x.
namespace :upgrade do
desc "Migrate from the revisions log to REVISION. Capistrano 1.x recorded each \
deployment to a revisions.log file. Capistrano 2.x is cleaner, and just puts \
a REVISION file in the root of the deployed revision. This task migrates \
from the revisions.log used in Capistrano 1.x, to the REVISION tag file used \
in Capistrano 2.x. It is non-destructive and may be safely run any number of \
times."
task :revisions do
revisions = capture("cat #{deploy_to}/revisions.log")
mapping = {}
revisions.each do |line|
revision, directory = line.chomp.split[-2,2]
mapping[directory] = revision
end
commands = mapping.keys.map do |directory|
"echo '.'; test -d #{directory} && echo '#{mapping[directory]}' > #{directory}/REVISION"
end
command = commands.join(";")
run "cd #{releases_path}; #{command}; true" do |ch, stream, out|
STDOUT.print(".")
STDOUT.flush
end
end
end