What is RubyGems?
RubyGems is a handy and powerful Ruby package manager, and Ruby's third-party plugins are managed in gem form, very easy to publish and share, and a simple command can be installed on third-party extensions. Features: Can remotely install packages, the management of dependencies between packages, simple and reliable unloading, query mechanism, can query the local and remote server package information, can maintain a package of different versions, web-based viewing interface, can view the information you installed gem.
Installing RubyGems
Official site Http://rubygems.org/pages/download
: http://rubyforge.org/frs/?group_id=126
Windows users directly download the. zip archive, unzip it, enter the SETUP.RB directory from the cmd prompt window, and run Ruby setup.rb to install it.
Ruby1.9.1 later version comes with RubyGems, enter the command gem update--system directly under the CMD window to upgrade to the latest version.
How to install the Gem package:
Rubygems.org is the official Gem Hosting center, where RubyGems downloads the gem package remotely. RubyGems installs all the gem packages into the/[ruby root]/lib/ruby/gems/[ver]/directory, which includes the cache, doc, gems, specifications 4 Directories, The downloaded native Gem package is placed under the cache, and the extracted gem package is placed under gems. When problems are encountered during installation, you can go to these directories, manually delete the problematic gem package, and then rerun the gem install [gemname] command.
RubyGems Command Detailed:
We take the latest RubyGems 1.8.16 as an example:
# view The version of the RubyGems software
Gem-v
# Update upgrade RubyGems software itself
Gem Update--system
# Update all installed gem packs
$ gem Update
# Update the specified gem package
Note: Gem Update [gemname] does not upgrade an older version of the package, you can use the gem install [gemname]--version=[ver] instead
$ gem Update [Gemname]
# Install the specified gem package, the program will first look up the gem package from this machine and install it, if not locally, from the remote gem.
Gem install [Gemname]
# only install the gem package from the native machine
Gem Install-l [Gemname]
# only remotely install the GEM package
Gem Install-r [Gemname]
# Install the Gem package, but do not install the relevant documentation files
Gem install [gemname]--no-ri--no-rdoc
# Install the specified version of the gem package
Gem install [gemname]--version=[ver]
# Delete the specified gem package, note that this command will remove all installed versions
Gem Uninstall [Gemname]
# Delete a specified version of the gem
Gem Uninstall [Gemname]--version=[ver]
# View all the gem packs that have been installed on this machine
Gem List
# list The gem packs with this keyword on the remote rubygems.org (regular expressions available)
Gem list-r keyword
# List all gmes on remote rubygems.org and save to file.
Gem List-r > Remote_gem_list.txt
#查看所有gem包文档及资料
Gem Server
#显示RubyGem使用帮助
Gem Help
#列出RubyGem命令一些使用范例
Gem Help Example
Go RubyGems Common Commands