Ruby Gem command and rubygem command
I. Introduction
Gem is a standard package for managing Ruby libraries and programs. It is very convenient to find, install, upgrade, and uninstall software packages through Ruby Gem (such as http://rubygems.org/) sources. Ruby Gem is installed in Ruby 1.9.2 by default. If you are using another release version, install Ruby Gem on your own.
All the gem packages will be installed in the/[Ruby root]/lib/ruby/gems/[ver]/directory, this includes four directories: Cache, doc, gems, and specifications. Place the downloaded native gem package under the cache, and place the decompressed gem package under gems. When problems occur during installation, you can enter these directories, manually delete the problematic gem package, and then run the gem install [gemname] command again.
Ii. Installation
Two installation methods
Method 1: Install using yum
yum install rubygems
Method 2: source code Installation
Resource download: rubygems-2.4.6.tgz
https://rubygems.org/pages/download
Install
tar –zxvf rubygems-2.4.6.tgzcd rubygems-2.4.6ruby setup.rb
Iii. Instances
1) view all installed gem packages on the local machine
$ gem list [--local]
2) install the gem package from the Local Machine
$ gem install -l [gemname].gem
3) install the Gem package from the gem Source
$ gem install [gemname]
4) install the gem package of the specified version
$ gem install [gemname] --version=[ver]
5) Update the Gem itself (Note: In some linux distributions, this command is not allowed to be executed for system stability)
$ gem update --system
6) update all installed gem packages
$ gem update
7) update the specified gem package (Note: gem update [gemname] will not upgrade the earlier version of the package, you can use gem install [gemname] -- version = [ver] Instead)
$ gem update [gemname]
8) Delete the specified gem package. Note that this command will delete all installed versions.
$ gem uninstall [gemname]
9) delete a specified version of gem
$ gem uninstall [gemname] --version=[ver]