Class: Dbcp::Environment
- Inherits:
-
Object
- Object
- Dbcp::Environment
- Defined in:
- lib/dbcp/environment.rb
Constant Summary collapse
- ENVIRONMENT_PROVIDERS =
[ DatabaseYamlEnvironmentProvider.new('config/database.yml'), UriEnvironmentProvider.new, (Capistrano3EnvironmentProvider.new if defined?(Capistrano3EnvironmentProvider.new)) ].compact
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find(environment_name) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/dbcp/environment.rb', line 13 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 |
Instance Method Details
#export ⇒ Object
31 32 33 34 35 |
# File 'lib/dbcp/environment.rb', line 31 def export DatabaseSnapshotFile.new(self).tap do |snapshot_file| execution_host.execute database.export_command(snapshot_file) end end |
#import(snapshot_file) ⇒ Object
37 38 39 |
# File 'lib/dbcp/environment.rb', line 37 def import(snapshot_file) execution_host.execute database.import_command(snapshot_file) end |