lib/backup/model.rb in backup-3.11.0 vs lib/backup/model.rb in backup-4.0.0rc1
- old
+ new
@@ -154,31 +154,10 @@
end
##
# Adds an Syncer. Multiple Syncers may be added to the model.
def sync_with(name, syncer_id = nil, &block)
- ##
- # Warn user of DSL changes
- case name.to_s
- when 'Backup::Config::RSync'
- Logger.warn Error.new(<<-EOS)
- Configuration Update Needed for Syncer::RSync
- The RSync Syncer has been split into three separate modules:
- RSync::Local, RSync::Push and RSync::Pull
- Please update your configuration.
- i.e. 'sync_with RSync' is now 'sync_with RSync::Push'
- EOS
- name = 'RSync::Push'
- when /(Backup::Config::S3|Backup::Config::CloudFiles)/
- syncer = $1.split('::')[2]
- Logger.warn Error.new(<<-EOS)
- Configuration Update Needed for '#{ syncer }' Syncer.
- This Syncer is now referenced as Cloud::#{ syncer }
- i.e. 'sync_with #{ syncer }' is now 'sync_with Cloud::#{ syncer }'
- EOS
- name = "Cloud::#{ syncer }"
- end
@syncers << get_class_from_scope(Syncer, name).new(syncer_id, &block)
end
##
# Adds an Notifier. Multiple Notifiers may be added to the model.
@@ -206,11 +185,11 @@
#
# +chunk_size+ is specified in MiB and must be given as an Integer.
# +suffix_length+ controls the number of characters used in the suffix
# (and the maximum number of chunks possible).
# ie. 1 (-a, -b), 2 (-aa, -ab), 3 (-aaa, -aab)
- def split_into_chunks_of(chunk_size, suffix_length = 2)
+ def split_into_chunks_of(chunk_size, suffix_length = 3)
if chunk_size.is_a?(Integer) && suffix_length.is_a?(Integer)
@splitter = Splitter.new(self, chunk_size, suffix_length)
else
raise Error, <<-EOS
Invalid arguments for #split_into_chunks_of()
@@ -356,11 +335,11 @@
# Returns the class/model specified by +name+ inside of +scope+.
# +scope+ should be a Class/Module.
# +name+ may be Class/Module or String representation
# of any namespace which exists under +scope+.
#
- # The 'Backup::Config::' namespace is stripped from +name+,
+ # The 'Backup::Config::DSL' namespace is stripped from +name+,
# since this is the namespace where we define module namespaces
# for use with Model's DSL methods.
#
# Examples:
# get_class_from_scope(Backup::Database, 'MySQL')
@@ -369,10 +348,10 @@
# get_class_from_scope(Backup::Syncer, Backup::Config::RSync::Local)
# returns the class Backup::Syncer::RSync::Local
#
def get_class_from_scope(scope, name)
klass = scope
- name = name.to_s.sub(/^Backup::Config::/, '')
+ name = name.to_s.sub(/^Backup::Config::DSL::/, '')
name.split('::').each do |chunk|
klass = klass.const_get(chunk)
end
klass
end