Class: Baya::Runner

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Runner

Returns a new instance of Runner.



4
5
6
# File 'lib/baya/runner.rb', line 4

def initialize(config)
  @config = config
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/baya/runner.rb', line 8

def run
  @config.adapters.each do |a|
    if klass = Adapters.from_name(a.type)
      adapter = klass.new(a.config)
    else
      raise "Unknown adapter `#{a.type}`" unless adapter
    end

    case a.mode
    when 'archive'
      adapter.archive(@config.root)
    when 'backup'
      adapter.backup(@config.root)
    else
      raise "Unknown mode `#{a.mode}` for adapter `#{a.type}`"
    end
  end
end