How to reuse a task

37 views
Skip to first unread message

Haani Niyaz

unread,
May 16, 2014, 12:48:19 AM5/16/14
to capis...@googlegroups.com
Hi there,

I was wondering if tasks can be written to be used within a different task's on block.

So as an example:

desc "Testing status"
 task :status do
   execute "sudo service nginx status"
 end


desc "Testing get info "
 task :start do
  on roles(:web), in: :sequence do |server|
   capture "hostname"
   # how do I call testing:status here
  end
 end


So as per the code example above, I'd like to call the testing:status task on the same server loop defined in the testing:start task.

As far I know I cannot do an invoke within an on block in capistrano 3.

Versions:
  • Ruby - 2.1.1
  • Capistrano 3.1.0


Lee Hambley

unread,
May 16, 2014, 3:30:40 AM5/16/14
to capistrano

--
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 capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/eb01bc5a-16f7-44e0-be3f-89cf4f1af80c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Haani Niyaz

unread,
May 17, 2014, 11:39:02 PM5/17/14
to capis...@googlegroups.com
Thanks Lee. Will use Ruby methods.
Reply all
Reply to author
Forward
0 new messages