forked from joypixels/emojify.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·45 lines (32 loc) · 988 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# This script pulls an up-to-date version of https://github.com/arvida/emoji-cheat-sheet.com.git
# and copies the emoji from that project into this project, also updating the emojify.js script
# with any new emoji
#
# Remember to run grunt afterwards
#
set -e
REPO_DIR=updated/emoji-cheat-sheet.com
REPO_SOURCE=https://github.com/arvida/emoji-cheat-sheet.com.git
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd .
cd $SCRIPT_DIR
if [ -d $REPO_DIR ]; then
cd $REPO_DIR
git reset --hard
git pull
cd $SCRIPT_DIR
else
mkdir -p $REPO_DIR
git clone $REPO_SOURCE $REPO_DIR
fi
cp $REPO_DIR/public/graphics/emojis/*.png images/emoji
EMOJI=" \"$(ls images/emoji/*.png | cut -d/ -f3 | cut -d\. -f1 | tr \\n ,|sed 's/,$//')\";"
awk -v emoji="$EMOJI" '
$0 ~ /##EMOJILISTSTART/ {skip=1; print; next}
$0 ~ /##EMOJILISTEND/ {skip=0; print emoji; }
!skip {print}
' emojify.js > emoji.js-new
mv emoji.js-new emojify.js
popd