Class: Kompo::HomebrewPath::Installed

Inherits:
Taski::Task
  • Object
show all
Defined in:
lib/kompo/tasks/homebrew.rb

Overview

Use existing Homebrew installation

Instance Method Summary collapse

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kompo/tasks/homebrew.rb', line 20

def run
  # First check PATH
  brew_in_path, = Open3.capture2("which", "brew", err: File::NULL)
  brew_in_path = brew_in_path.chomp
  @path = if brew_in_path.empty?
    # Fallback to common installation paths
    HomebrewPath::COMMON_BREW_PATHS.find { |p| File.executable?(p) }
  else
    brew_in_path
  end
  puts "Homebrew path: #{@path}"
end