Rolling Ruby gems is an artistic affair. Fashions change. Sometime ago it was considered fine to edit your
gemspec.rb by hand.
Somewhat later a trend of using Hoe emerged. A little while later Bundler came into
the picture, and it had a command as well to generate gems. Wind a few more years - and the fashion is now to roll with
The funny thing about it is that multiple people tend to jump on it and migrate their projects from one gem setup/maintenance system to another. It is just like with haute-couture or testing frameworks – it is cool as long as you are using the latest one in fashion at the moment. Get distracted for just a couple of months - and you are no longer the fashion club, but a retrograde old bureaucrat stuck in his old ways of doing things.
However, not many people focus on what is way more important in the story of making Ruby gems and makine them actually shine - the stability. Let’s go to an example. With my modest portfolio I clock over 20 gems in my decade of doing Ruby for fun and profit. Repeatability is way more important for me in this process than any fashions currently being flung around. In my view, for me as a maintainer of a whole salvo of gems, I need to have a few very simple conditions that are met by whatever tool I use for rolling gems:
- There should be a command I can easily memorise to initialise a blank slate gem, and it should have the right setup in place.
- All tests/specs for the gem should run with
$bundle exec rake, no exceptions.
- I should be able to do a release, including tagging and pushing it to the gem server, with
$bundle exec rake release
- I should not have to edit any files except of the changelog/version to roll such a release. Simple git history /
- The gem set up with that tool of choice has to be runnable by Travis, and for most of my gems I still support Ruby 1.8.7
Having this process helps me by reducing the friction to release gems. When I want to release a library, absolutely the last thing I want to be
worried about is how to streamline the workflow of doing those things. Simply because if I do, each new gem that I release or update is going to
obtain a release process of it’s own - it’s just like building plugins for expensive post-production applications all over again. Every new version you roll, for any new version of it’s dependencies, becomes a unique snowflake - one has a
Gemfile, another one is managed by a manual
gemspec.rb, yet another one assembles itself from
git… and it goes on and on until you have to actually check what kind of release pipeline du jour
has been in effect when you were last twiddling with a certain gem.
The longevity of many of my projects - tracksperanto is no exception with a running history of regular updates over it’s 5 year existence - also owes to a stable release pipeline.
I’ve only went through the changes in the gem release pipeline twice. First switch was from manual
gemspec.rb editing and a hodgepodge of Rake tasks
to Hoe. The second was from Hoe to Jeweler, because I was unable to make Hoe function on Travis with the vast array of Ruby versions I wanted and because I got fed up with the manual
MANIFEST file, where I always forgot to add a file or two.
So far Jeweler, with all of it’s possible problems and limitations and an extra dependency, given me the most precious thing in the gem
release/maintenance process - and that is that I don’t have to think about that process. For any single gem that I maintain, I know that
brake followed by
brake release is going to do the update I am after - and I can concentrate on the code that my library is offering instead of the fashions
of the build pipeline.
That is way more important, and way more precious to me than knowing that I am following the latest trend in a volatile universe of open-source. I am ready to pay the price of being called old-fashioned and having extra 10 lines in my Rakefile, along with a dependency practically none of my users will even download. By corollary, it means that your pull request to my projects proposing to remove Jeweler and go about some more bikeshedding is likely to be rejected. Not because I am a jerk, but because it supports a repeatable process I have developed muscle memory for, and changing that muscle memory is the last item on my priority list.
And I suggest you, dear reader, to do the same - pick a rubygem release/bootstrapping process that works for you, verify it, trust it and stick to it, instead of joining the bikeshedding fest - whatever that process might be. What your actual gem does is way more important than what you are using to roll it.