dutiful 0.0.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/osx-finder.toml +8 -0
- data/db/osx-global-domain.toml +20 -0
- data/db/osx-print.toml +8 -0
- data/lib/dutiful/application_default.rb +14 -7
- data/lib/dutiful/application_file.rb +2 -2
- data/lib/dutiful/commands/init.rb +13 -0
- data/lib/dutiful/commands/main.rb +3 -15
- data/lib/dutiful/commands.rb +1 -0
- data/lib/dutiful/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 903940d65db5375e44a2f68fa7b4efcae43a24ae
|
4
|
+
data.tar.gz: 46f46b34e4a4ac06d0a9847d16f10f55bdc257ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a5aae2f42b8464067e41f2bb55cbbb7f4f44d95f19c100f182d35b0eaa7813b03c51fedee458fdaec69950efce309eb716c163883131bbccebfd8585854959
|
7
|
+
data.tar.gz: 882ac0bb2c305bccf38791afb1bbe634b29da49591e93238f094c42c6e91780e20b3904b9e0993c9956709a4909bb3a03aed4e8224395fab8142300264311972
|
data/db/osx-finder.toml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
[application]
|
2
|
+
name = 'OSX Global Domain'
|
3
|
+
|
4
|
+
[[default]]
|
5
|
+
description = 'Disable press-and-hold for keys in favor of key repeat'
|
6
|
+
domain = 'NSGlobalDomain'
|
7
|
+
key = 'ApplePressAndHoldEnabled'
|
8
|
+
type = '-bool'
|
9
|
+
|
10
|
+
[[default]]
|
11
|
+
description = 'Set the keyboard repeat rate'
|
12
|
+
domain = 'NSGlobalDomain'
|
13
|
+
key = 'KeyRepeat'
|
14
|
+
type = '-int'
|
15
|
+
|
16
|
+
[[default]]
|
17
|
+
description = 'Set the keyboard repeat delay'
|
18
|
+
domain = 'NSGlobalDomain'
|
19
|
+
key = 'InitialKeyRepeat'
|
20
|
+
type = '-int'
|
data/db/osx-print.toml
ADDED
@@ -5,6 +5,7 @@ class Dutiful::ApplicationDefault
|
|
5
5
|
@description = hash[:description]
|
6
6
|
@domain = hash[:domain]
|
7
7
|
@key = hash[:key]
|
8
|
+
@type = hash[:type]
|
8
9
|
end
|
9
10
|
|
10
11
|
def backup
|
@@ -17,30 +18,36 @@ class Dutiful::ApplicationDefault
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def backup_value
|
20
|
-
|
21
|
-
|
21
|
+
File.read(backup_path)
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
+
def parsed_backup_value
|
25
|
+
case @type
|
26
|
+
when '-bool'
|
27
|
+
backup_value == '1' ? true : false
|
28
|
+
else
|
29
|
+
backup_value
|
30
|
+
end
|
24
31
|
end
|
25
32
|
|
26
33
|
def restore
|
27
|
-
`defaults write #{@domain} #{@key} #{
|
34
|
+
`defaults write #{@domain} #{@key} #{@type} #{parsed_backup_value}`
|
28
35
|
Result.new nil, true
|
29
36
|
rescue => ex
|
30
37
|
Result.new ex.message, false
|
31
38
|
end
|
32
39
|
|
33
40
|
def name
|
34
|
-
|
41
|
+
@key
|
35
42
|
end
|
36
43
|
|
37
44
|
def value
|
38
|
-
@value ||= `defaults read #{@domain} #{@key} 2>/dev/null
|
45
|
+
@value ||= `defaults read #{@domain} #{@key} 2>/dev/null`.strip
|
39
46
|
end
|
40
47
|
|
41
48
|
def exist?
|
42
49
|
@exists ||= begin
|
43
|
-
|
50
|
+
value
|
44
51
|
$?.success?
|
45
52
|
end
|
46
53
|
end
|
@@ -67,12 +67,12 @@ class Dutiful::ApplicationFile
|
|
67
67
|
|
68
68
|
def meets_conditions?
|
69
69
|
if has_condition?
|
70
|
-
output = `#{command}
|
70
|
+
output = `#{command}`.strip
|
71
71
|
|
72
72
|
if expected_status
|
73
73
|
$?.exitstatus == expected_status
|
74
74
|
else
|
75
|
-
$?.success? && output
|
75
|
+
$?.success? && output == expected_output
|
76
76
|
end
|
77
77
|
else
|
78
78
|
true
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Dutiful::Command::Init < Clamp::Command
|
2
|
+
def execute
|
3
|
+
if File.exist? Dutiful::Config::PATH
|
4
|
+
Dutiful::Logger.warning "Configuration file already exist: '~/.dutiful/config.toml'."
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
|
8
|
+
FileUtils.mkdir_p Dutiful.dir
|
9
|
+
FileUtils.cp File.expand_path("#{Dutiful.dir}/template/config.toml"), Dutiful::Config::PATH
|
10
|
+
|
11
|
+
Dutiful::Logger.success "Configuration file successfully created: '~/.dutiful/config.toml'."
|
12
|
+
end
|
13
|
+
end
|
@@ -4,20 +4,8 @@ class Dutiful::Command::Main < Clamp::Command
|
|
4
4
|
exit 0
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
exit 1
|
11
|
-
end
|
12
|
-
|
13
|
-
FileUtils.mkdir_p Dutiful.dir
|
14
|
-
FileUtils.cp File.expand_path("#{Dutiful.dir}/template/config.toml"), Dutiful::Config::PATH
|
15
|
-
|
16
|
-
Dutiful::Logger.success "Configuration file successfully created: '~/.dutiful/config.toml'."
|
17
|
-
exit 0
|
18
|
-
end
|
19
|
-
|
20
|
-
subcommand 'backup', 'Backup all preference files', Dutiful::Command::Backup
|
21
|
-
subcommand 'list', 'List all preference files', Dutiful::Command::List
|
7
|
+
subcommand 'backup', 'Backup all preference files', Dutiful::Command::Backup
|
8
|
+
subcommand 'init', 'Initialize the configuration file', Dutiful::Command::Init
|
9
|
+
subcommand 'list', 'List all preference files', Dutiful::Command::List
|
22
10
|
subcommand 'restore', 'Restore all preference files', Dutiful::Command::Restore
|
23
11
|
end
|
data/lib/dutiful/commands.rb
CHANGED
data/lib/dutiful/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dutiful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Pinto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -127,6 +127,9 @@ files:
|
|
127
127
|
- db/git.toml
|
128
128
|
- db/iterm2.toml
|
129
129
|
- db/oh-my-zsh.toml
|
130
|
+
- db/osx-finder.toml
|
131
|
+
- db/osx-global-domain.toml
|
132
|
+
- db/osx-print.toml
|
130
133
|
- db/osx-screencapture.toml
|
131
134
|
- db/popcorn-time.toml
|
132
135
|
- db/rubymine.toml
|
@@ -142,6 +145,7 @@ files:
|
|
142
145
|
- lib/dutiful/application_file.rb
|
143
146
|
- lib/dutiful/commands.rb
|
144
147
|
- lib/dutiful/commands/backup.rb
|
148
|
+
- lib/dutiful/commands/init.rb
|
145
149
|
- lib/dutiful/commands/list.rb
|
146
150
|
- lib/dutiful/commands/main.rb
|
147
151
|
- lib/dutiful/commands/restore.rb
|
@@ -173,5 +177,5 @@ rubyforge_project:
|
|
173
177
|
rubygems_version: 2.4.5
|
174
178
|
signing_key:
|
175
179
|
specification_version: 4
|
176
|
-
summary: dutiful-0.0
|
180
|
+
summary: dutiful-1.0.0
|
177
181
|
test_files: []
|