mac_app_sync 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mac_app_sync/defaults/store.rb +8 -5
- data/lib/mac_app_sync/defaults/updater.rb +2 -1
- data/lib/mac_app_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c81824aaa3d35ca555cf96f1558d3639bc67b40d02342ce22af39b944b202512
|
|
4
|
+
data.tar.gz: 11de35c2498fe43bad82e6d199c9ff660ec776c8f15a1aae74144b956303b9b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34b1863093717d3586457c005a1489ffbeb7b528361f0e7a51eb2e3f63c2d98b27446b4e5af4aecfd99623ab68cfd790f8f4da06303a6827a4fe90d52cb04f14
|
|
7
|
+
data.tar.gz: c153faf13f0e47c601e85a09ec4282e8baca583bd3f4c98384caacd8ef2edf7cc2c05a9fb6f6ce0f66d5564ab2d0bb822bb1e3343c0067c12224df7cfe6db39d
|
data/Gemfile.lock
CHANGED
|
@@ -3,10 +3,11 @@ require "pathname"
|
|
|
3
3
|
module MacAppSync
|
|
4
4
|
module Defaults
|
|
5
5
|
class Store
|
|
6
|
-
attr_reader :domain
|
|
6
|
+
attr_reader :domain, :plist
|
|
7
7
|
|
|
8
8
|
def initialize(domain)
|
|
9
9
|
@domain = domain
|
|
10
|
+
@plist = load_plist
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def values
|
|
@@ -17,10 +18,6 @@ module MacAppSync
|
|
|
17
18
|
plist.to_str(CFPropertyList::List::FORMAT_XML)
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
def plist
|
|
21
|
-
@plist ||= CFPropertyList::List.new(file: plist_path)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
21
|
def set(key, value)
|
|
25
22
|
new_value = PlistConverter.to_plist(value)
|
|
26
23
|
current_value = plist.value.value[key]
|
|
@@ -36,6 +33,12 @@ module MacAppSync
|
|
|
36
33
|
|
|
37
34
|
private
|
|
38
35
|
|
|
36
|
+
def load_plist
|
|
37
|
+
CFPropertyList::List.new(file: plist_path).tap do |list|
|
|
38
|
+
list.value = CFPropertyList::CFDictionary.new if plist_path.nil?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
39
42
|
def prefs_file_path
|
|
40
43
|
prefs_file = Pathname.new("~/Library/Preferences/#{domain}.plist").expand_path
|
|
41
44
|
prefs_file.to_s if prefs_file.exist?
|
|
@@ -7,7 +7,8 @@ module MacAppSync
|
|
|
7
7
|
def update(domain, store)
|
|
8
8
|
with_tempfile(store.to_binary) do |file|
|
|
9
9
|
if system("plutil -lint #{file.path}")
|
|
10
|
-
|
|
10
|
+
destination = store.plist_path || domain
|
|
11
|
+
system("defaults import '#{destination}' #{file.path}")
|
|
11
12
|
else
|
|
12
13
|
raise "Invalid plist for #{domain}"
|
|
13
14
|
end
|
data/lib/mac_app_sync/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mac_app_sync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Wean
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-09-
|
|
11
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|