插件和Ruby宝石之间的区别? [英] Difference between plugins and Ruby gems?

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

问题描述

插件和宝石有什么区别?每个的不同用途是什么?在哪里以及为什么要用另一个?

What is the difference between plugins and gems? What are the different uses of each? Where and why would you use one over the other?

推荐答案

宝石


  • Gem是一个使用由 RubyGems 定义的打包系统的打包的ruby应用程序。

  • Rails本身就是一个Gem。

  • Gem is a packaged ruby application using the packaging system defined by RubyGems.
  • Rails itself is a Gem.


Rails gem安装在jruby-1.0 \\ \\ lib \ruby \gems \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ b DIR builtin

68,465 CHANGELOG

DIR configs

DIR 调度
b $ b DIR doc <
DIR 环境

307 fresh_rakefile />
DIR 助手
1,072 MIT-LICENSE

11,969 Rakefile

8,001自述文件
lib目录包含所有gem源代码。


Rails gem is installed in jruby-1.0\lib\ruby\gems\1.8\gems\rails-1.2.3 as:

DIR bin
DIR builtin
68,465 CHANGELOG
DIR configs
DIR dispatches
DIR doc
DIR environments
307 fresh_rakefile
DIR helpers
DIR html
DIR lib
1,072 MIT-LICENSE
11,969 Rakefile
8,001 README
The lib directory contains all the gem source code.


  • 我们可以安装,升级和查询gem版本。如果使用我的 GemInstaller ,可以通过一个简单的配置文件轻松自动安装和加载RubyGems。

  • We can install,upgrade and query the gem version.If one uses a tool like my GemInstaller, one can easily automate the installation and loading of RubyGems with a single simple config file.

    插件


    • 插件是Rails框架的扩展。

    • 无法使用命令进行升级。要升级,必须卸载并安装升级版本。

    • 必须挂钩到rails应用程序中。 (必须有init.rb)
    • 有一个install.rb文件。

    • 插件不能作为Gem发布。

    • 只能在应用程序范围内使用。

      $ b
    • Plugin is an extension of Rails Framework.
    • Can not be upgraded by using a command. To upgrade one have to uninstall and then install upgraded version.
    • Has to be hooked into rails application. (has to have init.rb)
    • Have an install.rb file.
    • Plugin cannot be published as a Gem.
    • Can only be used application wide.

    Goldspike插件安装在vendor \\ \\ plugins \rails-应用程序的集成目录为:

    7,089 build.xml

    1,141 LICENSE.txt

    DIR plugins

    6,675 pom.xml

    1,447自述文件
    DIR 样本

    plugins / goldspike目录包含:
    24 init.rb

    25 install.rb

    DIR lib
    />
    549 Rakefile

    536自述文件
    DIR 任务
    目录

    DIR test

    lib目录包含所有的插件源代码。

    Goldspike plugin is installed in vendor\plugins\rails-integration directory of the application as:
    7,089 build.xml
    1,141 LICENSE.txt
    DIR plugins
    6,675 pom.xml
    1,447 README
    DIR samples
    plugins/goldspike directory consists of
    24 init.rb
    25 install.rb
    DIR lib
    549 Rakefile
    536 README
    DIR tasks
    DIR test
    The lib directory contains all the plugin source code.

    G em vs插件


    • Rails有一种从vendor / plugins /目录加载插件的方法。这很可能会被弃用,因为Rails已经增加了对gem与vendor / gems /目录下的
      项目捆绑的支持。
      rspec的宝石版本是用于日常使用的版本。除非您支持1.2.x系列或更早版本的Rails应用程序,否则应该使用这些应用程序。

    • 使用Gems检入和检出存储库通常会变得更快您并未将该库包含在实际应用程序中。
      使用与分布式团队中的软件版本相关的插件相关的插件通常存在较少问题。

    • 一般的经验法则是将Rails特有的功能作为插件,同时使更多一般的Ruby库转化为宝石。

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

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