Class: Discharger::SetupRunner::PreCommands::HomebrewPreCommand
- Inherits:
-
BasePreCommand
- Object
- BasePreCommand
- Discharger::SetupRunner::PreCommands::HomebrewPreCommand
- Defined in:
- lib/discharger/setup_runner/pre_commands/homebrew_pre_command.rb
Overview
Ensures Homebrew/Linuxbrew is installed. This must run before ‘brew bundle` can install Brewfile dependencies.
Constant Summary collapse
- HOMEBREW_INSTALL_URL =
"https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"- LINUXBREW_PATH =
"/home/linuxbrew/.linuxbrew/bin"
Instance Attribute Summary
Attributes inherited from BasePreCommand
Instance Method Summary collapse
Methods inherited from BasePreCommand
Constructor Details
This class inherits a constructor from Discharger::SetupRunner::PreCommands::BasePreCommand
Instance Method Details
#description ⇒ Object
35 36 37 |
# File 'lib/discharger/setup_runner/pre_commands/homebrew_pre_command.rb', line 35 def description "Ensure Homebrew is installed" end |
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/discharger/setup_runner/pre_commands/homebrew_pre_command.rb', line 14 def execute if command_exists?("brew") log "Homebrew found at: #{`which brew`.strip}" return true end log "Homebrew not found. Installing..." if platform_darwin? install_homebrew_macos elsif platform_linux? install_homebrew_linux else log "WARNING: Unsupported platform for automatic Homebrew installation" log "Please install Homebrew manually: https://brew.sh" return false end verify_installation end |