Class: MacAppSync::Defaults::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/mac_app_sync/defaults/updater.rb

Class Method Summary collapse

Class Method Details

.update(domain, store) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/mac_app_sync/defaults/updater.rb', line 7

def update(domain, store)
  with_tempfile(store.to_binary) do |file|
    if system("plutil -lint #{file.path}")
      destination = store.plist_path || domain
      system("defaults import '#{destination}' #{file.path}")
    else
      raise "Invalid plist for #{domain}"
    end
  end
end