Class: Remotebackup::Backup

Inherits:
Object
  • Object
show all
Defined in:
lib/remotebackup.rb

Instance Method Summary collapse

Constructor Details

#initialize(config_file, config_out_dir) ⇒ Backup

Returns a new instance of Backup.



189
190
191
192
193
194
195
196
197
# File 'lib/remotebackup.rb', line 189

def initialize(config_file,config_out_dir)
  @config_file = config_file
  @config_out_dir = config_out_dir
  @doc = YAML.load_file(@config_file)
  @conf_backups = Array.new
  @doc.each do |key,val|
    @conf_backups.push(val.merge(:name => key))
  end
end

Instance Method Details

#startObject



198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/remotebackup.rb', line 198

def start
  @conf_backups.each do |conf|
    bkup = BackupInfo.new(conf)
    msg_out "--------------------------------"
    msg_out "Backup start #{conf['name']}"
    msg_out "--------------------------------"
    bkup.differencial_copy(@config_out_dir)
    if bkup.mod
      bkup.outputYaml(@config_out_dir)
    else
      bkup.cleanFileInfo()
    end
  end
end