diff --git a/tools/purge-deployments b/scripts/purge-deployments similarity index 91% rename from tools/purge-deployments rename to scripts/purge-deployments index b851b01dd2..24be39f01b 100755 --- a/tools/purge-deployments +++ b/scripts/purge-deployments @@ -1,8 +1,11 @@ #!/usr/bin/python +import sys import os import logging import datetime import shutil + +sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) from zulip_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s", diff --git a/tools/restart-server b/scripts/restart-server similarity index 95% rename from tools/restart-server rename to scripts/restart-server index d8bf07d652..e2aa2d6475 100755 --- a/tools/restart-server +++ b/scripts/restart-server @@ -5,6 +5,8 @@ import pwd import subprocess import logging import time + +sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) from zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR logging.basicConfig(format="%(asctime)s restart-server: %(message)s", diff --git a/tools/update-deployment b/scripts/update-deployment similarity index 83% rename from tools/update-deployment rename to scripts/update-deployment index 448e986d45..a6384bdba5 100755 --- a/tools/update-deployment +++ b/scripts/update-deployment @@ -3,11 +3,13 @@ import os import sys import subprocess import logging -from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, WARNING, ENDC import datetime import shutil import time +sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) +from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, WARNING, ENDC + logging.basicConfig(format="%(asctime)s update-deployment: %(message)s", level=logging.INFO) @@ -34,7 +36,7 @@ while time.time() - start_time < 300: if not got_lock: print FAIL + "Deployment already in progress. Please run\n" \ - + " %s/current/tools/update-deployment %s\n" % (DEPLOYMENTS_DIR, refname) \ + + " %s/current/scripts/update-deployment %s\n" % (DEPLOYMENTS_DIR, refname) \ + "manually when the current deployment finishes." + ENDC sys.exit(1) @@ -52,13 +54,13 @@ subprocess.check_call(["find", ".", "-name", "*.pyc", "-delete"], stdout=open('/ # Update static files logging.info("Updating static files") -subprocess.check_call(["./tools/update-prod-static", "--prev-deploy", +subprocess.check_call(["./scripts/update-prod-static", "--prev-deploy", os.path.join(DEPLOYMENTS_DIR, 'current')]) logging.info("Restarting server...") -subprocess.check_call(["./tools/restart-server"]) +subprocess.check_call(["./scripts/restart-server"]) logging.info("Deployment complete") shutil.rmtree(LOCK_DIR) -subprocess.check_call(["./tools/purge-deployments"]) +subprocess.check_call(["./scripts/purge-deployments"]) diff --git a/tools/update-prod-static b/scripts/update-prod-static similarity index 100% rename from tools/update-prod-static rename to scripts/update-prod-static diff --git a/tools/post-receive b/tools/post-receive index e4ad1ba7cc..1b1e90826e 100755 --- a/tools/post-receive +++ b/tools/post-receive @@ -34,7 +34,7 @@ from zulip_tools import check_output, ENDC, FAIL def update_deployment(server, refname): return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR", - "/home/zulip/deployments/current/tools/update-deployment", refname]) + "/home/zulip/deployments/current/scripts/update-deployment", refname]) def send_deployment_finished_message(branch, message): subprocess.check_call(["/home/zulip/zulip/api/bin/zulip-send", "--user=commit-bot@zulip.com", diff --git a/zerver/finders.py b/zerver/finders.py index c6d9ee260f..d1cb29ce97 100644 --- a/zerver/finders.py +++ b/zerver/finders.py @@ -15,7 +15,7 @@ class ExcludeUnminifiedMixin(object): # source-map/ should also not be included. # However, we work around that by moving it later, - # in tools/update-prod-static. + # in update-prod-static. super_class = super(ExcludeUnminifiedMixin, self) for path, storage in super_class.list(ignore_patterns): diff --git a/zproject/settings.py b/zproject/settings.py index 1d45caa768..ce14a8948d 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -283,7 +283,7 @@ STATIC_HEADER_FILE = 'zerver/static_header.txt' # To use minified files in dev, set PIPELINE = True. For the full # cache-busting behavior, you must also set DEBUG = False. # -# You will need to run ./tools/update-prod-static after changing +# You will need to run update-prod-static after changing # static files. PIPELINE_CSS = {