Sha256: 54616fec865d2fe2e43aa2399a805a9ccd19eeed1d6d6f2edf67a5647e46f481
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module Dbcp class EnvironmentNotFound < StandardError; end class ExecutionError < StandardError; end class Environment ENVIRONMENT_PROVIDERS = [ DatabaseYamlEnvironmentProvider.new('config/database.yml'), UriEnvironmentProvider.new ] 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.1.0 | lib/dbcp/environment.rb |