Ruby RubyGems


Release date:2023-11-04 Update date:2023-11-04 Editor:admin View counts:443

Label:

Ruby RubyGems

RubyGems is a package manager for Ruby that provides a standard format for distributing Ruby programs and libraries, as well as a tool for managing package installations.

RubyGems is designed to easily manage gem the tools that are installed,and for distribution gem the server. This is similar to apt-get under Ubuntu, Centos yum , Python’s pip .

RubyGems was founded around November 2003 and has been part of the Ruby standard library since Ruby version 1.9.

If your Ruby is lower than version 1.9, you can also install it manually:

Update RubyGems command:

$ gem update --system          # Administrator or root user required

Gem

Gem is the package manager for the Ruby module (called Gems). It contains package information, as well as files for installation.

Gem is usually built on the “.gemspec” file, which contains a YAML file with information about Gem. Ruby code can also build Gem directly, which is usually done using Rake.

Gem command

gem commands are used to build, upload, download, and install Gem packages.

Gem usage

RubyGems is functionally very similar to apt-get, portage, yum, and npm.

Installation:

gem install mygem

Uninstall:

gem uninstall mygem

List what has been installed gem :

gem list --local

List what is available gem , for example:

gem list --remote

For all gems create an RDoc document:

gem rdoc --all

Download one gem , but do not install:

gem fetch mygem

From the available gem search in, for example:

gem search STRING --remote

Construction of gem package

gem commands are also used to build and maintain .gemspec and .gem files.

Utilization .gemspec file construction .gem :

gem build mygem.gemspec

Modify domestic sources

Due to domestic network reasons (you know), the intermittent connection of the resource files stored in rubygems.org on Amazon S3 failed.

So you will meet with gem install rack or bundle install when there is no response for half a day, you can use the gem install rails -V to view the execution process.

So we can modify it to the domestic download source: https://gems.ruby-china.com

Powered by TorCMS (https://github.com/bukun/TorCMS).