Module: Alchemy::Tasks::Helpers

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

Instance Method Summary collapse

Instance Method Details

#database_configObject



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

def database_config
  raise "Could not find #{database_config_file}!" if !File.exists?(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



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

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

#database_import_command(adapter) ⇒ Object



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

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