Thanks Lee. *Capistrano.env.server(name, properties)* works fine!

def cap_servers(roles=nil)
   my_servers.each { |ip_addr|
       *server* ip_addr, { :roles => (roles || %w{app}) }
   }
end


Br,
Faissal

On Tuesday, December 1, 2015 at 7:11:33 PM UTC+1, Lee Hambley wrote:
>
> Check out 
> https://github.com/capistrano/capistrano/blob/80459d88da3d39981cf85c5dc35447ad2b20b618/lib/capistrano/dsl/env.rb#L71
>  
> and 
> https://github.com/capistrano/capistrano/blob/80459d88da3d39981cf85c5dc35447ad2b20b618/lib/capistrano/dsl/env.rb#L43
>  
> which should lead you to the conclusion that Capistrano.env.server(...) 
> should work for accessing this method outside the DSL, but it's 
> unsupported, and I never tried it!
>
> Let me know if it works?
>
> Lee Hambley
> http://lee.hambley.name/
> +49 (0) 170 298 5667
>
> On 1 December 2015 at 18:46, Lee Hambley <[email protected] <javascript:>
> > wrote:
>
>> Did you check the implementation of server in the "DSL" file?
>> On 1 Dec 2015 6:34 p.m., "Faissal Elamraoui" <[email protected] 
>> <javascript:>> wrote:
>>
>>> Hello everyone,
>>>
>>> I have a list of IP addresses which i iterate over to declare Capistrano 
>>> servers (*outside any DSL context*) and i'm wondering how can i pass 
>>> roles as a parameter:
>>>
>>> def cap_servers(roles=nil)
>>>    my_servers.each { |ip_addr|
>>>        *server* ip_addr, roles || %{:app}
>>>    }
>>> end
>>>
>>> am I doing it correctly?
>>>
>>>
>>> Thanks,
>>> Faissal
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Capistrano" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To view this discussion on the web, visit 
>>> https://groups.google.com/d/msgid/capistrano/e076294c-c82c-44b9-af6e-cb7aa6213f88%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/capistrano/e076294c-c82c-44b9-af6e-cb7aa6213f88%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/capistrano/45a12d47-2f4a-41e6-823f-7e781ea347e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to