module BinInstall::Brew

Constants

INSTALL

Public Class Methods

ask() click to toggle source
# File lib/bin_install/brew.rb, line 29
def self.ask
  return if installed?

  print 'Would you like to install Homebrew? [Y/n]: '
  install if Shell.default_yes?(gets.chomp)
end
ask!() click to toggle source
# File lib/bin_install/brew.rb, line 36
def self.ask!
  print 'Would you like to install Homebrew? [Y/n]: '
  install! if Shell.default_yes?(gets.chomp)
end
install() click to toggle source
# File lib/bin_install/brew.rb, line 19
def self.install
  puts 'Installing Homebrew...'.white
  system(INSTALL)
end
install!() click to toggle source
# File lib/bin_install/brew.rb, line 24
def self.install!
  puts 'Installing Homebrew...'.white
  BinInstall.system!(INSTALL)
end
installed?() click to toggle source
# File lib/bin_install/brew.rb, line 53
def self.installed?
  Shell.executable_exists?('brew')
end
require!() click to toggle source
# File lib/bin_install/brew.rb, line 8
def self.require!
  if installed?
    update!
  else
    puts 'Homebrew is required.'.red
    puts 'Visit https://brew.sh/ for more information.'
    ask!
    abort('Can not continue without Homebrew.'.red) unless installed?
  end
end
update() click to toggle source
# File lib/bin_install/brew.rb, line 41
def self.update
  puts 'Updating Homebrew...'.white
  system('brew update')
  Cask.tap
end
update!() click to toggle source
# File lib/bin_install/brew.rb, line 47
def self.update!
  puts 'Updating Homebrew...'.white
  BinInstall.system!('brew update')
  Cask.tap!
end