可以用gem help commands看所有支持的参数,这个比gem -h显示的全:

wisy@wisy-ThinkPad-X61:~/src/ruby_src$ gem help commands
GEM commands are:

    build             Build a gem from a gemspec
    cert              Manage RubyGems certificates and signing settings
    check             Check a gem repository for added or missing files
    cleanup           Clean up old versions of installed gems
    contents          Display the contents of the installed gems
    dependency        Show the dependencies of an installed gem
    environment       Display information about the RubyGems environment
    fetch             Download a gem and place it in the current directory
    generate_index    Generates the index files for a gem server directory
    help              Provide help on the 'gem' command
    install           Install a gem into the local repository
    list              Display local gems whose name starts with STRING
    lock              Generate a lockdown list of gems
    mirror            Mirror all gem files (requires rubygems-mirror)
    outdated          Display all gems that need updates
    owner             Manage gem owners of a gem on the push server
    pristine          Restores installed gems to pristine condition from files
                      located in the gem cache
    push              Push a gem up to the gem server
    query             Query gem information in local or remote repositories
    rdoc              Generates RDoc for pre-installed gems
    search            Display remote gems whose name contains STRING
    server            Documentation and gem repository HTTP server
    sources           Manage the sources and cache file RubyGems uses to search
                      for gems
    specification     Display gem specification (in yaml)
    stale             List gems along with access times
    uninstall         Uninstall gems from the local repository
    unpack            Unpack an installed gem to the current directory
    update            Update installed gems to the latest version
    which             Find the location of a library file you can require
    yank              Remove a pushed gem from the index

For help on a particular command, use 'gem help COMMAND'.

Commands may be abbreviated, so long as they are unambiguous.
e.g. 'gem i rake' is short for 'gem install rake'.

windows下gem search默认是查找本地的gem,需要加-R以便查找远程的gem;linux like系统正好相反,默认是查找远程gem,如果要查找本地gem要加--local(或者-l).查询还可以用query选项,和search差不多.

gem list列出本地安装的第三方gem,可以用gem which查看某一个gem的路径:

wisy@wisy-ThinkPad-X61:~/src/ruby_src$ gem list

*** LOCAL GEMS ***

activemodel (4.1.8)
activerecord (4.1.8)
activesupport (4.1.8)
arel (6.0.0, 5.0.1.20140414130214)
bigdecimal (1.2.5, 1.2.4)
builder (3.2.2)
i18n (0.7.0.beta1)
io-console (0.4.2)
json (1.8.1)
md5sum (1.0.2)
minitest (5.4.3, 4.7.5)
net-ntp (2.1.2)
power_assert (0.2.2)
psych (2.0.8, 2.0.5)
rake (10.4.2, 10.1.0)
rdoc (4.2.0, 4.1.0)
RubyInline (3.12.3)
test-unit (3.0.8, 2.1.3.0)
thread_safe (0.3.4)
tzinfo (1.2.2)
webrick (1.3.1)
ZenTest (4.11.0)
zip (2.0.2)
wisy@wisy-ThinkPad-X61:~/src/ruby_src$ gem which zip
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip.rb

如果要看一个gem的详细信息,可以用gem specification,不过返回的是yaml格式,不过ruby中可以轻松将yaml转换为obj,从而用pp显示其"人类可读"内容:

wisy@wisy-ThinkPad-X61:~/src/ruby_src/drb$ gem specification zip>zip.doc
ruby -e"require 'yaml';require 'pp';pp YAML::load(File.read('zip.doc'))"
Gem::Specification.new do |s|
  s.name = "zip"
  s.version = Gem::Version.new("2.0.2")
  s.installed_by_version = Gem::Version.new("0")
  s.authors = ["Postmodern", "Thomas Sondergaard", "Sam Lown"]
  s.date = Time.utc(2010, 5, 26)
  s.description = "zip is a Ruby library for reading and writing Zip files. Unlike the official rubyzip, zip is compatible with Ruby 1.9.1."
  s.email = ["me@samlown.com", "postmodern.mod3@gmail.com"]
  s.extra_rdoc_files = ["ChangeLog.txt", "README"]
  s.files = ["ChangeLog.txt", "README"]
  s.homepage = "http://github.com/postmodern/rubyzip2"
  s.rdoc_options = ["--charset=UTF-8"]
  s.require_paths = ["lib"]
  s.rubygems_version = "2.2.2"
  s.specification_version = 4
  s.summary = "zip is a Ruby library for reading and writing Zip files"
  end

其实specification本身带有一个--ruby输出选项,输出和上面类似:gem specification zip --ruby,如果想查询远程gem的信息可以在后面加-r选项:gem specification xxx_gem --ruby -r

使用install可以从远程安装gem,不过有时候rubygems.org卡的和屎一样,这时要不你用代理,要不你从其他地方下载下来从本地安装:gem install --local xxx_gem.gem

可以用gem 查看某个gem的所有相关文件:

