From 1bda0df9608499c52095e2356acd4f6f0d04403d Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Tue, 14 Oct 2014 00:09:25 +0530 Subject: [PATCH] init: automatically compile assets if relative_url is changed Closes #171 --- Changelog.md | 1 + assets/init | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 1ac89450..7701d41e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # Changelog **latest** +- automatically compile assets if relative_url is changed - launch all daemons via supervisord **7.3.2-1** diff --git a/assets/init b/assets/init index e824b56f..9543f2c0 100755 --- a/assets/init +++ b/assets/init @@ -624,11 +624,12 @@ appStart () { sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production >/dev/null fi - # migrate database and compile the assets if the gitlab version has changed. + # migrate database and compile the assets if the gitlab version or relative_url has changed. CACHE_VERSION= GITLAB_VERSION=$(cat VERSION) [ -f tmp/cache/VERSION ] && CACHE_VERSION=$(cat tmp/cache/VERSION) - if [ "${GITLAB_VERSION}" != "${CACHE_VERSION}" ]; then + [ -f tmp/cache/GITLAB_RELATIVE_URL_ROOT ] && CACHE_GITLAB_RELATIVE_URL_ROOT=$(cat tmp/cache/GITLAB_RELATIVE_URL_ROOT) + if [ "${GITLAB_VERSION}" != "${CACHE_VERSION}" -o "${GITLAB_RELATIVE_URL_ROOT}" != "${CACHE_GITLAB_RELATIVE_URL_ROOT}" ]; then echo "Migrating database..." sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production >/dev/null @@ -646,6 +647,7 @@ appStart () { sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production 2>/dev/null sudo -u git -H touch tmp/cache/VERSION sudo -u git -H echo "${GITLAB_VERSION}" > tmp/cache/VERSION + sudo -u git -H echo "${GITLAB_RELATIVE_URL_ROOT}" > tmp/cache/GITLAB_RELATIVE_URL_ROOT fi # remove stale unicorn and sidekiq pid's if they exist.