module

Krikri::PluginHelpers::Homebrew

Homebrew - pure logic for the homebrew plugin: package-name validation, brew info --json=v2 parsing (installed/outdated sets with the real module's name-matching rules), and brew command construction. Split out of plugins/homebrew.cr so this logic is unit-spec-able (execution needs a real macOS/Linuxbrew host, which no spec environment has).

Class methods

info_command(brew_path : String, packages : Array(String)) : String
Source
install_command(brew_path : String, packages : Array(String), install_options : Array(String), head : Bool, force_formula : Bool) : String
Source
parse_info(json_output : String, packages : Array(String)) : Hash(String, NamedTuple(installed: Bool, outdated: Bool)) | Nil

brew info --json=v2 output -> per-requested-name {installed, outdated} map, mirroring the real module's _get_packages_info: a formula is installed when its installed array is non-empty, outdated when its outdated flag is set. The user-supplied name is matched against name/full_name/aliases/oldnames (plus the tap-prefixed spellings) like the real _extract_package_name.

Source
uninstall_command(brew_path : String, packages : Array(String), install_options : Array(String)) : String
Source
update_changed?(update_output : String) : Bool
Source
upgrade_command(brew_path : String, packages : Array(String), install_options : Array(String)) : String
Source
valid_package?(package : String) : Bool

The real module's HomebrewValidate.valid_package: a package name is a formula name (optionally tap-prefixed, e.g. homebrew/cask/foo).

Source