3

我的gem笔记

 3 years ago
source link: https://yanhaijing.com/tool/2015/08/25/my-gem-note/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
25 August 2015
号外号外:我的新书《React状态管理与同构实战》出版啦!!!快点我查看

由于写博客要用到jekyll,而jekyll是基于ruby的,而gem是ruby的包管理器,所以我需要用到gem这个工具。

237.png

本文将记录一些常用gem命令,以备不时之需(每次都查还烦人)。

更换淘宝镜像

由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败。这里要更换默认镜像为ruby-china的镜像

gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.com/
gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/
# 请确保只有 https://gems.ruby-china.com/
gem -v # 查看RubyGems软件的版本

gem help #显示RubyGem使用帮助
gem help example #列出RubyGem命令一些使用范例

gem install [gemname] # 安装指定gem包,程序先从本机查找gem包并安装,如果本地没有,则从远程gem安装。
gem install -l [gemname] # 仅从本机安装gem包
gem install -r [gemname] # 仅从远程安装gem包
gem install [gemname] --version=[ver] # 安装指定版本的gem包

gem uninstall [gemname] # 删除指定的gem包,注意此命令将删除所有已安装的版本
gem uninstall [gemname] --version=[ver] # 删除某指定版本gem

gem update --system # 更新升级RubyGems软件自身
gem update [gemname] #更新所有|指定已安装的gem包

gem list # 查看本机已安装的所有gem包 #显示RubyGem使用帮助

原文网址:http://yanhaijing.com/tool/2015/08/25/my-gem-note/

微信公众号:颜海镜关注微信公众号 颜海镜微信支付二维码赞赏支持 微信扫一扫

暂无评论,抢沙发!!!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK