Distributing and Installing Your Code
There are a few parts of using RubyGems we haven’t discussed. We need to consider the metadata that allows the RubyGems ecosystem to know things about our gem. In particular, we want to see how we can inject executables into code that uses our gem and also how our gem declares its dependencies.
RubyGems needs to know information about your project that isn’t contained in the directory structure. Instead, you have to write a short RubyGems specification. Our gem creation tool has already created one with most of the boilerplate at aaagmnr.gemspec. This comes with some lines marked TODO which must be changed before the gem can be used. Here’s the completed file, after the TODO lines have been changed:
Get Programming Ruby 3.3 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.