Class: Backup::Record::Base

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/backup/record/base.rb

Direct Known Subclasses

FTP, Local, S3, SCP, SFTP

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adapter_configObject

Attributes



17
18
19
# File 'lib/backup/record/base.rb', line 17

def adapter_config
  @adapter_config
end

#keep_backupsObject

Attributes



17
18
19
# File 'lib/backup/record/base.rb', line 17

def keep_backups
  @keep_backups
end

Class Method Details

.destroy_all_backups(procedure, trigger) ⇒ Object

Destroys all backups for the specified trigger from Remote Server (FTP)



32
33
34
35
36
37
38
39
40
# File 'lib/backup/record/base.rb', line 32

def self.destroy_all_backups(procedure, trigger)
  backups = self.all(:conditions => {:trigger => trigger})
  unless backups.empty?
    # Derived classes must implement this method!
    self.destroy_backups(procedure, backups)
    
    puts "\nAll \"#{procedure.trigger}\" backups destroyed.\n\n"
  end
end

Instance Method Details

#load_adapter(adapter) ⇒ Object

Receives the options hash and stores it



20
21
22
23
24
25
26
27
28
29
# File 'lib/backup/record/base.rb', line 20

def load_adapter(adapter)
  self.adapter_config = adapter
  self.trigger        = adapter.procedure.trigger
  self.adapter        = adapter.procedure.adapter_name.to_s
  self.filename       = adapter.final_file
  self.keep_backups   = adapter.procedure.attributes['keep_backups']
  
  # TODO calculate md5sum of file
  load_specific_settings(adapter) if respond_to?(:load_specific_settings)
end