From 0ef7d4c0e4a013e8230e53ad4afa7256072fcf7d Mon Sep 17 00:00:00 2001 From: Adam Cooke Date: Thu, 18 May 2017 12:01:05 +0100 Subject: [PATCH] only compile assets on upgrade if they aren't prebuilt --- bin/postal | 7 ++++++- script/build_package.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/postal b/bin/postal index b85e5bd..d807812 100755 --- a/bin/postal +++ b/bin/postal @@ -53,7 +53,12 @@ case "$1" in ;; upgrade) - run "bundle exec rake assets:precompile db:migrate" + if [ ! -f "public/assets/.prebuilt" ]; then + echo 'Compiling Assets' + run "bundle exec rake assets:precompile" + fi + echo 'Migrating database' + run "bundle exec rake db:migrate" ;; console) diff --git a/script/build_package.rb b/script/build_package.rb index 8898b98..38efd39 100755 --- a/script/build_package.rb +++ b/script/build_package.rb @@ -70,6 +70,7 @@ File.open("#{WC_PATH}/lib/postal/version.rb", 'w') { |f| f.write(version_file) } unless ENV['NO_ASSETS'] puts "\e[44;37mCompiling assets\e[0m" system!("cd #{WC_PATH} && bundle exec rake assets:precompile") + system!("touch #{WC_PATH}/public/assets/.prebuilt") end # Remove files that shouldn't be distributed