Class: Dbmanager::Adapters::Mysql::Importer

Inherits:
Object
  • Object
show all
Includes:
Connectable
Defined in:
lib/dbmanager/adapters/mysql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Connectable

#params

Constructor Details

#initialize(source, target, tmp_file) ⇒ Importer

Returns a new instance of Importer.



104
105
106
107
108
# File 'lib/dbmanager/adapters/mysql.rb', line 104

def initialize(source, target, tmp_file)
  @source   = source
  @target   = target
  @tmp_file = tmp_file
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



102
103
104
# File 'lib/dbmanager/adapters/mysql.rb', line 102

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



102
103
104
# File 'lib/dbmanager/adapters/mysql.rb', line 102

def target
  @target
end

#tmp_fileObject (readonly)

Returns the value of attribute tmp_file.



102
103
104
# File 'lib/dbmanager/adapters/mysql.rb', line 102

def tmp_file
  @tmp_file
end

Instance Method Details

#remove_tmp_fileObject



117
118
119
# File 'lib/dbmanager/adapters/mysql.rb', line 117

def remove_tmp_file
  Dbmanager.execute "rm '#{tmp_file}'"
end

#runObject



110
111
112
113
114
115
# File 'lib/dbmanager/adapters/mysql.rb', line 110

def run
  Dumper.new(source, tmp_file).run
  Loader.new(target, tmp_file).run
ensure
  remove_tmp_file
end