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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61ac03244c8167301ec37ba7e610862fd8a04bbcbf076ae924d6e68de7a433ca
4
- data.tar.gz: '06986d1e288623a55578897df7ad2e29245077387b9f49aacf0e0c5e1be5517d'
3
+ metadata.gz: 0b40dd5c5699b8fe754bd06fc636e2675694bd300ee28a39eca17ee6ef50bfb7
4
+ data.tar.gz: 5b532fefc45be4f36aad50f943aae553502e858e91a3c739dd0dc38184998eab
5
5
  SHA512:
6
- metadata.gz: 661926fde8d62277b7865747afc6af70e991ab23ec92c1c34a1ec742a580d3a8a6b4b136d043a417ee304f25586ed20039895926c79988bcb44ba91a800f7c11
7
- data.tar.gz: 73c84b8e6dd7218c63ae1e9be51bf6775caa3715f73c0a4b896363832623310b9bfcdcf180f0b149efa5612a4abce4a783cb59429e63cc5b17347f2e82f55496
6
+ metadata.gz: dcf5932ebd4519b0b32a68746cbfc9eb5398d4279bc62f86d2ec00d706b28f4ab979a79529b6523f21bff9cef9b76c707676d17c0e9e1bcf073518580a786285
7
+ data.tar.gz: c71f270b5e0000c7a41a7481b6e4321c5fe359bf2a6c4bc78ff634c9ec282441ae8866b156908901af4f8e57c380d65866219334d8f7127371d688c1d09263f8
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/multisync.svg)](https://badge.fury.io/rb/multisync)
2
2
 
3
- # Multisync
3
+ # multisync
4
4
 
5
5
  Multisync offers a DSL to organize sets of rsync tasks. It takes advantage of templates, groups and inheritance to simplify things.
6
6
 
data/lib/multisync/cli.rb CHANGED
@@ -62,10 +62,14 @@ class Multisync::Cli
62
62
  end
63
63
 
64
64
  def run_tasks
65
- tasks.each do |task|
66
- runtime.run task
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
@@ -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
- rsync = Mixlib::ShellOut.new(cmd, live_stdout: $stdout, live_stderr: $stderr, timeout: timeout)
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
- puts
45
- puts [sync.source_description, sync.destination_description].join(' --> ').color(:cyan)
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|
@@ -1,3 +1,3 @@
1
1
  module Multisync
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
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
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-07-23 00:00:00.000000000 Z
11
+ date: 2019-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout