-
Notifications
You must be signed in to change notification settings - Fork 8
/
how.sh
executable file
·58 lines (51 loc) · 1.87 KB
/
how.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
HOW_STATUS=0
# NOTE redirections have to be done this way because:
# 1. Travis doesn't deploy symlinks (https://github.com/travis-ci/dpl/issues/912)
# 2. GitHub Pages uses symlinks to change the displayed page but the URL is not
# updated. Since the links generated by html_of_wiki are relative and dependant
# of the location of the file, the links from the redirected page are all wrong.
# `make-redir A B' creates B which redirects to A using `http-equiv'.
how-redirect() {
cat >$2 <<EOF
<!DOCTYPE html>
<html>
<head><meta http-equiv="refresh" content="0; URL=$1" /></head>
<body></body>
</html>
EOF
}
how-redirect-manual() {
local dir="$(pwd)/$HOW_OUT/$2"
mkdir -p "$dir"
cd "$HOW_OUT/$1"
[ "$3" == "clientserver" ] && prefix="../"
find api -type f | while read -r f; do
mkdir -p `dirname "$dir/$f"`
how-redirect "$prefix""../../$1/$f" "$dir/$f"
done
find manual -type f | while read -r f; do
mkdir -p `dirname "$dir/$f"`
how-redirect "../../$1/$f" "$dir/$f"
done
cd - 2>&1 >/dev/null
}
how-install() {
export OCAML_VERSION=4.06
export PACKAGE=
wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-ocaml.sh
bash -ex .travis-ocaml.sh
eval $(opam env)
git clone --depth 1 https://github.com/ocsigen/html_of_wiki.git
opam pin add -y html_of_wiki html_of_wiki
git clone --depth 1 https://github.com/ocsigen/ocsigen.github.io.git __ocsigen.github.io
mv __ocsigen.github.io/template __ocsigen.github.io/how_template
mv __ocsigen.github.io/how_template .
HOW_LATEST=$(find $HOW_DOC -maxdepth 1 -type d -not -name $HOW_DOC -not -name dev -exec basename {} \; | sort -nr | head -n 1)
export HOW_LATEST
}
how-generate() {
if ! quickdop -f $HOW_DOC $HOW_OUT -t json -c $HOW_CONFIG -viu; then
HOW_STATUS=1
fi
return $HOW_STATUS
}