class MacSetup::BrewfileInstaller
Constants
- BUNDLE_TAP
Attributes
config[R]
status[R]
Public Class Methods
new(config, status)
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 14 def initialize(config, status) @config = config @status = status end
run(config, status)
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 10 def self.run(config, status) new(config, status).run end
Public Instance Methods
run()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 19 def run tap_bundle set_up_mas install_brewfile end
Private Instance Methods
bundle_already_tapped?()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 74 def bundle_already_tapped? status.installed_taps.include?(BUNDLE_TAP) end
install_brewfile()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 64 def install_brewfile MacSetup.log "Installing Brewfile" do Shell.run("brew bundle --global") end end
install_mas()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 41 def install_mas if mas_installed? MacSetup.log "mas already installed. Skipping." else MacSetup.log "Installing mas" do Shell.run("brew install mas") end end end
mas_installed?()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 70 def mas_installed? Shell.success?("which mas") end
mas_signed_in?()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 60 def mas_signed_in? Shell.success?("mas account") end
set_up_mas()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 33 def set_up_mas brewfile = Pathname.new("~/.Brewfile").expand_path return unless brewfile.read =~ /^mas / install_mas sign_in_to_mas end
sign_in_to_mas()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 51 def sign_in_to_mas if mas_signed_in? MacSetup.log "Already signed into Mac App Store. Skipping." else apple_id = Shell.ask("What is your Apple ID?") Shell.run("mas signin --dialog #{apple_id}") end end
tap_bundle()
click to toggle source
# File lib/mac_setup/brewfile_installer.rb, line 27 def tap_bundle return if bundle_already_tapped? Shell.run("brew tap #{BUNDLE_TAP}") end