I want to convert rails plugin into gem.
Is there any way to make gem to auto add rake tas开发者_C百科ks and capistrano recipes when mentioned in environment.rb
using config.gem
command?
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.
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.
精彩评论