Category: 2. Gems

  • FURTHER READING

    This guide only shows the basics of using the gem command. For information on what’s inside a gem and how to use one you’ve installed see the next section, What is a gem. For a complete reference of gem commands see the Command Reference.

  • FETCHING AND UNPACKING GEMS

    If you wish to audit a gem’s contents without installing it you can use the fetch command to download the .gem file then extract its contents with the unpack command. You can also unpack a gem you have installed, modify a few files, then use the modified gem in place of the installed one: The -I argument adds your unpacked rake…

  • VIEWING DOCUMENTATION

    You can view the documentation for your installed gems with ri:

  • UNINSTALLING GEMS

    Use of common RubyGems commands The gem command allows you to interact with RubyGems. Ruby 1.9 and newer ships with RubyGems built-in but you may need to upgrade for bug fixes or new features. To upgrade RubyGems, visit the download page. If you want to see how to require files from a gem, skip ahead to What is a gem…

  • LISTING INSTALLED GEMS

    The list command shows your locally installed gems: The list includes defaults gems and bundled gems both of which were shipped with Ruby by default. In Ruby 3.1, the default gems are 70 gems in total including bigdecimal, bundler, csv, did_you_mean etc. and the bundled gems are debug, rake etc.

  • REQUIRING CODE

    Use of common RubyGems commands The gem command allows you to interact with RubyGems. Ruby 1.9 and newer ships with RubyGems built-in but you may need to upgrade for bug fixes or new features. To upgrade RubyGems, visit the download page. If you want to see how to require files from a gem, skip ahead to What is a gem…

  • INSTALLING GEMS

    The install command downloads and installs the gem and any necessary dependencies then builds documentation for the installed gems. Here the drip command depends upon the rbtree gem which has an extension. Ruby installs the dependency rbtree and builds its extension, installs the drip gem, then builds documentation for the installed gems. You can disable documentation generation…

  • FINDING GEMS

    The search command lets you find remote gems by name. You can use regular expression characters in your query: If you see a gem you want more information on you can add the details option. You’ll want to do this with a small number of gems, though, as listing gems with details requires downloading more files: You…