Class: MacSetup::DefaultsInstaller

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults_file, config, status) ⇒ DefaultsInstaller

Returns a new instance of DefaultsInstaller.



14
15
16
17
18
# File 'lib/mac_setup/defaults_installer.rb', line 14

def initialize(defaults_file, config, status)
  @defaults = YAML.load_file(defaults_file)
  @config = config
  @status = status
end

Class Method Details

.run(config, status) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/mac_setup/defaults_installer.rb', line 3

def self.run(config, status)
  defaults_file = File.join(MacSetup.dotfiles_path, "mac_setup/defaults.yml")

  if File.exist?(defaults_file)
    MacSetup.log "Setting defaults..."
    new(defaults_file, config, status).run
  else
    MacSetup.log "No config file at #{MacSetup.shorten_path(defaults_file)}. Skipping..."
  end
end

Instance Method Details

#runObject



20
21
22
23
24
25
# File 'lib/mac_setup/defaults_installer.rb', line 20

def run
  @defaults.each do |domain, values|
    MacSetup.log "Setting defaults for domain #{domain}..."
    set_defaults(domain, values)
  end
end