You probably want the capture helper which will run a command on the first 
server of a role and return the commands output. 

task :check_svn do
  status = capture(' svn command that returns status')
  # now you can do something with the status. 
  logger.info status
end

If you just want host names

find_servers(:roles => :app).first.host

Or

find_servers(:roles => :app).map(&:host)

On Nov 21, 2011, at 3:23 PM, Rafa García <[email protected]> wrote:

> I did not tested it but I think role.servers gives you the server list for 
> this role.
> 
> Then for every server you can get server.host, server.user, server.por and 
> server.options (defined as attr_reader in server_definition.rb).
> 
> Server also reply to_s method.
> 
> I hope it helps
> 
> 2011/11/21 Craig White <[email protected]>
> Trying to see if I can test & store credentials for both SSH & SVN before 
> actually deploying and thus I would want to be able to derive the 'host' name 
> from capistrano / multi-stage
> 
> so if I have a 'stage' file like RAILS_ROOT/config/deploy/test2.rb and it 
> contains...
> 
> set :deploy_path, "/var/www/ids-staging"
> set :i18n_sub_path, "config/locales"
> 
> role :app, "nxpc.ttinet"
> role :web, "nxpc.ttinet"
> set :group, "www-data"
> 
> How can I get the 'role :app Value?
> 
> simple task...
> 
> task check_svn do
>  a = #{server}
>  p a
> end
> 
> where using a = #{role} gives me
> "app#<Capistrano::Role:0x93da848>web#<Capistrano::Role:0x93da690>" and pretty 
> much everything else I try is a syntax error and I can't script anything with 
> that... I really need the 'hostname'
> 
> --
> Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [email protected]
> 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com
> 
> Need help communicating between generations at work to achieve your desired 
> success? Let us help!
> 
> --
> * 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.com/group/capistrano?hl=en
> 
> -- 
> * 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.com/group/capistrano?hl=en

-- 
* 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.com/group/capistrano?hl=en

Reply via email to