Sha256: 34fdba6b5b2ec97fcb058d521e70b9813985680a8e7f60f48c9f78128d7b1f09
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
# -*- coding: utf-8 -*- require "fidius-common/yamldb/yaml_db" module FIDIUS module Common # Provides methods for the export/import of database dumps to/from YAML. module Db # Exports database schema and content to yml file. This should work # for all ActiveRecord database adapters. # # @param [String] path to yml file with database configuration # @param [String] name of the db to export, must match an entry in the yml configuration file. # @param [String] target dir where the exported data should be stored # @param [Boolean] create target dir with timestamp in the dirname def self.export(config_filename, db_entry, target_dir = "", timestamp = true) dumper = SerializationHelper::Base.new(YamlDb::Helper, config_filename, db_entry) dumper.dump(target_dir, timestamp) end # Imports the content of a previously exported yml file. # # @param [String] path to yml file with database configuration # @param [String] name of the db to export, must match an entry in the yml configuration file. # @param [String] dir to the previously exported yml file def self.import(config_filename, db_entry, import_dir) loader = SerializationHelper::Base.new(YamlDb::Helper, config_filename, db_entry) loader.load(import_dir) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fidius-common-0.0.6 | lib/fidius-common/yamldb.rb |
fidius-common-0.0.5 | lib/fidius-common/yamldb.rb |
fidius-common-0.0.4beta0 | lib/fidius-common/yamldb.rb |