Class: Backup::Performer

Inherits:
Object
  • Object
show all
Defined in:
lib/backup-agent/performer.rb

Instance Method Summary collapse

Constructor Details

#initialize(storages) ⇒ Performer

Returns a new instance of Performer.



6
7
8
# File 'lib/backup-agent/performer.rb', line 6

def initialize(storages)
  @storages = storages
end

Instance Method Details

#directory(path, options = {}) ⇒ Object



25
26
27
# File 'lib/backup-agent/performer.rb', line 25

def directory(path, options = {})
  task Backup::Tasks::Directory => [path, options]
end

#mysql(options) ⇒ Object



18
19
20
21
22
23
# File 'lib/backup-agent/performer.rb', line 18

def mysql(options)
  if Symbol === options[:credentials]
    options[:credentials] = credentials(mysql: options[:credentials])
  end
  task Backup::Tasks::MySQL => [options]
end

#task(arg) ⇒ Object

task Task => [:foo, :bar, :baz]



11
12
13
14
15
16
# File 'lib/backup-agent/performer.rb', line 11

def task(arg)
  arg.each do |klass, args|
    @storages.each { |storage| klass.new(*args).perform(storage) }
  end
  nil
end