Skip to content

Instantly share code, notes, and snippets.

@mikehale
Created August 6, 2008 15:50
Show Gist options
  • Save mikehale/4225 to your computer and use it in GitHub Desktop.
Save mikehale/4225 to your computer and use it in GitHub Desktop.
#This can be used as a sake task
desc "Install a database.yml if non exists"
task :add_database_yml do
database_yml = %(env: &env
adapter: sqlite3
timeout: 5000
development:
<<: *env
database: db/development.sqlite3
test:
<<: *env
database: db/test.sqlite3
production:
<<: *env
database: db/production.sqlite3
)
if File.exists?('config') && !File.exists?('config/database.yml')
File.open('config/database.yml', 'a') do |f|
f.write database_yml
end
puts "Created config/database.yml with the following content:"
puts File.read('config/database.yml')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment