Thanks again, Lee.

Is there a way I can generate the nice docs locally on my machine that
I see you the link that you have kindly provided on your server?  I
have Capistrano installed as a gem.

Regards,

Bharat

On 26 Oct, 12:12, "Lee Hambley" <[EMAIL PROTECTED]> wrote:
> Hey Bharat,
>
> With regard to your question about whether or not namespaces are required..
> they aren't ... they do make keeping your code organiesd a lot easier
> though.
>
> The magic tasks that constitute callbacks in 1.4.x are deprecated, and have
> been replaced by the
> before()<http://lee.hambley.name/capistrano-2.5.0/rdoc/classes/Capistrano/Conf...>and
> after()<http://lee.hambley.name/capistrano-2.5.0/rdoc/classes/Capistrano/Conf...>methods
> which are called... as you guesed as such:
>
> after("deploy:update_code", "link_public_dirs")
> after("link_public_dirs", "package_assets")
>
> ... or ...
>
> after("deploy:update_code", "link_public_dirs")
> after("deploy:update_code", "package_assets")
>
> depending how you actually want that to work... be aware, also - that if (as
> you probably are aware) ... you are implicitly inside a transaction{} block,
> and one of your tasks fails, then the whole transaction will be rolled back.
>
> -- Lee H
>
> ---------- Forwarded message ----------
> From: Bharat <[EMAIL PROTECTED]>
> Date: 2008/10/26
> Subject: [Capistrano] Capistrano 2.x best practices for namespaces
> To: Capistrano <[email protected]>
>
> 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