[英]Rails 3: What is the difference between an Engine and a Gem?
两者之间有什么区别,何时应该使用另一个而不是另一个?
An Engine
in rails terminology is a actually a subapplication of a web-application. rails术语中的Engine
实际上是Web应用程序的子应用程序。 For instance, something like a blog, a forum, or simple authentication: these are not full-blown applications, but pages/views/controllers/models that can be added to any rails application. 例如,博客,论坛或简单身份验证:这些不是完整的应用程序,而是可以添加到任何rails应用程序的页面/视图/控制器/模型。
In rails2 this would be done using a plugin
. 在rails2中,这将使用plugin
完成。 Now since rails3 an engine can be packaged in a gem
. 现在因为rails3引擎可以包装在gem
。
A gem
is a ruby library, which can be found on http://rubygems.org and it is the standard (only) way to package and distribute ruby code to other rubyists. gem
是一个ruby库,可以在http://rubygems.org上找到,它是将ruby代码打包并分发给其他rubyists的标准(唯一)方法。
So to conclude: 总结如下:
So when will you use one or the other: 所以你什么时候使用其中一个:
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.