Class: Duplicati
- Inherits:
-
Object
- Object
- Duplicati
- Defined in:
- lib/duplicati.rb,
lib/duplicati/clean.rb,
lib/duplicati/backup.rb,
lib/duplicati/command.rb,
lib/duplicati/version.rb,
lib/duplicati/notification/base.rb,
lib/duplicati/notification/mail.rb,
lib/duplicati/notification/growl.rb
Defined Under Namespace
Modules: Notification Classes: Backup, Clean, Command
Constant Summary collapse
- VERSION =
"3.0.0"
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Class Method Summary collapse
Instance Method Summary collapse
- #backup ⇒ Object
- #clean ⇒ Object
-
#execution_success? ⇒ Boolean
code.google.com/p/duplicati/issues/detail?id=678 0 - Success 1 - Success (but no changed files) 2 - Completed by retried some files, or some files were locked (warnings) 50 - Some files were uploaded, then connection died 100 - No connection to server -> Fatal error 200 - Invalid command/arguments.
-
#initialize(opts = {}) ⇒ Duplicati
constructor
A new instance of Duplicati.
- #notify ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Duplicati
Returns a new instance of Duplicati.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/duplicati.rb', line 19 def initialize(opts={}) opts[:log_path] ||= "duplicati.log" opts[:duplicati_path] = duplicati_path(opts[:duplicati_path]) opts[:notifications] ||= [Notification::Growl.new] opts[:inclusion_filters] ||= [opts[:inclusion_filter]].compact opts[:exclusion_filters] ||= [opts[:exclusion_filter]].compact if !opts[:inclusion_filters].empty? && opts[:exclusion_filters].empty? opts[:exclusion_filters] = [%r{.*[^\\/]}] end @opts = opts @execution_success = true end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
17 18 19 |
# File 'lib/duplicati.rb', line 17 def opts @opts end |
Class Method Details
.backup(opts = {}) ⇒ Object
12 13 14 |
# File 'lib/duplicati.rb', line 12 def backup(opts={}) new(opts).backup.clean.notify end |
Instance Method Details
#backup ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/duplicati.rb', line 34 def backup execute Backup.new( :duplicati_path, :backup_paths, :backup_store_path, :backup_encryption_key, :inclusion_filters, :exclusion_filters, :log_path ).command self end |
#clean ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/duplicati.rb', line 43 def clean execute Clean.new( :duplicati_path, :backup_store_path, :backup_encryption_key, :log_path ).command self end |
#execution_success? ⇒ Boolean
code.google.com/p/duplicati/issues/detail?id=678 0 - Success 1 - Success (but no changed files) 2 - Completed by retried some files, or some files were locked (warnings) 50 - Some files were uploaded, then connection died 100 - No connection to server -> Fatal error 200 - Invalid command/arguments
66 67 68 |
# File 'lib/duplicati.rb', line 66 def execution_success? @execution_success &&= @exit_status && @exit_status.between?(0, 2) end |
#notify ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/duplicati.rb', line 51 def notify @opts[:notifications].each do |notification| notification.notify execution_success? end self end |