-
Notifications
You must be signed in to change notification settings - Fork 94
/
build.sh
executable file
·75 lines (67 loc) · 2.34 KB
/
build.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# ===========================================================================
# Copyright (c) 2019 Eclipse Foundation and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# Contributors:
# Christopher Guindon (Eclipse Foundation)
#
# SPDX-License-Identifier: EPL-2.0
# ===========================================================================
echo -e "Processing Jakarta EE Specifications...\n"
echo -e "Step 1: Clean up specifications content\n"
mkdir /tmp/specifications && cp content/specifications/_index.md /tmp/specifications/ && cp content/specifications/_index.*.md /tmp/specifications/
rm -rf content/specifications && rm -rf static/specifications
echo "Step 2: Clone specifications git repository"
git clone https://github.com/jakartaee/specifications.git content/specifications
echo -e "\nStep 3: Remove specifications/.git\n"
rm -rf content/specifications/.git
echo "Step 4: Create static/specifications folder"
mkdir -p static/specifications
cd content
cp -rf /tmp/specifications/* specifications
rm -rf /tmp/specifications
echo -e "Current working directory: $PWD\n"
echo -e "Step 5: Preparing to move html files to static folder..."
for f in specifications/*/*/*.html; do
if [ -f "$f" ]; then
echo -e "Moving $f to `dirname ../static/$f`"
mkdir -p `dirname ../static/$f`
mv -f "$f" "../static/$f"
fi
done
echo -e "Step 6: Preparing to move folders to static folder..."
for f in specifications/*/*/*/; do
if [ -d "$f" ]; then
echo -e "Moving $f folder to `dirname ../static/$f`"
mkdir -p `dirname ../static/$f`
mv -f "$f" "../static/$f"
fi
done
echo -e "Step 7: Create missing language copies..."
LANGS=(ja zh)
FILES=`find ./specifications -type f -name "*.md"`
for F in $FILES; do
if [ -f "$F" ]; then
FILE_NAME=`basename $F`
EXTENSION=${FILE_NAME#**.}
for LANG in ${LANGS[@]}; do
## Skip non base-lang copies
if [[ "$EXTENSION" =~ .*"$LANG".* ]];then
continue 2
fi
done
REL_DIR=`dirname $F`
for LANG in ${LANGS[@]}; do
LANG_FILE="$REL_DIR/`basename $F .md`.$LANG.md"
if [ ! -f $LANG_FILE ]; then
echo "Creating langauge copy of $F in $LANG_FILE"
cp $F $LANG_FILE
fi
done
fi
done
echo "Done!"