dutiful 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/alfred.toml +22 -0
- data/db/brew.toml +1 -1
- data/db/bundler.toml +1 -1
- data/db/dash.toml +4 -4
- data/db/dutiful.toml +1 -1
- data/db/fish.toml +1 -1
- data/db/git.toml +1 -1
- data/db/iterm2.toml +1 -1
- data/db/oh-my-zsh.toml +1 -1
- data/db/popcorn-time.toml +1 -1
- data/db/rubymine.toml +4 -4
- data/db/the_silver_searcher.toml +1 -1
- data/db/tmux.toml +1 -1
- data/db/tmuxline.toml +1 -1
- data/db/vim.toml +2 -2
- data/db/z.toml +1 -1
- data/db/zsh.toml +5 -5
- data/lib/dutiful/application.rb +6 -2
- data/lib/dutiful/application_file.rb +29 -2
- data/lib/dutiful/commands/list.rb +2 -2
- data/lib/dutiful/commands/sync.rb +2 -2
- data/lib/dutiful/storage.rb +4 -2
- data/lib/dutiful/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c4ff77357fdd7e791b53d6f82c7cbef2940a2f1
|
4
|
+
data.tar.gz: 2d3bcf04350bb48e0f41f8ad04395b54024547bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80a690af56ded5e3278396feda4da1aa49744012f7169b19089673492a9a8cade27a8a6ee2c757bb5d2e6d17ebd1209671f28ba5942ec67c71f8cb143d05e907
|
7
|
+
data.tar.gz: 3f0234c53031fc8020aa4ed1c43356f830606aec3651b1e23521d2264a8e8f13a01eee3b702d81e7a4bb1c4d0ac070062aea29c277582ba4e4b2d07d9def0bcc
|
data/db/alfred.toml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
[application]
|
2
|
+
name = 'Alfred'
|
3
|
+
|
4
|
+
[[file]]
|
5
|
+
path = 'Library/Preferences/com.runningwithcrayons.Alfred-2.plist'
|
6
|
+
|
7
|
+
[[file]]
|
8
|
+
path = 'Library/Preferences/com.runningwithcrayons.Alfred-Preferences.plist'
|
9
|
+
|
10
|
+
[[file]]
|
11
|
+
path = 'Library/Application Support/Alfred 2/license.plist'
|
12
|
+
|
13
|
+
[file.condition]
|
14
|
+
command = 'defaults read-type com.runningwithcrayons.Alfred-Preferences syncfolder 2>&1'
|
15
|
+
expected_output = 'Type is string'
|
16
|
+
|
17
|
+
[[file]]
|
18
|
+
path = 'Library/Application Support/Alfred 2/'
|
19
|
+
|
20
|
+
[file.condition]
|
21
|
+
command = 'defaults read-type com.runningwithcrayons.Alfred-Preferences syncfolder 2>&1'
|
22
|
+
expected_status = 1
|
data/db/brew.toml
CHANGED
data/db/bundler.toml
CHANGED
data/db/dash.toml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
[application]
|
2
2
|
name = 'Dash'
|
3
3
|
|
4
|
-
[[
|
4
|
+
[[file]]
|
5
5
|
path = 'Library/Application Support/Dash/library.dash'
|
6
6
|
|
7
|
-
[[
|
7
|
+
[[file]]
|
8
8
|
path = 'Library/Application Support/Dash/License/license.dash-license'
|
9
9
|
|
10
|
-
[[
|
10
|
+
[[file]]
|
11
11
|
path = 'Library/Preferences/com.kapeli.dash.plist'
|
12
12
|
|
13
|
-
[[
|
13
|
+
[[file]]
|
14
14
|
path = 'Library/Preferences/com.kapeli.dashdoc.plist'
|
data/db/dutiful.toml
CHANGED
data/db/fish.toml
CHANGED
data/db/git.toml
CHANGED
data/db/iterm2.toml
CHANGED
data/db/oh-my-zsh.toml
CHANGED
data/db/popcorn-time.toml
CHANGED
data/db/rubymine.toml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
[application]
|
2
2
|
name = 'RubyMine'
|
3
3
|
|
4
|
-
[[
|
4
|
+
[[file]]
|
5
5
|
path = 'Library/Application Support/RubyMine60'
|
6
6
|
|
7
|
-
[[
|
7
|
+
[[file]]
|
8
8
|
path = 'Library/Preferences/RubyMine60'
|
9
9
|
|
10
|
-
[[
|
10
|
+
[[file]]
|
11
11
|
path = 'Library/Application Support/RubyMine70'
|
12
12
|
|
13
|
-
[[
|
13
|
+
[[file]]
|
14
14
|
path = 'Library/Preferences/RubyMine70'
|
15
15
|
|
data/db/the_silver_searcher.toml
CHANGED
data/db/tmux.toml
CHANGED
data/db/tmuxline.toml
CHANGED
data/db/vim.toml
CHANGED
data/db/z.toml
CHANGED
data/db/zsh.toml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
[application]
|
2
2
|
name = 'Zsh'
|
3
3
|
|
4
|
-
[[
|
4
|
+
[[file]]
|
5
5
|
path = '.zshenv'
|
6
6
|
|
7
|
-
[[
|
7
|
+
[[file]]
|
8
8
|
path = '.zprofile'
|
9
9
|
|
10
|
-
[[
|
10
|
+
[[file]]
|
11
11
|
path = '.zshrc'
|
12
12
|
|
13
|
-
[[
|
13
|
+
[[file]]
|
14
14
|
path = '.zlogin'
|
15
15
|
|
16
|
-
[[
|
16
|
+
[[file]]
|
17
17
|
path = '.zlogout'
|
data/lib/dutiful/application.rb
CHANGED
@@ -8,7 +8,7 @@ class Dutiful::Application
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def files
|
11
|
-
content[:
|
11
|
+
content[:file].map { |file| Dutiful::ApplicationFile.new file[:path], file[:condition] }
|
12
12
|
end
|
13
13
|
|
14
14
|
def exist?
|
@@ -21,7 +21,7 @@ class Dutiful::Application
|
|
21
21
|
|
22
22
|
def sync
|
23
23
|
files.each do |file|
|
24
|
-
if file.
|
24
|
+
if file.should_sync?
|
25
25
|
result = Dutiful::Config.storage.sync(file)
|
26
26
|
yield file, result if block_given?
|
27
27
|
else
|
@@ -30,6 +30,10 @@ class Dutiful::Application
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def should_sync?
|
34
|
+
exist? || has_backup?
|
35
|
+
end
|
36
|
+
|
33
37
|
def synced?
|
34
38
|
files.all? &:synced?
|
35
39
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
class Dutiful::ApplicationFile
|
2
2
|
attr_reader :full_path, :path
|
3
3
|
|
4
|
-
def initialize(path)
|
5
|
-
@
|
4
|
+
def initialize(path, condition)
|
5
|
+
@command = condition[:command] if condition
|
6
|
+
@expected_output = condition[:expected_output] if condition
|
7
|
+
@expected_status = condition[:expected_status] if condition
|
8
|
+
@path = path
|
6
9
|
|
7
10
|
if directory?
|
8
11
|
@full_path = "#{File.expand_path "~/#{path}"}/"
|
@@ -23,6 +26,20 @@ class Dutiful::ApplicationFile
|
|
23
26
|
File.mtime full_path if exist?
|
24
27
|
end
|
25
28
|
|
29
|
+
def meets_conditions?
|
30
|
+
if has_condition?
|
31
|
+
output = `#{@command}`
|
32
|
+
|
33
|
+
if @expected_status
|
34
|
+
$?.exitstatus == @expected_status
|
35
|
+
else
|
36
|
+
$?.success? && output.strip == @expected_output
|
37
|
+
end
|
38
|
+
else
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
26
43
|
def directory?
|
27
44
|
path.chars.last == '/'
|
28
45
|
end
|
@@ -35,11 +52,21 @@ class Dutiful::ApplicationFile
|
|
35
52
|
Dutiful::Config.storage.exist? self
|
36
53
|
end
|
37
54
|
|
55
|
+
def has_condition?
|
56
|
+
@command
|
57
|
+
end
|
58
|
+
|
59
|
+
def should_sync?
|
60
|
+
(exist? || has_backup?) && meets_conditions?
|
61
|
+
end
|
62
|
+
|
38
63
|
def synced?
|
39
64
|
has_backup? && Dutiful::Config.storage.synced?(self)
|
40
65
|
end
|
41
66
|
|
42
67
|
def to_s
|
68
|
+
return "#{path} does not meet conditions (skipping)".yellow unless meets_conditions?
|
69
|
+
|
43
70
|
if exist?
|
44
71
|
if has_backup?
|
45
72
|
if synced?
|
@@ -5,10 +5,10 @@ class Dutiful::Command::List < Clamp::Command
|
|
5
5
|
puts "Storage: #{Dutiful::Config.storage.name}\n\n"
|
6
6
|
|
7
7
|
Dutiful::Application.each do |application|
|
8
|
-
puts "#{application.name}:\n" if application.
|
8
|
+
puts "#{application.name}:\n" if application.should_sync? || verbose?
|
9
9
|
|
10
10
|
application.files.map do |file|
|
11
|
-
puts " #{file}" if file.
|
11
|
+
puts " #{file}" if (file.should_sync?) || verbose?
|
12
12
|
end.compact.join("\n")
|
13
13
|
end
|
14
14
|
end
|
@@ -5,7 +5,7 @@ class Dutiful::Command::Sync < Clamp::Command
|
|
5
5
|
puts "Storage: #{Dutiful::Config.storage.name}\n\n"
|
6
6
|
|
7
7
|
Dutiful::Application.each do |application|
|
8
|
-
puts "#{application.name}:\n" if application.
|
8
|
+
puts "#{application.name}:\n" if application.should_sync? || verbose?
|
9
9
|
|
10
10
|
application.sync do |file, result|
|
11
11
|
if result
|
@@ -15,7 +15,7 @@ class Dutiful::Command::Sync < Clamp::Command
|
|
15
15
|
puts " #{file.path} ✖ - #{result.error}".red
|
16
16
|
end
|
17
17
|
elsif verbose?
|
18
|
-
puts " #{file
|
18
|
+
puts " #{file}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/dutiful/storage.rb
CHANGED
@@ -19,7 +19,7 @@ class Dutiful::Storage
|
|
19
19
|
|
20
20
|
def create_dir(file)
|
21
21
|
FileUtils.mkdir_p File.dirname "#{path}/#{file.path}"
|
22
|
-
FileUtils.mkdir_p
|
22
|
+
FileUtils.mkdir_p File.dirname "#{file.full_path}"
|
23
23
|
end
|
24
24
|
|
25
25
|
def exist?(file)
|
@@ -54,7 +54,9 @@ class Dutiful::Storage
|
|
54
54
|
filename = File.basename(file_path)
|
55
55
|
file_backup_path = path "#{file.path}#{filename}"
|
56
56
|
|
57
|
-
|
57
|
+
File.exist?(file_path) &&
|
58
|
+
File.exist?(file_backup_path) &&
|
59
|
+
FileUtils.identical?(file_path, file_backup_path)
|
58
60
|
end
|
59
61
|
else
|
60
62
|
FileUtils.identical? file.full_path, "#{path}/#{file.path}"
|
data/lib/dutiful/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dutiful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Pinto
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- bin/dutiful
|
105
105
|
- config/dropbox.toml
|
106
106
|
- config/icloud.toml
|
107
|
+
- db/alfred.toml
|
107
108
|
- db/brew.toml
|
108
109
|
- db/bundler.toml
|
109
110
|
- db/dash.toml
|
@@ -153,5 +154,5 @@ rubyforge_project:
|
|
153
154
|
rubygems_version: 2.4.5
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
|
-
summary: dutiful-0.0.
|
157
|
+
summary: dutiful-0.0.7
|
157
158
|
test_files: []
|