rubygem若干常用选项参数
可以用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若干常用选项参数的更多相关文章
- zip命令的常用选项
zip命令的常用选项 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 大家都知道,在linux上一切皆文件,在实际生产环境中,如果我们需要部署一些系统的服务,我们会将一些软件包提前下 ...
- curl常用选项详解
curl常用选项详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 又是下班的时间了,让我们一起来学习一下今天的Linux命令吧~我一半只把自己常用的参数列出来,其他的有但是我们几 ...
- MySQL Backup mysqldump 常用选项与主要用法
The mysqldump client utility performs logical backups, producing a set of SQL statements that can be ...
- mysqldump命令之常用选项
===============================================mysqldump常用选项-h, --host=name:服务器IP-u, --user=name:登录名 ...
- JVM调优系列:(五)JVM常用调试参数和工具
转自:http://blog.csdn.net/opensure/article/details/46715769 JVM常用调试参数: –verbose:gc在虚拟机发生内存回收时在输出设备显示信息 ...
- Hotspot JVM的常用选项
Hotspot JVM的常用选项 选项的分类 Hotspot JVM提供以下三大类选项: 1. 标准选项:这类选项的功能是很稳定的,在后续版本中也不太会发生变化.运行java或者java -help可 ...
- 附1 consul常用命令+常用选项
之后每用到一个command或options,都会记录在这里. 常用命令command: agent 作用:运行一个consul agent join 作用:将agent加入到consul clust ...
- maven常用命令参数
整理了一些maven常用命令参数,以便参考:参考了maven官网和网上其他一些maven追随者的文件,不在此一一列举,但表示感谢! mvn命令参数 mvn -v, --version 显示版本信息; ...
- FPGA综合工具--Synplify Pro的常用选项及命令
最近要用到Synplify,但以前没使用过,无基础,找到一篇帖子,隧保存下来. 本文转自:http://blog.sina.com.cn/s/blog_65fe490d0100v8ax.html Sy ...
随机推荐
- Android必知必会-Stetho调试工具
一.背景 Stetho是 Facebook 出品的一个强大的 Android 调试工具,使用该工具你可以在 Chrome Developer Tools查看APP的布局, 网络请求(仅限使用Volle ...
- 剑指Offer——回溯算法
剑指Offer--回溯算法 什么是回溯法 回溯法实际是穷举算法,按问题某种变化趋势穷举下去,如某状态的变化用完还没有得到最优解,则返回上一种状态继续穷举.回溯法有"通用的解题法"之 ...
- 02基于注解开发SpringMVC项目(jar包,异步,request,参数传递,多选的接收,Model传参,map传参,model传参,ajax,重定向,时间日期转换)
1 所需jar包 项目结构如下: 2 web.xml配置文件的内容如下: <?xmlversion="1.0"encoding="UTF-8"?&g ...
- ios7内购、Game Center 实现 in-App Purchases & Game Center
猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=514 昨天使用ios7SDK b ...
- Android开发优化之——使用软引用和弱引用
Java从JDK1.2版本开始,就把对象的引用分为四种级别,从而使程序能更加灵活的控制对象的生命周期.这四种级别由高到低依次为:强引用.软引用.弱引用和虚引用. 这里重点介绍一下软引用和弱引用. 如果 ...
- octave installation on RHEL6.4
octave installation on RHEL6.4 rhel6.4上安装octave GNU Octave 是一种高级语言,主要设计用来进行数值计算,它是 MathWorks 出品的 Mat ...
- JAVA之旅(二十八)——File概述,创建,删除,判断文件存在,创建文件夹,判断是否为文件/文件夹,获取信息,文件列表,文件过滤
JAVA之旅(二十八)--File概述,创建,删除,判断文件存在,创建文件夹,判断是否为文件/文件夹,获取信息,文件列表,文件过滤 我们可以继续了,今天说下File 一.File概述 文件的操作是非常 ...
- 【一天一道LeetCode】#112. Path Sum
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...
- App会取代网站吗?
本文摘自<程序员的修炼:从优秀到卓越>,购买链接:http://product.china-pub.com/3769829 自1999年以来,不管是作为买家还是卖家,我一直是eBay的热心 ...
- Python 编程常见问题
Python 编程常见问题 经常使用Python编程,把经常遇到问题在这里记录一下,省得到网上查找,因此这篇文章会持续更新,需要的可以Mark一下.进入正题: 1.Python常用的文件头声明 #!/ ...