class MacSetup::SystemStatus

Public Class Methods

new() click to toggle source
# File lib/mac_setup/system_status.rb, line 5
def initialize
  @git_changes = Hash.new { |hash, key| hash[key] = [] }
  @defaults = Hash.new { |hash, key| hash[key] = {} }
end

Public Instance Methods

defaults_value(domain, key) click to toggle source
# File lib/mac_setup/system_status.rb, line 26
def defaults_value(domain, key)
  @defaults[domain][key] ||= read_defaults_value(domain, key)
end
git_changes(key, changes = nil) click to toggle source
# File lib/mac_setup/system_status.rb, line 18
def git_changes(key, changes = nil)
  if changes
    @git_changes[key] = changes
  else
    @git_changes[key]
  end
end
installed_formulas() click to toggle source
# File lib/mac_setup/system_status.rb, line 14
def installed_formulas
  @installed_formulas ||= get_formulas
end
installed_taps() click to toggle source
# File lib/mac_setup/system_status.rb, line 10
def installed_taps
  @installed_taps ||= get_taps
end

Private Instance Methods

get_formulas() click to toggle source
# File lib/mac_setup/system_status.rb, line 36
def get_formulas
  Shell.result("brew list -1").split("\n")
end
get_taps() click to toggle source
# File lib/mac_setup/system_status.rb, line 32
def get_taps
  Shell.result("brew tap").split("\n")
end
read_defaults_value(domain, key) click to toggle source
# File lib/mac_setup/system_status.rb, line 40
def read_defaults_value(domain, key)
  result = Shell.run("defaults read #{domain} '#{key}'")

  result.output if result.success?
end