gem 和插件有什么区别? [英] what's the difference between gem and plugin?

查看:45
本文介绍了gem 和插件有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Rails 的新手,我对 gems 的概念感到困惑 &插件.谁能帮我解释一下?

I'm new to Rails and I'm confused about concept of gems & plugins. Can anyone explain them for me?

推荐答案

插件只是从特定目录加载的库,gem 通过 BundlerRubyGems 直接.

Plugins are just libraries loaded from a specific directory, gems are loaded via Bundler or RubyGems directly.

真正产生差异的是维护和管理.当您想要最新最好的 authlogic 插件时会发生什么,那么您需要更新目录中的文件.当它是一个插件时,这听起来并没有那么糟糕,但是不断更新的东西呢?曾经/现在有一个代码打包和分发系统 (RubyGems),它有助于管理此类事情.

Where this really makes a differences is maintenance and management. What happens when you want the latest and greatest authlogic plugin, well you need to update the files in your directory. That doesn't sound so bad when it's one plugin, but what about something that constantly updates? There was/is an existing system for code packaging and distribution (RubyGems), which lends itself to managing such things.

再次考虑 authlogic 示例,如果新版本现在需要其他一些依赖项,会发生什么情况?使用 RubyGems,gem 文件明确定义了这种关系,而插件系统没有,这样的定义将是多余的.

Consider the authlogic example again, what happens if the new version requires some other dependency now? With RubyGems the gem file explicitly defines that relationship, the plugin system does not and such a definition would've been redundant.

随着 Rails 3.x 中 Bundler 的出现,管理和分发项目中的 gem 变得非常容易使用.

With the advent of Bundler in rails 3.x it's become very easy to manage and distribute the gems that your project uses.

TL;DR:插件基本上是没有包装信息的宝石.

TL;DR: Plugins are basically gems without the packaging information.

这篇关于gem 和插件有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