class MacAppSync::Defaults::Updater
Public Class Methods
update(domain, store)
click to toggle source
# 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
Private Class Methods
with_tempfile(content) { |file| ... }
click to toggle source
# File lib/mac_app_sync/defaults/updater.rb, line 20 def with_tempfile(content) Tempfile.create("plist") do |file| file.write(content) File.chmod(0644, file) file.rewind yield file end end