class DbToFile::Unloader

Public Class Methods

new() click to toggle source
# File lib/db_to_file/unloader.rb, line 3
def initialize
  # Load config and build database connection, before stashing possible changes
  @config ||= config
  ActiveRecord::Base.connection.tables
end

Public Instance Methods

unload() click to toggle source
# File lib/db_to_file/unloader.rb, line 9
def unload
  prepare_code_version
  unload_tables
  update_code_version
  restore_local_stash
end

Private Instance Methods

config() click to toggle source
# File lib/db_to_file/unloader.rb, line 48
def config
  Config.instance
end
prepare_code_version() click to toggle source
# File lib/db_to_file/unloader.rb, line 17
def prepare_code_version
  version_controller.prepare_code_version
end
restore_local_stash() click to toggle source
# File lib/db_to_file/unloader.rb, line 36
def restore_local_stash
  version_controller.restore_local_stash
end
tables() click to toggle source
# File lib/db_to_file/unloader.rb, line 44
def tables
  config.tables
end
unload_tables() click to toggle source
# File lib/db_to_file/unloader.rb, line 21
def unload_tables
  puts 'Start downloading tables'
  tables.each do |table_name|
    puts "Downloading table '#{table_name}'"
    Table.new(table_name, self).unload
  end
  puts 'Done downloading tables'
end
update_code_version() click to toggle source
# File lib/db_to_file/unloader.rb, line 30
def update_code_version
  puts 'Start updating code version'
  version_controller.update_code_version
  puts 'Done updating code version'
end
version_controller() click to toggle source
# File lib/db_to_file/unloader.rb, line 40
def version_controller
  @version_controller ||= VersionController.new
end