Skip to content

Commit 8254f90

Browse files
committed
Refactor build.sh
1 parent 731ef06 commit 8254f90

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

build.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -x
44

5+
ROOT_DIR=$(pwd)
6+
DOCS_DIR=$ROOT_DIR/docs
57
cd docs
68

79
# Setup java-design-patterns - English
@@ -18,15 +20,20 @@ find . -maxdepth 2 -type d -exec bash -c 'cd "{}" && pwd && rm -rf src pom.xml *
1820
rm -v README.md
1921
echo "<ChildTableOfContents />" > README.md
2022

21-
# Setup java-design-patterns - Chinese
22-
cd localization/zh
23-
mkdir ../../../zh/patterns
24-
cp -vrf * ../../../zh/patterns
25-
cd ../../../zh/patterns
26-
rm -v README.md
27-
echo "<ChildTableOfContents />" > README.md
23+
# Setup java-design-patterns - localizations
24+
languages=( zh )
25+
for lan in "${languages[@]}"
26+
do
27+
cd localization/$lan
28+
mkdir ../../../$lan/patterns
29+
cp -vrf * ../../../$lan/patterns
30+
cd ../../../$lan/patterns
31+
rm -v README.md
32+
echo "<ChildTableOfContents />" > README.md
33+
cd ../../patterns
34+
done
2835

29-
cd ../..
36+
cd $DOCS_DIR
3037
rm -rf java-design-patterns
3138
rm -rf patterns/localization
3239

@@ -37,6 +44,7 @@ rm -rf zh/principles
3744
git clone https://github.com/iluwatar/programming-principles.git
3845
cd programming-principles
3946
git checkout-index -f --prefix=../principles/ README.md
47+
4048
# setup programming-principles - Chinese
4149
mkdir ../zh/principles
4250
cp -vf README.md ../zh/principles/
@@ -50,6 +58,7 @@ rm -rf zh/snippets
5058
git clone https://github.com/iluwatar/30-seconds-of-java.git
5159
cd 30-seconds-of-java
5260
git checkout-index -f --prefix=../snippets/ README.md
61+
5362
# setup 30-seconds-of-java - Chinese
5463
mkdir ../zh/snippets
5564
cp -vf README.md ../zh/snippets/

0 commit comments

Comments
 (0)