provision: Download emoji-data during provisioning.

Add code to download iamcal's emoji_pretty.json
(emoji-data/emoji.json) during provisioning.
This commit is contained in:
Harshit Bansal 2017-03-07 22:37:59 +05:30 committed by Tim Abbott
parent 518d25a0cf
commit 4470a3947b
4 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ static/js/bundle.js
static/generated/emoji
static/generated/github-contributors.json
static/locale/language_options.json
static/third/emoji-data
/node_modules
/staticfiles.json
npm-debug.log

View File

@ -217,6 +217,7 @@ def main(options):
if not os.path.isdir(EMOJI_CACHE_PATH):
run(["sudo", "mkdir", EMOJI_CACHE_PATH])
run(["sudo", "chown", "%s:%s" % (user_id, user_id), EMOJI_CACHE_PATH])
run(["tools/setup/emoji/download-emoji-data"])
run(["tools/setup/emoji/build_emoji"])
run(["scripts/setup/generate_secrets.py", "--development"])
run(["tools/update-authors-json", "--use-fixture"])

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
set -x
OUTPUT_PATH=static/third/emoji-data
COMMIT_FILE_PATH=$OUTPUT_PATH/commit
COMMIT=b588e200268d6c3c1d20d5ecdfe4634a68a6f947 # 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 emoji.json"
else
echo "$COMMIT" > "$COMMIT_FILE_PATH"
wget "https://raw.githubusercontent.com/iamcal/emoji-data/$COMMIT/emoji_pretty.json" -O "$OUTPUT_PATH/emoji.json"
fi

View File

@ -37,6 +37,10 @@ fp = open('var/log/update-prod-static.log', 'w')
# Install node packages
setup_node_modules(npm_args=['--production'], stdout=fp, stderr=fp)
# Download emoji data
subprocess.check_call(['./tools/setup/emoji/download-emoji-data'],
stdout=fp, stderr=fp)
# Build emoji
subprocess.check_call(['./tools/setup/emoji/build_emoji'],
stdout=fp, stderr=fp)