Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5705632955
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (35 sloc) 0.917 kb
# TODO think about a better way
db_name = app_path.split('/').last
database = options[:database].sub(/jdbc/, '')
database = 'postgres' if database == 'postgresql'
database = 'sqlite' if database == 'sqlite3'
prefix = ''
postfix = ''
prefix = 'db/' if database == 'sqlite'
postfix = '.db' if database == 'sqlite'
remove_file 'config/database.yml'
create_file 'config/database.yml' do
<<-YAML
defaults: &defaults
adapter: #{database}
development:
database: #{prefix}#{db_name}_development#{postfix}
<<: *defaults
# Add more repositories
# repositories:
# repo1:
# adapter: postgres
# database: sample_development
# username: the_user
# password: secrets
# host: localhost
# repo2:
# ...
test:
database: #{prefix}#{db_name}_test#{postfix}
<<: *defaults
production:
database: #{prefix}#{db_name}_production#{postfix}
<<: *defaults
YAML
end
Jump to Line
Something went wrong with that request. Please try again.