The unreasonable effectiveness of a binary executable
On why I switched from Jekyll to Zola. And from all binary gems to binaries really.
Ruby is great for scripting
Ruby is a great language. I’ve written web apps in Ruby and Rails for the last 12 years of my professional and private careers.
I have over 36 Ruby scripts in my bin directory. Some of them are non-trivial with their own spec suites. I trust them and use them on a regular basis.
But there is one thing about Ruby that isn't working for me and hasn't ever been working for me, and that’s gems with a binary component.
Probably the longest running one is Jekyll, which is a blogging platform. I purposely selected Jekyll in order to be able to do a very simple blog with a very known pipeline to me, and it mostly worked.
Because I tend to focus in decreasing friction in the things I want to do more of, I created a helper script to create/edit/publish drafts and rebuild the blog. And the script itself works fine and makes me happy, however...
A static site generator is not a script
I've always used Ruby binary gems. But I don't remember a single point in time when this was easy and resilient. I've used all Ruby version managers, along with their own ways to manage gems and all of them failed my at one point when it comes to binary gems.
I've since replaced most of the binary gems on my machines, with one outlier.
I've used Jekyll since the start of this page 11 years ago. It was enough for my needs and worked pretty well, with some workarounds needed from time to time.
But after I saw there and stared at the code editor, showing this monstrosity:
puts system(%{cd #{BLOG_PATH} && bash -lc 'export RBENV_VERSION=2.7.5; export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; unset GEM_HOME GEM_PATH BUNDLE_PATH; bundle exec jekyll build'})I was an attempt at calling Jekyll from another Ruby script, and I failed. Best I can work out is that rbenv shims don't update properly. Or perhaps it's a bundler cache issue. Or perhaps this happens because I run the parent script with inlined bundler gems. It can be so many things.
The fact is, this script ran so many layers deep that it's quite insane. So many things can, and have. gone wrong. And it's just a mess.
Enter the humble binary
Static site generators are quite a crowded category. Zola is a Rust project with a reasonable feature set and is pretty compatible with Jekyll since it also uses Markdown as the format for blog posts.
The magic part is, after I download the 40MB binary, I don't have to worry about it until I either switch away from Linux (not bloody likely) or architectures. Even then I can probably get several years old versions for different architectures and OSes from GitHub directly.
And while 40MB is not nothing, it's not something I'm likely to notice on several TB of hard drive. I even have a special folder synced across machines that holds binaries which are pretty much feature complete and not likely to change any time soon.
I won't be able to keep everything this way. But the things I need most often and to stand the test of time, this is my future.