Fix most redownloading in 'vagrant reload --provision'.

Fixes #264.
This commit is contained in:
Umair Khan 2016-05-31 17:58:58 +05:00 committed by Tim Abbott
parent c2ce5119c6
commit 072551a94e
2 changed files with 28 additions and 7 deletions

View File

@ -17,6 +17,7 @@ SUPPORTED_PLATFORMS = {
],
}
NPM_VERSION = '3.9.3'
VENV_PATH = "/srv/zulip-venv"
PY3_VENV_PATH = "/srv/zulip-py3-venv"
ZULIP_PATH = os.path.dirname(os.path.abspath(__file__))
@ -142,6 +143,7 @@ def main():
run(["sudo", "apt-get", "update"])
run(["sudo", "apt-get", "-y", "install"] + APT_DEPENDENCIES[codename])
if subprocess.call(['dpkg', '-s', TSEARCH_PACKAGE_NAME]):
temp_deb_path = subprocess.check_output(["mktemp", "package_XXXXXX.deb", "--tmpdir"])
run(["wget", "-O", temp_deb_path, TSEARCH_URL])
run(["sudo", "dpkg", "--install", temp_deb_path])
@ -187,8 +189,10 @@ def main():
run(["tools/setup/postgres-init-test-db"])
run(["tools/do-destroy-rebuild-test-database"])
run(["python", "./manage.py", "compilemessages"])
# Install the latest npm.
run(["sudo", "npm", "install", "-g", "npm"])
if subprocess.check_output(['npm', '--version']).strip() != NPM_VERSION:
# Install the pinned version of npm.
run(["sudo", "npm", "install", "-g", "npm@{}".format(NPM_VERSION)])
# Run npm install last because it can be flaky, and that way one
# only needs to rerun `npm install` to fix the installation.
run(["npm", "install"])

View File

@ -2,5 +2,22 @@
set -e
set -x
mkdir -p static/third/zxcvbn/
wget https://raw.githubusercontent.com/dropbox/zxcvbn/0890678ede1488ecb02cda7eb793cd308a59c49d/zxcvbn.js -O static/third/zxcvbn/zxcvbn.js
output_path=static/third/zxcvbn
commit_file_path=$output_path/commit
commit=0890678ede1488ecb02cda7eb793cd308a59c49d # Change this to upgrade
mkdir -p "$output_path"
if [ -e "$commit_file_path" ]
then
current_commit=`cat $commit_file_path`
else
current_commit=00
fi
if [ "$current_commit" == "$commit" ]; then
echo "Already at latest version of zxcvbn.js"
else
echo "$commit" > "$commit_file_path"
wget "https://raw.githubusercontent.com/dropbox/zxcvbn/$commit/zxcvbn.js" -O "$output_path/zxcvbn.js"
fi