Commit c88425117997bef650374bc2160559929b81277a
Exists in
master
and in
28 other branches
Merge commit 'refs/merge-requests/405' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/405
Showing
1 changed file
with
19 additions
and
4 deletions
Show diff stats
script/quick-start
| @@ -67,10 +67,25 @@ else | @@ -67,10 +67,25 @@ else | ||
| 67 | fi | 67 | fi |
| 68 | 68 | ||
| 69 | # create the database with sample data | 69 | # create the database with sample data |
| 70 | -run cp config/database.yml.pgsql config/database.yml | ||
| 71 | -sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole | ||
| 72 | -sed -ri "s/username: noosfero/username: $USER/" | ||
| 73 | -sudo -u postgres createdb noosfero_development -O $USER | 70 | +if test -e config/database.yml; then |
| 71 | + say 'Not updating existent database.yml.' | ||
| 72 | + say 'If you wish to automatic reconfigure your database connection, you can delete config/database.yml and run this script again.' | ||
| 73 | +else | ||
| 74 | + say 'Configuring Noosfero to use PostgreSQL, with your user.' | ||
| 75 | + run cp config/database.yml.pgsql config/database.yml | ||
| 76 | + sed -ri "s/username: noosfero/username: $USER/" config/database.yml | ||
| 77 | + sudo -u postgres createuser $USER --no-superuser --createdb --no-createrole | ||
| 78 | +fi | ||
| 79 | +DB_USER="$( | ||
| 80 | + grep username: config/database.yml | head -n1 | sed -r 's/.*:\s*([^ ]+).*/\1/' | ||
| 81 | +)" | ||
| 82 | +if test -n "$DB_USER"; then | ||
| 83 | + say "DB user: $DB_USER" | ||
| 84 | +else | ||
| 85 | + say 'It looks like your database.yml have no user defined' | ||
| 86 | + DB_USER=$USER | ||
| 87 | +fi | ||
| 88 | +sudo -u postgres createdb noosfero_development -O $DB_USER | ||
| 74 | run rake db:schema:load | 89 | run rake db:schema:load |
| 75 | run rake db:data:minimal | 90 | run rake db:data:minimal |
| 76 | run rake db:test:prepare | 91 | run rake db:test:prepare |