Class: Dumpdb::Runner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(script, opts = {}) ⇒ Runner

Returns a new instance of Runner.



8
9
10
11
# File 'lib/dumpdb/runner.rb', line 8

def initialize(script, opts={})
  @script = script
  @cmd_runner = opts[:cmd_runner] || scmd_cmd_runner
end

Instance Attribute Details

#cmd_runnerObject (readonly)

Returns the value of attribute cmd_runner.



6
7
8
# File 'lib/dumpdb/runner.rb', line 6

def cmd_runner
  @cmd_runner
end

#scriptObject (readonly)

Returns the value of attribute script.



6
7
8
# File 'lib/dumpdb/runner.rb', line 6

def script
  @script
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dumpdb/runner.rb', line 13

def run
  run_callback 'before_run'
  run_callback 'before_setup'
  run_setup

  begin
    run_callback 'after_setup'
    [:dump, :copy_dump, :restore].each{|phase_name| run_phase phase_name}
  ensure
    run_phase 'teardown'
    run_callback 'after_run'
  end
end