Ah, makes sense. Neat workaround. Thanks, Jamis!

Ian

On Sat, Jun 28, 2008 at 7:25 AM, Jamis Buck <[EMAIL PROTECTED]> wrote:
>
> If you declare it as a function, rather than a task, it'll use the
> caller's scope, instead of its own scope. E.g.:
>
>   def echo_bar
>     run "echo bar"
>   end
>
>   task :foo, :roles => :foo do
>     run "echo foo"
>     echo_bar
>   end
>
>   task :bar do
>     echo_bar
>   end
>
> Note that you can't do "cap echo_bar", because echo_bar is not a task,
> so I've kept the :bar task and had it just call the method. That lets
> you call "cap bar", just as before, and have it work as it did before.
>
> - Jamis
>
> On Jun 28, 2008, at 12:12 AM, Ian Sefferman wrote:
>
>>
>> Hi,
>> I've noticed the following behavior:
>>
>> role :foo, "foo"
>> role :bar, "bar"
>> namespace :my_service do
>>  task :foo, :roles => :foo do
>>    run "echo \"foo\n\""
>>    bar
>>  end
>>
>>  task :bar do
>>    run "echo \"bar\n\""
>>  end
>> end
>>
>> If I run foo, bar will be ran for both the :foo and :bar role, which I
>> wouldn't expect. I would expect that the task which is calling another
>> task will be restricting the other task.
>>
>> I ask because one thing I'd like to do is have a few roles and have
>> some, but not all, of the roles update their code (deploy.update), but
>> currently this would always update it for all roles.
>>
>> Is there any workaround for this? Am I missing something obvious?
>>
>> Thanks,
>> Ian
>>
>>
>> --
>> Ian Sefferman
>> http://www.openomy.com | http://www.iseff.com
>>
>> >
>
>
> >
>



-- 
Ian Sefferman
http://www.openomy.com | http://www.iseff.com

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