Sha256: 3a507c8bec43f0533e1f224cab4db4716e33325987d4d76432188934d3775c06
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module Dbcp class EnvironmentNotFound < StandardError; end class ExecutionError < StandardError; end class Environment ENVIRONMENT_PROVIDERS = [ DatabaseYamlEnvironmentProvider.new('config/database.yml') ] class << self def find(environment_name) ENVIRONMENT_PROVIDERS.each do |provider| environment = provider.find environment_name return environment if environment end raise EnvironmentNotFound.new "Could not locate '#{environment_name}' environment" end end # coersion causes issues when assigning rspec doubles include Virtus.value_object(coerce: false) values do attribute :environment_name, String attribute :database, Database attribute :execution_host, ExecutionHost end def export DatabaseSnapshotFile.new(self).tap do |snapshot_file| execution_host.execute database.export_command(snapshot_file) end end def import(snapshot_file) execution_host.execute database.import_command(snapshot_file) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dbcp-0.0.1 | lib/dbcp/environment.rb |