lib/backup/configuration/base.rb in backup-2.3.2.pre3 vs lib/backup/configuration/base.rb in backup-2.3.2

- old
+ new

@@ -1,10 +1,10 @@ module Backup module Configuration class Base extend Backup::Configuration::Attributes - generate_attributes %w(encrypt_with_password keep_backups notify) + generate_attributes %w(encrypt_with_password encrypt_with_gpg_public_key keep_backups notify) attr_accessor :trigger, :storage_name, :adapter_name def initialize(trigger) @trigger = trigger @@ -20,30 +20,38 @@ def storage(storage, &block) @storage_name = storage @storage_configuration.instance_eval &block end - # Initializes the storing process depending on the store settings - def initialize_storage(adapter) + def storage_class case @storage_name.to_sym - when :cloudfiles then Backup::Storage::CloudFiles.new(adapter) - when :s3 then Backup::Storage::S3.new(adapter) - when :scp then Backup::Storage::SCP.new(adapter) - when :ftp then Backup::Storage::FTP.new(adapter) - when :sftp then Backup::Storage::SFTP.new(adapter) - when :local then Backup::Storage::Local.new(adapter) + when :cloudfiles then Backup::Storage::CloudFiles + when :s3 then Backup::Storage::S3 + when :scp then Backup::Storage::SCP + when :ftp then Backup::Storage::FTP + when :sftp then Backup::Storage::SFTP + when :local then Backup::Storage::Local end end - def initialize_record + def record_class case @storage_name.to_sym - when :cloudfiles then Backup::Record::CloudFiles.new - when :s3 then Backup::Record::S3.new - when :scp then Backup::Record::SCP.new - when :ftp then Backup::Record::FTP.new - when :sftp then Backup::Record::SFTP.new - when :local then Backup::Record::Local.new + when :cloudfiles then Backup::Record::CloudFiles + when :s3 then Backup::Record::S3 + when :scp then Backup::Record::SCP + when :ftp then Backup::Record::FTP + when :sftp then Backup::Record::SFTP + when :local then Backup::Record::Local end + end + + # Initializes the storing process depending on the store settings + def initialize_storage(adapter) + storage_class.new(adapter) + end + + def initialize_record + record_class.new end def get_adapter_configuration @adapter_configuration end