Homebrew
Summarizing my attempts to understand Homebrew codebase
Last updated
Was this helpful?
Summarizing my attempts to understand Homebrew codebase
Last updated
Was this helpful?
:
Formula - package definition.
Keg - installation prefix of a formula.
Cellar - where all kegs are located.
Tap - git repo of formulae and/or commands.
Bottle - pre-built keg.
Cask - extension of Homebrew to install native MacOS apps.
General notes:
I like how formulae come with tests.
Formula dev guide is pretty great.
Ruby seems like a great choice for DLSs like this.
Overall code structure seems moderately simple, e.g. there are not too many layers of redirection for the most part.
Implementation details are often rather convoluted, with not too many comments.
A lot of long methods.
Tracing:
Setting env variables for OS, cache location, etc.
Checks that it's not sudo, not installing on temp, etc.
Check dependencies: curl, git, ...
Some are .sh, some are .rb
I expected a single ruby entry point, but there's none!
Install path:
Accepts formula and a ton of params.
I would probably extract the params into some class.
FormulaInstaller seems... rather convoluted.
Interesting:
Not too interesting. It just delegates.
Entry point shell script:
Then
Then route to one of
Test: Seems rather... superficial. But I kind of like their test DSL.
Command parser:
Check if to install:
Install:
Then it creates and calls its methods one by one: prelude, fetch, install, finish.
Did you mean?
Locking.
Github access With pagination and what not. Spec:
Search:
Download strategy switch:
Unpack strategy.
Cache store:
Curl & workarounds: