Distributing with RubyGems

RubyGems is the standard way to distribute Ruby apps and libraries; if you have written a Rails app or done any nontrivial Ruby programming, you’ve likely used the gem command to install third-party code onto your system. We used it earlier to install libraries like gli and ronn. RubyGems is designed to make it very simple to install Ruby code, and this includes command-line applications. For example, rake, the standard Ruby build tool, can be installed via RubyGems like so:

 $ ​​sudo​​ ​​gem​​ ​​install​​ ​​rake
 Installing rake 10.1.0.......
 $ ​​rake​​ ​​-V
 rake, version 10.1.0

In addition to painlessly installing and updating Ruby applications, RubyGems is also used to install an app’s dependencies. Suppose, ...

Get Build Awesome Command-Line Applications in Ruby 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.