[英]Reusing Ruby code across several Rails applications
I have developed a simple library in Ruby and need to use this in several Rails applications (some of which are not built yet). 我在Ruby中开发了一个简单的库,需要在几个Rails应用程序中使用它(其中一些还没有构建)。 What is the best way to easily add this Ruby library to several Rails applications as and when required?
在需要时,将这个Ruby库轻松添加到多个Rails应用程序的最佳方法是什么? Our team is running Ubuntu and our repository is Mercurial.
我们的团队正在运行Ubuntu,我们的存储库是Mercurial。
Should I use a... 我应该用...
Any pointers would be much appreciated! 任何指针将非常感谢!
Make a gem or a plugin. 制作宝石或插件。 Gems are better in my opinion, easier to manage.
在我看来,宝石更好,更容易管理。
My rule of thumb: 我的经验法则:
If it doesn't depend on rails, make it a gem. 如果它不依赖于铁轨,那就把它变成宝石吧。
If it depends on rails, make it a plugin. 如果它依赖于rails,请将其设为插件。
Make a Rails plugin. 制作一个Rails插件。 It doesn't "support" Mercurial in the sense that you can't do
script/plugin install $REPO_URL
and have it work automatically, but if it's for your own use, then you won't miss that feature. 它不能“支持”Mercurial,因为你不能做
script/plugin install $REPO_URL
并让它自动运行,但如果它是你自己使用的,那么你就不会错过这个功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.