The Shell | Richie Codes

submited by
Style Pass
2024-04-20 14:30:06

This is the question which set me off on this entire project. For those unfamiliar with the bundle install command, it comes from the Bundler library. Bundler provides "a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed", according to its website.

Professionally, I work on a large Rails codebase with many contributors, and bundle install is one of the most common commands we find ourselves typing. I was frustrated that I didn't know how this command worked under-the-hood. Since I'm a big believer that "The best way to learn something is to explain it to someone else", I decided to blog about what I was learning, as I learned it.

As it turns out, my deep-dive took me on a detour into the code for my Ruby version manager. That version manager, named RBENV, creates shim files for every Ruby command you enter, including bundle. Therefore, the first file I encountered in my deep-dive was this shim.

In the process of exploring this shim file (and RBENV's code in general), I ended up learning a lot about the UNIX shell and Bash, the language RBENV is written in. At the risk of sounding like I'm backwards-rationalizing, I'd argue this is actually more useful than learning about Bundle, since Bash is much more broadly-used than Bundle.

Leave a Comment