Sha256: 5282f8d8e1e252ff45da43b439ed8306e29e20fe1fbb59cf229238d7afe24b81

Contents?: true

Size: 1.32 KB

Versions: 13

Compression:

Stored size: 1.32 KB

Contents

require 'bin_install/brew/cask'
require 'bin_install/brew/package'
require 'bin_install/brew/service'

module BinInstall
  module Brew
    INSTALL = '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'.freeze
    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

    def self.install
      puts 'Installing Homebrew...'.white
      system(INSTALL)
    end

    def self.install!
      puts 'Installing Homebrew...'.white
      BinInstall.system!(INSTALL)
    end

    def self.ask
      return if installed?

      print 'Would you like to install Homebrew? [Y/n]: '
      install if Shell.default_yes?(gets.chomp)
    end

    def self.ask!
      print 'Would you like to install Homebrew? [Y/n]: '
      install! if Shell.default_yes?(gets.chomp)
    end

    def self.update
      puts 'Updating Homebrew...'.white
      system('brew update')
      Cask.tap
    end

    def self.update!
      puts 'Updating Homebrew...'.white
      BinInstall.system!('brew update')
      Cask.tap!
    end

    def self.installed?
      Shell.executable_exists?('brew')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bin_install-0.0.33 lib/bin_install/brew.rb
bin_install-0.0.32 lib/bin_install/brew.rb
bin_install-0.0.31 lib/bin_install/brew.rb
bin_install-0.0.30 lib/bin_install/brew.rb
bin_install-0.0.29 lib/bin_install/brew.rb
bin_install-0.0.28 lib/bin_install/brew.rb
bin_install-0.0.27 lib/bin_install/brew.rb
bin_install-0.0.26 lib/bin_install/brew.rb
bin_install-0.0.25 lib/bin_install/brew.rb
bin_install-0.0.24 lib/bin_install/brew.rb
bin_install-0.0.23 lib/bin_install/brew.rb
bin_install-0.0.22 lib/bin_install/brew.rb
bin_install-0.0.21 lib/bin_install/brew.rb