What you'll learn

  • How to Build a Ruby Gem

    The book will guide you through the process of how to build a Ruby Gem. From bootstrapping the project to releasing to RubyGems.org, you're only a few steps away from publishing a Ruby gem.

  • Rails Integration

    Rails provides a variety of lifecycle hooks to integrate functionality in to the framework, but not all of these hooks are well documented. We'll cover the basics to get you started creating gems that include view helpers, asset inclusions, and shared Active Record scopes.

  • Open source collaboration

    Managing and contributing to an open source project can be complex. This guide will help you manage the expectations and collaboration of a successful open source project.

  • Configuration Patterns

    Whether it's configuration patterns or testing best practices, writing code for a Ruby gem is unique. You'll learn techniques to manage and minimize this complexity for good.

  • Modular Ruby code

    The file conventions used within a Ruby gem are common to well organized Ruby applications. The guide will address best practices related to loading dependencies and testing modular Ruby code.

  • Increased Understanding of Bundler

    Bundler is a powerful gem that allows Ruby developers to easily mananage dependencies. Learn about some lesser known features of Bundler to help you ease the pain of common Ruby gem maintenance tasks.

Build a Ruby gem is an absolute gem! It is a great intro to the open source world and Ruby gem patterns. Both beginner and advanced programmers will learn something new.
Jearvon Dharrie
Jearvon Dharrie
Rubyist & Philly.rb organizer
I found Build a Ruby Gem to be a really useful resource in understanding how gems work and how best to build them. In particular I thought there was a lot of good "real world tips" to make the process go more smoothly.
Rory McCune
Rory McCune
Director at ScotSTS Limited
Build a Ruby Gem is a well-written and comprehensive book about creating Ruby gems the right way. Brandon's book is the best resource available to strengthen your Ruby Gem foo.
Andy Wenk
Andy Wenk
Rubyist & Project Lead at sum.cumo
Build a Ruby Gem gave me useful information not only about how to create a gem, but other information like semantic versioning, committing to open source projects and well-structured Ruby code. Without reading this book, I wouldn't have gotten in to building Ruby gems.
Tsubasa
Tsubasa
Rubyist

Chapter List

  • 1 - Introduction
  • 2 - Structure
  • 3 - Testing
  • 4 - Code
  • 5 - Release
  • 6 - Versioning
  • 7 - Changelog
  • 8 - Responsibility
  • 9 - Loading
  • 10 - Command-line Executables
  • 11 - Configuration Patterns
  • 12 - Rails Hooks
  • 13 - Rails View Helpers
  • 14 - Rails Controller Includes
  • 15 - Rails Model Includes
  • 16 - Rails Rake Tasks
  • 17 - Rails Generators
  • 18 - Rails Engines (sample chapter)
  • 19 - Open Source Projects
Build a Ruby Gem packages

Everything you need to start building Ruby Gems!

Learn the conventions and best practices of build a Ruby gem and launch your open source career today.

The book is 19 chapters, totaling 136 pages. Its content ranges from how to get started with open source projects to the nitty gritty of configuration patterns in a Ruby gem.

In addition to the book, I have packaged the code from all 14 technical chapters — several of which include Rails applications with the sample gem code mounted. This is the perfect package if you want down to the code level and really get your hands dirty.

Lastly, I have generated 14 screencasts totaling over 2 hours of video content detailing my workflow. I go through the process of writing the code for each technical chapter and discuss the benefits and downsides to various approaches.

Tweet about Build a Ruby Gem
Tweet about Build a Ruby Gem
Tweet about Build a Ruby Gem

Build a Ruby Gem Screencast Preview

Choose the package that's right for you

The Book

$ 39 39 29

  • 139-page Book w/ updates
Buy now

The Book + Code

$ 79 79 59

  • 139-page eBook w/ updates
  • 14 chapters of code
Buy now

The Complete Package

$ 129 129 99

  • 139-page eBook w/ updates
  • 14 chapters of code
  • 2 hours of screencasts
Buy now
Building Ruby gems is intimidating. It seems impossible to find the right documentation when you need it. Most of the information out there assumes that you already know what you’re doing. And there’s never been a great guide to get started.

Build a Ruby Gem will teach you all of that, in a short, simple, totally approachable guide. It’s the most information about building gems I’ve ever seen in one place, and I can tell I’ll be opening it back up whenever I have a question about a gem I’m building.

Even if you’ve been creating gems for years, you’ll *still* learn a ton from Build a Ruby Gem. I certainly did.
Justin Weiss
Justin Weiss
Rubyist and Author of Practicing Rails
I recently ran into an issue at work where we needed to use one of our custom Rails generators in another project. I knew the best way to accomplish this was with a gem, but, I'd never built a gem before and felt pretty intimidated.

While researching how to build a gem, I came across Brandon’s book, "Build a Ruby Gem". Feeling overwhelmed by the task at hand, I took a chance and purchased a copy. It was worth every penny.

Brandon's book is clear, well organized, easy to follow and comprehensive. I was able to breeze through the book while following his sample code to build - and publish - my gem in just one day!
Craig Kaminsky
Craig Kaminsky
Senior Application Developer at HomeActions
Author

About the Author

My name is Brandon Hilkert and I've been feverishly building Ruby applications since 2009.

I first got started with open source Ruby gems by contributing to Sidekiq. Since then I've written about contributing to Open Source software and written few gems myself, most well-known — Sucker Punch.

When I attempted to write my first gem, I was pretty confused about the standards and conventions necessary to integrate with existing Ruby tooling. Since then, I've learned a lot and shared it with 900+ other Rubyists through a FREE email course. Based on feedback from the course, I decided to write a book. I hope you enjoy it.

Build a Ruby Gem eBook Cover

Questions?

  • What formats do you support?

    The book ships with .pdf, .epub and .mobi formats. All screencasts are .mp4.

  • What if I hate it?

    If you feel that strongly, I'm happy to issue a refund within the first 30 days.

  • Can I read a sample chapter?

    Of course! There's one linked above in the chapter list.

  • You didn't answer my question...

    Email me or get me on Twitter and I'll do my best to get your questions answered.