lib/backup/syncer/base.rb in backup-3.7.2 vs lib/backup/syncer/base.rb in backup-3.8.0
- old
+ new
@@ -18,17 +18,20 @@
# Optional user-defined identifier to differentiate multiple syncers
# defined within a single backup model. Currently this is only used
# in the log messages.
attr_reader :syncer_id
+ attr_reader :excludes
+
def initialize(syncer_id = nil)
@syncer_id = syncer_id
load_defaults!
@mirror ||= false
- @directories = Array.new
+ @directories = []
+ @excludes = []
end
##
# Syntactical suger for the DSL for adding directories
def directories(&block)
@@ -36,9 +39,16 @@
instance_eval(&block)
end
def add(path)
directories << path
+ end
+
+ # For Cloud Syncers, +pattern+ can be a string (with shell-style
+ # wildcards) or a regex.
+ # For RSync, each +pattern+ will be passed to rsync's --exclude option.
+ def exclude(pattern)
+ excludes << pattern
end
private
def syncer_name