Add Homebrew Utilities Migration with Bash and Comprehensive Testing#17
Merged
Add Homebrew Utilities Migration with Bash and Comprehensive Testing#17
Conversation
- Create lib/homebrew-utils.bash with core Homebrew functions - Add get_homebrew_prefix() for architecture-specific paths - Add ensure_homebrew_in_path() for PATH management - Add is_homebrew_package_installed() for package checking - Add comprehensive unit tests with 9 test cases covering all functions - Add bin/install/homebrew.bash installation script - Follow established bash migration pattern with zero shellcheck warnings - All unit tests pass, demonstrates working functionality
This was referenced Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💪 What
Homebrew Utilities Migration: Complete migration of Homebrew functionality from zsh to bash following the established bash migration pattern.
Files Changed
lib/homebrew-utils.bash- Core Homebrew utility functions with zero shellcheck warningstest/install/test-homebrew-utils.bats- Comprehensive unit tests (9 test cases, all passing)bin/install/homebrew.bash- Installation script using shared utilitiesNew Functionality
get_homebrew_prefix()- Architecture-specific Homebrew prefix detection (Apple Silicon vs Intel)ensure_homebrew_in_path()- Smart PATH management without duplicationis_homebrew_package_installed()- Package installation checkingdetect_homebrew(),get_homebrew_version(),validate_homebrew_installation()- Existing functions migrated🤔 Why
Phase 1 of bash migration project: Extract shared Homebrew utilities that are reused across multiple installation scripts, following the successful patterns established in GitHub and SSH utility migrations.
Benefits demonstrated:
👀 Usage
Installation script usage:
Utility functions for other scripts:
👩🔬 How to validate
Run all unit tests:
./test/run-tests.zsh test-homebrew-utils # OR bats test/install/test-homebrew-utils.batsTest installation script:
Verify shellcheck compliance:
All tests pass, zero shellcheck warnings, and maintains feature parity with original zsh implementation.
🔗 Related links