dutiful 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8a2e348ad20c4d7f7f6c8020c335d26f307fcbb
4
- data.tar.gz: 40ec00a948a65351aeaa8c0a79282f4e6f5bd2a0
3
+ metadata.gz: 5b2d24e92e594e4d002fa704e1905bcfdd5c00d8
4
+ data.tar.gz: 4182128d6260adf521da67deb4954c2b924275e7
5
5
  SHA512:
6
- metadata.gz: a83c9c088f34fa2e491f7a36398ee11336e0b9dc36a2d440aa251efe077f6a716c8d39902beb508016b87f81bf7054f7ebcfd8ba34253b2ecb5e4fe1f7bc6c11
7
- data.tar.gz: 6496d9a4531a3eefe2099f4c91e8bc76efc3385e2fb46f44d25f571d4a9042888320488e751f68c6e0353148c1562eba0281a8764de5639ce50ed9b57aff8460
6
+ metadata.gz: 1e23b10f5b0fa954b90c0d0ae0230dc7b41c1550ee112e0cb276df866b2cdeefa1e816eaa66cc558827b8ae16fb6ab60214f9ec59870f384d7db66f53c48af83
7
+ data.tar.gz: 647585ea6e8a09d29e41382823044ee770e4cdac4f5b29fe1e3565719b3cc88099769003d5a655e5cd6459ed86abad070ed2b07eacf317ff1bdfe86b9abcd2ff
data/db/brew.toml ADDED
@@ -0,0 +1,5 @@
1
+ [application]
2
+ name = 'Brew'
3
+
4
+ [[files]]
5
+ path = 'Brewfile'
data/db/git.toml CHANGED
@@ -3,3 +3,4 @@ name = 'Git'
3
3
 
4
4
  [[files]]
5
5
  path = '.gitconfig'
6
+ path = '.gitignore'
@@ -0,0 +1,5 @@
1
+ [application]
2
+ name = 'The Silver Seacher'
3
+
4
+ [[files]]
5
+ path = '.agignore'
data/db/tmuxline.toml ADDED
@@ -0,0 +1,5 @@
1
+ [application]
2
+ name = 'tmuxline.vim'
3
+
4
+ [[files]]
5
+ path = '.tmuxline'
data/db/z.toml ADDED
@@ -0,0 +1,5 @@
1
+ [application]
2
+ name = 'z'
3
+
4
+ [[files]]
5
+ path = '.z'
@@ -15,6 +15,10 @@ class Dutiful::Application
15
15
  files.any? &:exist?
16
16
  end
17
17
 
18
+ def has_backup?
19
+ files.any? &:has_backup?
20
+ end
21
+
18
22
  def sync
19
23
  files.each do |file|
20
24
  if file.exist? || file.has_backup?
@@ -26,12 +30,8 @@ class Dutiful::Application
26
30
  end
27
31
  end
28
32
 
29
- def to_s
30
- output = "#{name}:\n"
31
-
32
- output << files.map do |file|
33
- " #{file}" if file.exist? || file.has_backup?
34
- end.compact.join("\n")
33
+ def synced?
34
+ files.all? &:synced?
35
35
  end
36
36
 
37
37
  def self.all
@@ -32,15 +32,19 @@ class Dutiful::ApplicationFile
32
32
 
33
33
  def to_s
34
34
  if exist?
35
- return "#{path} ✔".green if synced?
36
-
37
35
  if has_backup?
38
- return "#{path} (modified)".yellow
36
+ if synced?
37
+ "#{path} ✔".green
38
+ else
39
+ "#{path} (modified)".yellow
40
+ end
39
41
  else
40
- return "#{path} (pending backup)".yellow
42
+ "#{path} (pending backup)".yellow
41
43
  end
44
+ elsif has_backup?
45
+ "#{path} (pending restore)".yellow
46
+ else
47
+ "#{path} does not exist (skipping)".yellow
42
48
  end
43
-
44
- "#{path} (pending restore)".yellow if has_backup?
45
49
  end
46
50
  end
@@ -1,7 +1,15 @@
1
1
  class Dutiful::Command::List < Clamp::Command
2
+ option ['-v', '--verbose'], :flag, 'Verbose mode'
3
+
2
4
  def execute
3
5
  puts "Storage: #{Dutiful::Config.storage.name}\n\n"
4
6
 
5
- puts Dutiful::Application.all
7
+ Dutiful::Application.each do |application|
8
+ puts "#{application.name}:\n" if application.exist? || application.has_backup? || verbose?
9
+
10
+ application.files.map do |file|
11
+ puts " #{file}" if file.exist? || file.has_backup? || verbose?
12
+ end.compact.join("\n")
13
+ end
6
14
  end
7
15
  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"
8
+ puts "#{application.name}:\n" if application.exist? || application.has_backup? || verbose?
9
9
 
10
10
  application.sync do |file, result|
11
11
  if result
@@ -14,8 +14,8 @@ class Dutiful::Command::Sync < Clamp::Command
14
14
  else
15
15
  puts " #{file.path} ✖ - #{result.error}".red
16
16
  end
17
- else
18
- puts " #{file.path} does not exist (skipping)".yellow if verbose?
17
+ elsif verbose?
18
+ puts " #{file.path} does not exist (skipping)".yellow
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Dutiful
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Pinto
@@ -104,13 +104,17 @@ files:
104
104
  - bin/dutiful
105
105
  - config/dropbox.toml
106
106
  - config/icloud.toml
107
+ - db/brew.toml
107
108
  - db/bundler.toml
108
109
  - db/dutiful.toml
109
110
  - db/fish.toml
110
111
  - db/git.toml
111
112
  - db/iterm2.toml
113
+ - db/the_silver_searcher.toml
112
114
  - db/tmux.toml
115
+ - db/tmuxline.toml
113
116
  - db/vim.toml
117
+ - db/z.toml
114
118
  - lib/dutiful.rb
115
119
  - lib/dutiful/application.rb
116
120
  - lib/dutiful/application_file.rb
@@ -144,5 +148,5 @@ rubyforge_project:
144
148
  rubygems_version: 2.4.5
145
149
  signing_key:
146
150
  specification_version: 4
147
- summary: dutiful-0.0.3
151
+ summary: dutiful-0.0.4
148
152
  test_files: []