Each stage essentially becomes it's own task, so in order to invoke a 
task in the environment of a particular stage, you need to specify that 
stage:

   cap production deploy
   cap staging deploy:pending

etc.

- Jamis

On 4/16/09 6:22 PM, Ivar Vasara wrote:
> Jamis,
>
> That looks like a perfect solution. I've followed your suggestion and
> added the after "deploy:update" hook to config/deploy/staging.rb but
> the stage files don't seem to be parsed.  Unfortunately, I haven't
> been able to find any documentation or notes about capistrano-ext
> supporting the various stage files. To be honest, your reply was the
> first I'd heard of the stage file feature, but inspired by your
> solution I poked around and noticed the multistage:prepare task, which
> I must have missed earlier. I started a post here, but figured I
> should poke around the source a bit to understand my issue.. in I got
> to (line 15 from multistage.rb in capistrano-ext on github):
>
>    stages.each do |name|
>      desc "Set the target stage to `#{name}'."
>      task(name) do
>        set :stage, name.to_sym
>        load "#{location}/#{stage}"
>      end
>    end
>
> and it appears that the code inside the second 'do' is never
> executed.. I haven't dug deep enough to know what's wrong but that
> code has been there for ages, so it must be something to do with my
> environment, but I can't tell what. The 'stages' array appears to be
> set correctly by the time it gets to that code, but in config/deploy I
> have three files - dev.rb, staging.rb and production.rb - none of
> which are read.
>
> Any help/pointers appreciated.
>
>
>
>
> On Apr 10, 7:26 am, Jamis Buck<[email protected]>  wrote:
>> Just put your before/after declarations in the corresponding stage file.
>> E.g., in config/deploy/production.rb, say:
>>
>>     after "deploy:update", "upload_static_assets_to_s3"
>>
>> etc.
>>
>> - Jamis
>>
>> On 4/10/09 8:00 AM, ivar vasara wrote:
>>
>>> I've been using Capistrano for some time now, but one thing I haven't
>>> been able to figure out is how to conditionally invoke tasks based on
>>> environment. For example, on production there are additional
>>> configurations to be made and static assets to be uploaded to s3. I'm
>>> using the cap-ext plugin successfully, but being able to add before/
>>> after filters based on environment would be a big win. Is there a
>>> standard way of doing this ?
>>
> >

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