RubyGems packages and distributes Ruby libraries and applications as .gem files. Ruby installs several gems by default, and installed gems become available for Ruby programs to use. section 1.2.4
Use RubyGems to install packages, resolve dependencies, and load selected libraries:
- Run `gem install gemname` to download a gem and any required dependencies from rubygems.org; use a local .gem path for a local package, `-l` for local-only operations, or `-r` for remote-only operations. section 1.4.4
- Load an installed library with `require`, even though its directory is not initially visible in Ruby's load path. section 1.4.4
- Select a particular installed version with `gem "name", "version"` before requiring or using the library. section 1.4.4
- Use Bundler to track a project's exact gems and versions, resolve dependencies, and run commands through the resulting bundle. section 1.4.4
Installing and using a library
Installing `prawn` downloads version 2.5.0 and its dependencies. Ruby can then load it with `require "prawn"`; selecting `gem "prawn", "2.2.0"` changes the library directory added to the load path. section 1.4.4
$ gem install prawn
Try the basic package-installation command that starts the RubyGems workflow. section 1.4.4
