Created
August 6, 2008 15:50
-
-
Save mikehale/4225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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