How to move your rake tasks to the rails lib dir from in a gem generator?

限于喜欢 提交于 2019-12-12 16:18:42

问题


Im creating a custom gem and have some rake files that need to be installed into the users /lib/tasks directory to work. I want create a generator that will move / create my rake tasks in the tasks directory so they can use them.

Does anyone have any idea how do to this in a custom gem?


回答1:


Ensure that your gemspec includes the tasks

and then in your Rakefile

require 'bundler'
Bundler::GemHelper.install_tasks



回答2:


You just need require your rake file in your Rakefile of your root project.



来源:https://stackoverflow.com/questions/3817270/how-to-move-your-rake-tasks-to-the-rails-lib-dir-from-in-a-gem-generator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!