forked from ampproject/amp-wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amphtml-update.sh
42 lines (34 loc) · 1009 Bytes
/
amphtml-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
#!/bin/bash
set -e
# Go to the right location.
cd "$(dirname "$0")"
BIN_PATH="$(pwd)"
PROJECT_PATH=$(dirname $PWD)
VENDOR_PATH=$PROJECT_PATH/vendor
if ! command -v apt-get >/dev/null 2>&1; then
echo "The AMP HTML uses apt-get, make sure to run this script in a Linux environment"
exit 1
fi
# Install dependencies.
sudo apt-get install git python protobuf-compiler python-protobuf
# Create and go to vendor.
if [[ ! -e $VENDOR_PATH ]]; then
mkdir $VENDOR_PATH
fi
cd $VENDOR_PATH
# Clone amphtml repo.
if [[ ! -e $VENDOR_PATH/amphtml ]]; then
git clone https://github.com/ampproject/amphtml amphtml
else
cd $VENDOR_PATH/amphtml/validator
if [ 'master' == $( git rev-parse --abbrev-ref HEAD ) ]; then
git pull origin master
fi
fi
# Copy script to location and go there.
cp $BIN_PATH/amphtml-update.py $VENDOR_PATH/amphtml/validator
cd $VENDOR_PATH/amphtml/validator
# Run script.
python amphtml-update.py
mv amp_wp/class-amp-allowed-tags-generated.php ../../../includes/sanitizers/
rm -r amp_wp