Wrap capistrano version 3 tasks in a gem

146 views
Skip to first unread message

Mathieu Allaire

unread,
Dec 8, 2013, 10:27:53 AM12/8/13
to capis...@googlegroups.com
Hi there, I'm using Capistrano 3, and I would like to wrap my tasks (recipes) and templates in a gem, so I wouldn't have to duplicate that in every rails project.

A quick GitHub search returned a lot of different ways (not sure the best one), and mostly using Capistrano 2 (probably changed in Cap 3).

Anybody can point me to the right direction to wrap my stuff in a gem using Cap 3 ?

Thank you!

Yagnik Khanna

unread,
Dec 9, 2013, 10:21:07 AM12/9/13
to capis...@googlegroups.com
You can add your task under any directory structure and load it like so: 
Dir.glob('capistrano/tasks/*.cap').each { |r| load r }
As long as all the tasks hook into the current capistrano flow such as after deploy:started, my_namespace:my_task
Capistrano will hook it into it's flow.

Lee Hambley

unread,
Dec 9, 2013, 10:24:04 AM12/9/13
to capistrano
Just look at capistrano-rbenv, capistrano-rails, capistrano-bundler and friends, they are all Gems that just addd tasks and some even add new config items.

--
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/7b7b865c-44b2-44e5-a259-37cf9903b658%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages