From 238203043f7510f8f378846bca150c64ae1ecec1 Mon Sep 17 00:00:00 2001 From: Aurélio A. Heckert Date: Tue, 22 Oct 2013 19:04:15 +0000 Subject: [PATCH] Right database.yml update on quick-start script --- script/quick-start | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/script/quick-start b/script/quick-start index c8c3fdd..e6a952d 100755 --- a/script/quick-start +++ b/script/quick-start @@ -67,10 +67,25 @@ else fi # create the database with sample data -run cp config/database.yml.pgsql config/database.yml -sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole -sed -ri "s/username: noosfero/username: $USER/" -sudo -u postgres createdb noosfero_development -O $USER +if test -e config/database.yml; then + say 'Not updating existent database.yml.' + say 'If you wish to automatic reconfigure your database connection, you can delete config/database.yml and run this script again.' +else + say 'Configuring Noosfero to use PostgreSQL, with your user.' + run cp config/database.yml.pgsql config/database.yml + sed -ri "s/username: noosfero/username: $USER/" config/database.yml + sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole +fi +DB_USER="$( + grep username: config/database.yml | head -n1 | sed -r 's/.*:\s*([^ ]+).*/\1/' +)" +if test -n "$DB_USER"; then + say "DB user: $DB_USER" +else + say 'It looks like your database.yml have no user defined' + DB_USER=$USER +fi +sudo -u postgres createdb noosfero_development -O $DB_USER run rake db:schema:load run rake db:data:minimal run rake db:test:prepare -- libgit2 0.21.2