gem
Gem is a command-line tool in Ruby programming language used for managing RubyGems, which are packages or libraries used by Ruby. It comes bundled with Ruby and is used to install, uninstall, and manage RubyGems.
Using the gem
command without any arguments displays a list of options and commands available. Some commonly used commands include install
, uninstall
, list
, update
, search
, and build
.
With the install
command, users can install RubyGems from the RubyGems repository, specifying the gem name and optional version requirements.
Uninstalling RubyGems can be done using the uninstall
command, either with the gem name, version, or both.
The list
command provides a list of installed gems along with their versions, while the update
command updates installed gems to their latest versions.
Searching for gems based on a specified criteria is possible using the search
command.
Users can also build their own gems using the build
command, creating a .gem file that can be installed later.
Gem also allows specification of gem sources, which are different repositories where RubyGems are located, using the source
command.
Additionally, Gem offers several options and flags that can be used with the different commands to customize the behavior, such as the --remote
flag to perform operations on remote gems and the --no-ri
flag to skip generation of RI documentation.
Overall, Gem is a versatile and essential tool for managing RubyGems, allowing developers to easily add, remove, update, and search for gems in their Ruby projects.
List of commands for gem:
-
gem:tldr:636e2 gem: Install specific version of a gem.$ gem install ${gemname} --version ${1-0-0}try on your machineexplain this command
-
gem:tldr:6a91e gem: Search for remote gem(s) and show all available versions.$ gem search ${regular_expression} --alltry on your machineexplain this command
-
gem:tldr:8369f gem: Install the latest matching (SemVer) version of a gem.$ gem install ${gemname} --version '~> ${1-0}'try on your machineexplain this command
-
gem:tldr:8b664 gem: Uninstall specific version of a gem.$ gem uninstall ${gemname} --version ${1-0-0}try on your machineexplain this command
-
gem:tldr:9fb8c gem: Uninstall a gem.$ gem uninstall ${gemname}try on your machineexplain this command
-
gem:tldr:d9209 gem: Install the latest version of a gem.$ gem install ${gemname}try on your machineexplain this command