Class: MacSetup::HomebrewInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/mac_setup/homebrew_installer.rb

Constant Summary collapse

BREW_INSTALL_URL =
"https://raw.githubusercontent.com/Homebrew/install/master/install"

Class Method Summary collapse

Class Method Details

.homebrew_missing?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/mac_setup/homebrew_installer.rb', line 18

def self.homebrew_missing?
  Shell.run("which brew").empty?
end

.runObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/mac_setup/homebrew_installer.rb', line 7

def self.run
  if homebrew_missing?
    puts "Installing Homebrew..."
    Shell.run(%{/usr/bin/ruby -e "$(curl -fsSL #{BREW_INSTALL_URL})"})
  else
    puts "Homebrew already installed. Updating..."

    Shell.run("brew update")
  end
end