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.



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

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.



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

def cmd_runner
  @cmd_runner
end

#scriptObject (readonly)

Returns the value of attribute script.



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

def script
  @script
end

Instance Method Details

#runObject



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

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