diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-16 17:34:47 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-07-21 20:49:51 +0200 |
commit | 55acc3094b9c7b56a4154b67c24c90b14341460d (patch) | |
tree | fc1f15b270f32ce0ae7417e9b78e464891c6489a /lib | |
parent | Don't show questions with no content (diff) | |
download | recruiting-webapp-55acc3094b9c7b56a4154b67c24c90b14341460d.tar.gz recruiting-webapp-55acc3094b9c7b56a4154b67c24c90b14341460d.tar.bz2 recruiting-webapp-55acc3094b9c7b56a4154b67c24c90b14341460d.zip |
New rake tasks to prepare app to work
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/prepare.rake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/tasks/prepare.rake b/lib/tasks/prepare.rake new file mode 100644 index 0000000..4c05b07 --- /dev/null +++ b/lib/tasks/prepare.rake @@ -0,0 +1,29 @@ +require "ftools" + +desc "Prepare database and configuration files to run tests (accepts options used by prepare:config and seed option)" +opt = ENV.include?('seed') ? ['db:seed'] : [] +task :prepare => ['prepare:config', 'db:schema:load'] + opt + +namespace :prepare do + + desc "Prepare configuration files (you can pass db=[none|sqlite3|postgres])" + task :config do + + if !ENV.include?('db') || (ENV['db'] == 'none') + # don't change anything + + elsif ENV['db'] == 'sqlite3' + File.copy('doc/config/database-sqlite3.yml', 'config/database.yml') + + elsif ENV['db'] == 'postgres' + File.copy('doc/config/database-postgres.yml', 'config/database.yml') + puts "Now you have a template postgeres configuration in config/database.yml. + Remember to set user and database names matching you configuration." + + else + raise "valid values for db are sqlite3, postgres, none" + end + + File.copy('doc/config/config.yml', 'config/config.yml') + end +end |