Module: Alchemy::Tasks::Helpers

Defined in:
lib/alchemy/tasks/helpers.rb

Instance Method Summary collapse

Instance Method Details

#database_configObject



12
13
14
15
16
17
18
19
20
# File 'lib/alchemy/tasks/helpers.rb', line 12

def database_config
  raise "Could not find #{database_config_file}!" if !File.exist?(database_config_file)
  @database_config ||= begin
    config_file = YAML.load(ERB.new(File.read(database_config_file)).result)
    config_file.fetch(environment)
  rescue KeyError
      raise "Database configuration for #{environment} not found!"
  end
end

#database_dump_command(adapter) ⇒ Object



4
5
6
# File 'lib/alchemy/tasks/helpers.rb', line 4

def database_dump_command(adapter)
  database_command(adapter, 'dump')
end

#database_import_command(adapter) ⇒ Object



8
9
10
# File 'lib/alchemy/tasks/helpers.rb', line 8

def database_import_command(adapter)
  database_command(adapter, 'import')
end