Hello,
I am migrating a Capistrano 1.4.1 application to 2.5.0.  Towards that,
I want to follow the best practices for Capistrano 2 deployment.  I
have the following callback tasks in my Capistrano 1.4.1 deploy.rb
amongst others:

desc "Execute something with sudo so that it doesn't get stuck waiting
for a password later"
task :before_update_code do
  sudo "date"
end

task :after_update_code do
  link_public_dirs
  package_assets
end

desc "Link up any public directories."
task :link_public_dirs, :roles => [:app] do
  run "test -d #{release_path}/tmp || mkdir -p #{release_path}/tmp"
  if app_symlink_dirs || app_upload_dir
    (app_upload_dir.to_a + (app_symlink_dirs || [])) .each do |link|
       target_in_shared = "#{shared_path}/#{link.split("/").last}"
       run "rm -f #{release_path}/#{link}"
       run "ln -nfs #{target_in_shared} #{release_path}/#{link}"
    end
  end
end

desc "Minify and merge assets"
task :package_assets, :roles => :web do
  run <<-EOF
    cd #{release_path} &&
    rake RAILS_ENV=#{rails_env} asset:packager:build_all
  EOF
end

As you can see, none of them belong to a namespace, a concept that was
introduced in Capistrano 2.x.  My question is: how should I rename/
package these tasks under a namespace to confirm to Capistrano 2 best
practices.  Another follow up question is: is it necessary to do so?

The reason I ask the follow up question is that Obie Fernandez in his
excellent Rails Way text shows that you don't have to put the
callbacks (:before_update_code, :after_update_code) in a namespace --
see pages 693 and 694.  But what about the link_public_dirs and
package_assets tasks which are being called from :after_update_code
callback, should they not be packaged under a namespace?  If yes then
can someone show a snippet please?

Another confusion that I have is that when to use
task :after_update_code do

end

callback or when to say

after "deploy:update", :link_public_dirs

Are they the same?  If yes then what should I do to call multiple
tasks such as:

task :after_update_code do
  link_public_dirs
  package_assets
end

What is the equivalent syntax in

after "deploy:update", task1, task2 ???

Or are we talking about two different things here?

A lot of questions, but I thought I will ask more experienced people
here.

Thanks in advance for your time.

Bharat


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to