multisync 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/multisync/cli.rb +16 -6
- data/lib/multisync/runtime.rb +8 -4
- data/lib/multisync/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: 0b40dd5c5699b8fe754bd06fc636e2675694bd300ee28a39eca17ee6ef50bfb7
|
4
|
+
data.tar.gz: 5b532fefc45be4f36aad50f943aae553502e858e91a3c739dd0dc38184998eab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf5932ebd4519b0b32a68746cbfc9eb5398d4279bc62f86d2ec00d706b28f4ab979a79529b6523f21bff9cef9b76c707676d17c0e9e1bcf073518580a786285
|
7
|
+
data.tar.gz: c71f270b5e0000c7a41a7481b6e4321c5fe359bf2a6c4bc78ff634c9ec282441ae8866b156908901af4f8e57c380d65866219334d8f7127371d688c1d09263f8
|
data/README.md
CHANGED
data/lib/multisync/cli.rb
CHANGED
@@ -62,10 +62,14 @@ class Multisync::Cli
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def run_tasks
|
65
|
-
|
66
|
-
|
65
|
+
begin
|
66
|
+
tasks.each do |task|
|
67
|
+
runtime.run task
|
68
|
+
end
|
69
|
+
return if options[:print]
|
70
|
+
rescue Interrupt => e
|
71
|
+
$stderr.puts "\nAborted!".color(:red)
|
67
72
|
end
|
68
|
-
return if options[:print]
|
69
73
|
table = Terminal::Table.new(headings: summary_headings, rows: summary_data, style: table_style)
|
70
74
|
puts
|
71
75
|
puts
|
@@ -77,23 +81,29 @@ class Multisync::Cli
|
|
77
81
|
end
|
78
82
|
|
79
83
|
def summary_data
|
84
|
+
# Exclude tasks with an empty result (> not run) first
|
80
85
|
tasks.map do |task|
|
81
86
|
result = task.result
|
82
87
|
desc = [task.source_description, "--> #{task.destination_description}"]
|
83
88
|
|
84
89
|
case result[:action]
|
85
90
|
when :run
|
86
|
-
if result[:status].success?
|
91
|
+
if result[:status] && result[:status].success?
|
87
92
|
# successfull run
|
88
93
|
stat = Multisync::RsyncStat.new(result[:stdout]).parse
|
89
94
|
[*desc, *stat.to_a.map{|e| {value: e.color(:green), alignment: :right} } ]
|
90
95
|
else
|
91
|
-
# failed run
|
92
|
-
[*desc, { value: result[:stderr].strip.color(:red), colspan: 6 } ]
|
96
|
+
# failed or interrupted run
|
97
|
+
[*desc, { value: (result[:stderr] || 'n/a').strip.color(:red), colspan: 6 } ]
|
93
98
|
end
|
99
|
+
|
94
100
|
when :skip
|
95
101
|
# skiped sync
|
96
102
|
[*desc, { value: result[:skip_message].color(:yellow), colspan: 6 } ]
|
103
|
+
|
104
|
+
else
|
105
|
+
# not executed
|
106
|
+
[*desc, { value: 'not executed'.faint, colspan: 6 } ]
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
data/lib/multisync/runtime.rb
CHANGED
@@ -38,11 +38,15 @@ class Multisync::Runtime
|
|
38
38
|
# special meaning for home, instead of passing it as literal char
|
39
39
|
source, destination = [sync.source, sync.destination].map {|path| path.gsub(/\s+/, '\\ ') }
|
40
40
|
cmd = "rsync #{rsync_options.join(' ')} #{source} #{destination}"
|
41
|
-
|
41
|
+
cmd_options = { timeout: timeout }
|
42
|
+
cmd_options.merge!({live_stdout: $stdout, live_stderr: $stderr}) unless quiet?
|
43
|
+
rsync = Mixlib::ShellOut.new(cmd, cmd_options)
|
42
44
|
sync.result[:cmd] = rsync.command
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
|
46
|
+
unless quiet?
|
47
|
+
puts
|
48
|
+
puts [sync.source_description, sync.destination_description].join(' --> ').color(:cyan)
|
49
|
+
end
|
46
50
|
|
47
51
|
# Perform all only_if checks, from top to bottom
|
48
52
|
sync.checks.each do |check|
|
data/lib/multisync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multisync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Marchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|