wisy@wisy-ThinkPad-X61:~/src/ruby_src/drb$ gem contents zip
/var/lib/gems/2.1.0/gems/zip-2.0.2/ChangeLog.txt
/var/lib/gems/2.1.0/gems/zip-2.0.2/NEWS.txt
/var/lib/gems/2.1.0/gems/zip-2.0.2/README
/var/lib/gems/2.1.0/gems/zip-2.0.2/Rakefile
/var/lib/gems/2.1.0/gems/zip-2.0.2/TODO.txt
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/ioextras.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/stdrubyext.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/tempfile_bugfixed.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/version.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/zip.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/zipfilesystem.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/lib/zip/ziprequire.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/samples/example.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/samples/example_filesystem.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/samples/gtk_zip.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/samples/write_simple.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/samples/zipfind.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/alltests.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/file1.txt
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/file1.txt.deflatedData
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/file2.txt
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/notzippedruby.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/rubycode.zip
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/rubycode2.zip
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/testDirectory.bin
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/data/zipWithDirs.zip
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/gentestfiles.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/ioextrastest.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/stdrubyexttest.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/zipfilesystemtest.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/ziprequiretest.rb
/var/lib/gems/2.1.0/gems/zip-2.0.2/test/ziptest.rb

最后可以用gem update升级所有本地gem,也可以用gem outdated查看本地需要升级的gem.

rubygem若干常用选项参数的更多相关文章

  1. zip命令的常用选项

    zip命令的常用选项 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 大家都知道,在linux上一切皆文件,在实际生产环境中,如果我们需要部署一些系统的服务,我们会将一些软件包提前下 ...

  2. curl常用选项详解

    curl常用选项详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 又是下班的时间了,让我们一起来学习一下今天的Linux命令吧~我一半只把自己常用的参数列出来,其他的有但是我们几 ...

  3. MySQL Backup mysqldump 常用选项与主要用法

    The mysqldump client utility performs logical backups, producing a set of SQL statements that can be ...

  4. mysqldump命令之常用选项

    ===============================================mysqldump常用选项-h, --host=name:服务器IP-u, --user=name:登录名 ...

  5. JVM调优系列:(五)JVM常用调试参数和工具

    转自:http://blog.csdn.net/opensure/article/details/46715769 JVM常用调试参数: –verbose:gc在虚拟机发生内存回收时在输出设备显示信息 ...

  6. Hotspot JVM的常用选项

    Hotspot JVM的常用选项 选项的分类 Hotspot JVM提供以下三大类选项: 1. 标准选项:这类选项的功能是很稳定的,在后续版本中也不太会发生变化.运行java或者java -help可 ...

  7. 附1 consul常用命令+常用选项

    之后每用到一个command或options,都会记录在这里. 常用命令command: agent 作用:运行一个consul agent join 作用:将agent加入到consul clust ...

  8. maven常用命令参数

    整理了一些maven常用命令参数,以便参考:参考了maven官网和网上其他一些maven追随者的文件,不在此一一列举,但表示感谢! mvn命令参数 mvn -v, --version 显示版本信息; ...

  9. FPGA综合工具--Synplify Pro的常用选项及命令

    最近要用到Synplify,但以前没使用过,无基础,找到一篇帖子,隧保存下来. 本文转自:http://blog.sina.com.cn/s/blog_65fe490d0100v8ax.html Sy ...

随机推荐

  1. 微软在线测试之lucky string,有关斐波那契的题目都在此了

    解决方案: int _tmain(int argc,_TCHAR* argv[]) { size_t fib[] = {1,2,3,5,8,13,21,34}; string str,tempstr; ...

  2. cocos2dx 3.3 C++工程添加lua支持

    准备工作: 1. 拷贝cocos2d-x-3.3rc0\external\lua整个文件夹到项目中(如myProject\cocos2d\external\lua) 2. 拷贝cocos2d-x-3. ...

  3. 为什么不要重载 && 和 || 操作符!!!

    理论知识: 1)&&和 || 是C++中非常特殊的操作符 2)&&和 || 内置实现了短路规则 简单说明一下短路规则. demo1 #include <iostr ...

  4. iOS&nbsp;动画总结—UIView动画

    1.概述 UIKit直接将动画集成到UIView类中,实现简单动画的创建过程.UIView类定义了几个内在支持动画的属性声明,当这些属性发生改变时,视图为其变化过程提供内建的动画支持. 执行动画所需要 ...

  5. (四十一)数据持久化的NSCoding实现 -实现普通对象的存取

    NSCoding可以用与存取一般的类对象,需要类成为NSCoding的代理,并且实现编码和解码方法. 假设类Person有name和age两个属性,应该这样设置类: .h文件: #import < ...

  6. HTML DOCTYPE 的重要性

    定义和用法 <!DOCTYPE> 声明必须是 HTML 文档的第一行,位于 <html> 标签之前. <!DOCTYPE> 声明不是 HTML 标签:它是指示 we ...

  7. 从模板模式到JdbcTemplate

    模板模式初探 关于模板模式,大家可以参阅 模板方法模式深度解析(一) 原始的jdbc 关于原始的jdbc,如下: import java.sql.Connection; import java.sql ...

  8. Ionic APP-Web SPA开发进阶(一)AngularJS全栈工程狮进阶

    AngularJS全栈工程狮进阶 前言 学习了一段时间AngularJS,开始接触移动端APP开发.为了响应公司开发需求,采用"Hybrid"混血开发方法.采用Ionic前端框架, ...

  9. Android轶事之View要去大保健?View大小自己决定?

    -"爹,我要吃糖" -"好哒儿子" -"爹,我要吃包包" - "好哒儿子" - "爹,我要吃串串" ...

  10. (NO.00001)iOS游戏SpeedBoy Lite成形记(二)

    打开SpriteBuilder生成的Xcode项目文件,首先在MainScene添加play回调函数: -(void)play{ CCScene *gameScene = [CCBReader loa ...