-
Notifications
You must be signed in to change notification settings - Fork 5
/
update.sh
executable file
·70 lines (58 loc) · 1.74 KB
/
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
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
# In the windows, follow these steps to run the script:
# 1. Install wsl (https://learn.microsoft.com/en-us/windows/wsl/install)
# 2. Reopen this project with the wsl in the vscode
# 3. Run the script again.
echo "Installing dependencies if needed..."
# Ubuntu
if [ "$(. /etc/os-release; echo $NAME)" = "Ubuntu" ]; then
sudo apt install ruby ruby-dev build-essential libffi-dev zlib1g-dev liblzma-dev nodejs patch
sudo apt-get update -y
sudo apt-get install -y bundler
fi
# Mac
if [ "$(uname)" == "Darwin" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
xcode-select --install
sudo xcodebuild -license
brew install node
gem update --system
gem install bundler
fi
echo "Start building project..."
cd slate_project
bundle install --quiet
cd ..
npm list drafter || npm install drafter
cd ./parsers
node parser.js make-jsons
echo 'made JSON files from apib files';
# node ./parsers/parser.js fix-jsons
# echo 'fixed the flaws in created JSON files';
node parser.js make-markdowns
echo 'made markdown files from JSON files'
cd ..
cp ./parsedApib/*.md ./slate_project/source
echo 'copied all markdown files to the slate_project folder'
build_one(){
rm ./source/index.html.md
mv ./source/$1.json.md ./source/index.html.md
cp ../logos/$1/logo.svg ./source/images/
bundle exec middleman build
rm -r ../docs/$1/*
cp -r ./build/* ../docs/$1
echo "$1 documentations are updated"
}
build_all(){
for Item in alefba harf kashf baaz parde golrokh targar replai ;
do
build_one $Item
done
}
cd ./slate_project
if [ $# -eq 0 ]
then build_all
else build_one $1
fi
cd ..
node JsAppender.js
echo 'parsing and building docs finished successfully!'