forked from cornerstonejs/cornerstoneTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-docs.sh
77 lines (57 loc) · 1.59 KB
/
update-docs.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
76
77
#!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
## Generate DOCMA API Docs
cd ..
npm run docs:api
cd ./.circleci/
# Generate all version's GitBook output
# For each directory in /docs ...
cd ./../docs/
for D in *; do
if [ -d "${D}" ]; then
echo "Generating output for: ${D}"
cd "${D}"
# Clear previous output, generate new
rm -rf _book
gitbook install
gitbook build
cd ..
fi
done
# Move CNAME File into `latest`
cp CNAME ./latest/CNAME
# Create a history folder in our latest version's output
mkdir ./latest/_book/history
# Move each version's files to latest's history folder
for D in *; do
if [ -d "${D}" ]; then
echo "Moving ${D} to the latest version's history folder"
mkdir "./latest/_book/history/${D}"
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
fi
done
# Generate Examples
cd ./../examples/
gem install bundler:2.0.1
bundle check || bundle install
export JEKYLL_ENV="production"
bundle exec jekyll build --config _config.yml,_config_production.yml
# Create examples directory
cd ./../docs/
mkdir ./latest/_book/examples
# Move examples output to folder
mv -v "./../examples/_site"/* "./latest/_book/examples"
# Set User
git config --global user.email "[email protected]"
git config --global user.name "dannyrb"
# Commit & Push
cd ./latest/_book/
git init
git add -A
git commit -m 'update book'
git push -f [email protected]:cornerstonejs/cornerstoneTools.git master:gh-pages
cd ..
# Used to pause so you can read output before dismissing
# read -n 1 -s -r -p "Press any key to exit"