-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish
executable file
·55 lines (43 loc) · 1.68 KB
/
publish
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
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
################################################################################
# This script builds the parsers and pushes them to their S3 bucket. It can be #
# used in dev mode, to push to the dev bucket: #
# ./publish dev #
# or release mode, to push to a prod bucket with the specified release version:#
# ./publish release v0.1 #
################################################################################
# Exit if error
set -e
# Config begin
LANG_CONFIGS_DIR=language_configs/
CACHE_DIR=_cache/
OUTPUT_DIR=build/parsers
MAPPINGS_DIR="mappings"
PUSH_ENV="$1"
VERSION_TAG="$2"
# Config end
if [ "$PUSH_ENV" == "release" ]
then
echo "Releasing Codesplain Parsers"
elif [ "$PUSH_ENV" == "dev" ]
then
echo "Updating Codesplain Parsers in dev environment"
VERSION_TAG="dev"
else
echo "Error! Invalid PUSH_ENV" 1>&2
exit 1
fi
rm -rf $CACHE_DIR/treematcher/
rm -rf $CACHE_DIR/java_func_data/
# Build and push all parsers to S3 buckets:
for lang_config in $LANG_CONFIGS_DIR/*.compile.js; do
PARSELANG="$(basename $lang_config .compile.js)"
printf "Building and publishing $PARSELANG parser\n"
rm -rf "$CACHE_DIR/$PARSELANG/"
./make --lang $PARSELANG --debug
./make --lang $PARSELANG --minify
aws s3 cp $OUTPUT_DIR/$PARSELANG.min.js s3://codesplain-parsers/$PARSELANG/$VERSION_TAG/$PARSELANG.min.js
aws s3 cp $OUTPUT_DIR/$PARSELANG.js s3://codesplain-parsers/$PARSELANG/$VERSION_TAG/$PARSELANG.js
aws s3 cp $MAPPINGS_DIR/$PARSELANG.csv s3://codesplain-parsers/$PARSELANG/$VERSION_TAG/$PARSELANG.csv
done
exit