From 4ae12ac2cb3825808ed711b179cbac88d5e7e9af Mon Sep 17 00:00:00 2001 From: Everton Moreth Date: Tue, 27 Sep 2011 10:17:37 -0300 Subject: [PATCH 1/2] Checking use of bundler to migrate database o Rails 2 --- scripts/rails.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/rails.sh b/scripts/rails.sh index 1412679..7fb7709 100644 --- a/scripts/rails.sh +++ b/scripts/rails.sh @@ -50,7 +50,7 @@ fi cd $dir -check_bundler +using_bundler=check_bundler if [ "$?" == "0" ]; then echo " => Installing missing gems..." sudo RAILS_ENV=production rake gems:install > $LOG_DIR/gems_install.log 2>&1 @@ -58,7 +58,11 @@ if [ "$?" == "0" ]; then fi echo " => Migrating database..." -RAILS_ENV=production rake db:migrate > $LOG_DIR/db_migrate.log 2>&1 +if [[ $using_bundler == 1 ]]; then + RAILS_ENV=production bundle exec rake db:migrate > $LOG_DIR/db_migrate.log 2>&1 +else + RAILS_ENV=production rake db:migrate > $LOG_DIR/db_migrate.log 2>&1 +fi check_error 'migrating database' 'db_migrate' sudo chown -R git:www-data * > $LOG_DIR/chown.log 2>&1 From 3f6448c825f949e2b6f17bdfffbe42b1bf061167 Mon Sep 17 00:00:00 2001 From: Everton Moreth Date: Tue, 27 Sep 2011 10:18:01 -0300 Subject: [PATCH 2/2] Assume use of bundler to migrate database on Rails 3 --- scripts/rails3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/rails3.sh b/scripts/rails3.sh index d58f8b1..aebe4f3 100644 --- a/scripts/rails3.sh +++ b/scripts/rails3.sh @@ -68,10 +68,10 @@ if [ $? -eq 1 ]; then fi echo " => Migrating database..." -RAILS_ENV=production rake db:migrate > $LOG_DIR/db_migrate.log 2>&1 +RAILS_ENV=production bundle exec rake db:migrate > $LOG_DIR/db_migrate.log 2>&1 check_error 'migrating database' 'db_migrate' sudo chown -R git:www-data * > $LOG_DIR/chown.log 2>&1 cd - -restart_webserver $already_existed \ No newline at end of file +restart_webserver $already_existed