duplicati 0.0.8 → 0.0.9

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.
@@ -3,14 +3,22 @@ class Duplicati
3
3
  def initialize(opts)
4
4
  @duplicati_path = opts[:duplicati_path]
5
5
  @backup_store_path = opts[:backup_store_path] or raise ":backup_store_path option is missing for clean!"
6
+ @backup_encryption_key = opts[:backup_encryption_key]
6
7
  @log_path = opts[:log_path]
7
8
  end
8
9
 
9
10
  def command
10
11
  %Q["#{@duplicati_path}" delete-all-but-n 5 "#{@backup_store_path}"
12
+ #{encryption_option}
11
13
  --force
12
14
  2>&1 1>> "#{@log_path}"]
13
15
  end
14
16
 
17
+ private
18
+
19
+ def encryption_option
20
+ %Q[--passphrase="#{@backup_encryption_key}"] if @backup_encryption_key
21
+ end
22
+
15
23
  end
16
24
  end
@@ -1,3 +1,3 @@
1
1
  class Duplicati
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/duplicati.rb CHANGED
@@ -41,7 +41,7 @@ class Duplicati
41
41
 
42
42
  def clean
43
43
  execute Clean.new(
44
- options :duplicati_path, :backup_store_path, :log_path
44
+ options :duplicati_path, :backup_store_path, :backup_encryption_key, :log_path
45
45
  ).command
46
46
 
47
47
  self
@@ -55,6 +55,17 @@ class Duplicati
55
55
  self
56
56
  end
57
57
 
58
+ # https://code.google.com/p/duplicati/issues/detail?id=678
59
+ # 0 - Success
60
+ # 1 - Success (but no changed files)
61
+ # 2 - Completed by retried some files, or some files were locked (warnings)
62
+ # 50 - Some files were uploaded, then connection died
63
+ # 100 - No connection to server -> Fatal error
64
+ # 200 - Invalid command/arguments
65
+ def execution_success?
66
+ @execution_success &&= @exit_status && @exit_status.between?(0, 2)
67
+ end
68
+
58
69
  private
59
70
 
60
71
  def duplicati_path(path_from_options)
@@ -80,16 +91,5 @@ class Duplicati
80
91
  command.gsub($/, "").squeeze(" ")
81
92
  end
82
93
 
83
- # https://code.google.com/p/duplicati/issues/detail?id=678
84
- # 0 - Success
85
- # 1 - Success (but no changed files)
86
- # 2 - Completed by retried some files, or some files were locked (warnings)
87
- # 50 - Some files were uploaded, then connection died
88
- # 100 - No connection to server -> Fatal error
89
- # 200 - Invalid command/arguments
90
- def execution_success?
91
- @execution_success &&= @exit_status && @exit_status.between?(0, 2)
92
- end
93
-
94
94
  end
95
95
 
@@ -18,6 +18,19 @@ describe Duplicati::Clean do
18
18
  :backup_store_path => "file:///foo/backup",
19
19
  :log_path => "/zzz/output.log"
20
20
  ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 5 "file:///foo/backup"
21
+
22
+ --force
23
+ 2>&1 1>> "/zzz/output.log"]
24
+ end
25
+
26
+ it "generates clean command for Duplicati using backup encryption" do
27
+ Duplicati::Clean.new(
28
+ :duplicati_path => "/bin/duplicati-commandline",
29
+ :backup_store_path => "file:///foo/backup",
30
+ :backup_encryption_key => "foobar",
31
+ :log_path => "/zzz/output.log"
32
+ ).command.should == %Q["/bin/duplicati-commandline" delete-all-but-n 5 "file:///foo/backup"
33
+ --passphrase="foobar"
21
34
  --force
22
35
  2>&1 1>> "/zzz/output.log"]
23
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duplicati
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  segments:
90
90
  - 0
91
- hash: -685447987
91
+ hash: 935446881
92
92
  required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  none: false
94
94
  requirements:
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: -685447987
100
+ hash: 935446881
101
101
  requirements: []
102
102
  rubyforge_project:
103
103
  rubygems_version: 1.8.24