Module: Machines::Commands::Database

Included in:
Machines::Core
Defined in:
lib/machines/commands/database.rb

Instance Method Summary collapse

Instance Method Details

#write_database_yml(app) ⇒ Object

Write the database.yml file from webapps.yml

Parameters:

  • app (AppBuilder)


6
7
8
9
10
11
12
13
14
15
# File 'lib/machines/commands/database.rb', line 6

def write_database_yml app
  yml = {$conf.environment.to_s => {
    'adapter' => 'mysql',
    'database' => app.database || app.name,
    'username' => app.username || app.name,
    'password' => app.password,
    'host' => $conf.db_server.address,
    'encoding' => 'utf8'}}.to_yaml
  write yml, :to => File.join(app.path, 'shared/config/database.yml'), :name => 'database.yml'
end