如何将你的rake任务从gem生成器移动到rails lib目录中? [英] How to move your rake tasks to the rails lib dir from in a gem generator?
本文介绍了如何将你的rake任务从gem生成器移动到rails lib目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建一个自定义gem,并且有一些rake文件需要安装到users / lib / tasks目录才能工作。我想创建一个生成器,它将在任务目录中移动/创建我的耙子任务,以便他们可以使用它们。
有没有人知道如何在自定义gem?
解决方案
确保您的gemspec包含任务
和然后在你的Rakefile中
$ pre $ $ $ c $ require'bundler'
Bundler :: GemHelper.install_tasks
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?
解决方案
Ensure that your gemspec includes the tasks
and then in your Rakefile
require 'bundler'
Bundler::GemHelper.install_tasks
这篇关于如何将你的rake任务从gem生成器移动到rails lib目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文