rsyncbackup 2.0.5 → 2.1.1

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: cd638cd1c9f3af9ee9ede11eeb571413e570cb54
4
- data.tar.gz: f51a1ae7ceb42660093230da4f1788e640da9d9a
3
+ metadata.gz: 461b1bf53f729f56cee8d7c4fc1139b7cdd5c933
4
+ data.tar.gz: 1a87c1837c47b8059c9b4433f819f35db78bc0bf
5
5
  SHA512:
6
- metadata.gz: c925add59bf3076cfa7086ef9b9253765d73dfc5914291e2a8a4a1ba31b8034231012db5074f834a512171b20ee09dc00e95b20798f4ca5898c7ab50793043a9
7
- data.tar.gz: d6bf332aa5e2b34f4c23d0aa5ac3a4b27a9e3dfdddbf5a3e6f30dfc3176c46e894e512f4e4ff71c0d261389c9702f805d1d371b4260d973ecae6e0357c2629a1
6
+ metadata.gz: 1ecae151fd9c7b238ed18326dad926164955ec8939b79712d1d46ff12c6ec3a3306b354e035adfa4f9bbc436b2d627b4c046c98910b89ed8c73a14454cb86817
7
+ data.tar.gz: a3fbdf1a992ff78fc7f82e7d6645a74d4d9c62023959cc647eeea05e697d2fe040bb07c687cd529b265d02afa50f2049c780ecf9df6bda8b87b9b9a904340ee9
data/bin/rsyncbackup CHANGED
@@ -14,18 +14,11 @@ class App
14
14
  begin
15
15
  syncer = Rsyncbackup.new(source, target, options)
16
16
  syncer.run
17
- syncer.finalize
18
- if syncer.status.success?
19
- info syncer.output
20
- else
21
- error syncer.error
22
- end
23
17
  rescue Exception => e
24
18
  error "Error occured in rsyncbackup: #{e.class} #{e}"
25
- debug "Backtrace:\n#{e.backtrace}"
19
+ debug "Backtrace:\n#{e.backtrace.join("\n")}"
26
20
  exit 127
27
21
  end
28
- syncer.status.exitstatus
29
22
  end
30
23
 
31
24
  description "Yet another rsync backup script, this time in ruby"
data/lib/rsyncbackup.rb CHANGED
@@ -55,16 +55,13 @@ class Rsyncbackup
55
55
 
56
56
  # the dry run option will be passed through to the rsync command,
57
57
  # so we still do want to run it.
58
- self.output, self.error, self.status = Open3.capture3(@cmd)
59
- debug "#{caller(0,1).first} self.output.size: #{self.output.size} self.error.size: #{self.error.size} self.status #{self.status.inspect}"
60
- raise "Rsync Error: exit status: #{self.status.exit_code}: error: #{e}" unless self.status.success?
58
+ self.status = _run_the_command(@cmd)
59
+ debug "#{caller(0,1).first} self.status #{self.status.inspect}"
60
+ raise "Rsync Error: exit status: #{self.status.exitstatus}" unless (self.status.success? || self.status.exitstatus == 23) # don't abort if some files could not be transferred
61
+ finalize
61
62
  self
62
63
  end
63
64
 
64
- def success?
65
- (@status.nil?) ? nil : @status.success?
66
- end
67
-
68
65
  def finalize
69
66
  File.rename(@incomplete, @complete) if File.exist?(@incomplete)
70
67
  File.write(File.join(@target,DEFAULT_LAST_FULL_DIR_NAME), backup_dir_name)
@@ -12,7 +12,31 @@
12
12
  require 'methadone'
13
13
 
14
14
  class Rsyncbackup
15
-
15
+
16
+ def _run_the_command(cmd)
17
+ Open3.popen3(cmd) do |stdin, stdout, stderr, t|
18
+ pid = t.pid
19
+ stdin.close
20
+ err_thr = Thread.new { copy_lines(stderr, $stderr) }
21
+ puts "Reading STDOUT"
22
+ copy_lines(stdout, $stdout)
23
+ err_thr.join
24
+ t.value
25
+ end
26
+ end
27
+
28
+ def copy_lines(str_in, str_out)
29
+ str_in.each_line {|line| str_out.puts line}
30
+ end
31
+
32
+
33
+
34
+ # returns true if the rsync command was successful
35
+ def success?
36
+ (@status.nil?) ? nil : @status.success?
37
+ end
38
+
39
+
16
40
  # returns the command string to execute with all parameters set
17
41
  def build_command
18
42
 
@@ -1,5 +1,5 @@
1
1
  class Rsyncbackup
2
- VERSION = "2.0.5"
2
+ VERSION = "2.1.1"
3
3
  DEFAULT_EXCLUSIONS = File.expand_path('.rsyncbackup.exclusions', ENV['HOME'])
4
4
  DEFAULT_INCOMPLETE_DIR_NAME = '.incomplete'
5
5
  DEFAULT_LAST_FULL_DIR_NAME = '.lastfull'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyncbackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tamara Temple