views:

164

answers:

2

I want to convert rails plugin into gem.

Is there any way to make gem to auto add rake tasks and capistrano recipes when mentioned in environment.rb using config.gem command?

+1  A: 

As far as I know, a gem cannot define tasks or capistrano recipes directly, but may be used within tasks and recipes.

If you need something that is a gem and still has rake tasks and recipes, you may want to look at the approach used by HAML. When you install the gem, you still need to install a plug-in, even though the "plugin" is simply a hook to load the gem.

tadman
+1  A: 

As tadman said, you cannot do it. However, you can either install a plugin or ask the user to require your tasks in the Rakefile, as collectiveidea-delayed_job does.

Evgeny Shadchnev