Thanks Jamis, it works great!
Cyrille On Jun 24, 4:17 pm, Jamis Buck <[email protected]> wrote: > Try this: > > role(:web) { ["domain", {:primary => true}] } > > In other words, the block should return an array corresponding to the > arguments you would normally have passed to role(). The first _n_ > elements of the array are domain names to assign to the given role, > and the last option may be a hash containing the properties to set on > those servers (e.g., :primary => true, and so forth). > > - Jamis > > On Tue, Jun 23, 2009 at 5:42 PM,Cyrille<[email protected]> wrote: > > > Thanks Lee, > > > but I need to defer the evaluation of domain (see thread above for > > details), hence the block around domain. > > > The problem is that I can't figure out how to set the primary to true > > while using the "block" syntax... > > > Cheers > > >Cyrille > > > On Jun 23, 10:14 pm, Lee Hambley <[email protected]> wrote: > >> If you have already set domain, do this: > > >> role :web,domain > >> role :app, domain > >> role :db, domain > > >> else, use yours, for the rest, do this: > > >> role :db , domain, :primary => truerole(:db , domain, :primary => true) > >> role(:db , domain, {:primary => true}) > > >> (that is, right, righter and rightest syntax..... Ruby is smart enough to > >> figure out what you need without writing it long hand every time) > > >> 2009/6/23Cyrille<[email protected]> > > >> > Since I spent 30 mins figuring out how this translates in code, maybe > >> > it will help someone else: > > >> > role(:web) {"#{domain}"} > >> > role(:app) {"#{domain}"} > >> > role(:db) {"#{domain}"} > > >> > However, I didn't manage to set :primary to true for the :db role: > > >> > role(:db) {"#{domain}"}, :primary => true > >> > role(:db) {"#{domain}", :primary => true} > > >> > all fail. > > >> > Anyone knows the correct syntax? (it is probably obvious to Capistrano > >> > gurus out there :-) > > >> > Cheers > > >> >Cyrille > > >> > On May 29, 11:23 am, Cynthia Kiser <[email protected]> wrote: > >> > > > It seems that the problem is located here. You are trying to access > >> > > > the > >> > > > domain variable before it is set (the variable will be set only when > >> > the > >> > > > staging task is called, after all the necessary files are parsed. > > >> > > > It is possible to use a block for the role directive, which will be > >> > > > evaluated only when required (that is, during the deploy task, after > >> > the > >> > > > staging task is called), but you can't use blocks for the server > >> > directive. > > >> > > Thanks Jean-Philippe. Changing everything to roles and then using > >> > > blocks > >> > to > >> > > assign "domain" to them allows me to deploy! Yea! > >> > > -- > >> > > Cynthia Kiser > >> > > [email protected] > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Capistrano" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.co.uk/group/capistrano?hl=en -~----------~----~----~----~------~----~------~--~---
