-
Notifications
You must be signed in to change notification settings - Fork 5
/
make.jl
168 lines (161 loc) · 5.35 KB
/
make.jl
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Script to build the MultiDocumenter demo docs
#
# julia --project docs/make.jl [--temp] [deploy]
#
# When `deploy` is passed as an argument, it goes into deployment mode
# and attempts to push the generated site to gh-pages. You can also pass
# `--temp`, in which case the source repositories are cloned into a temporary
# directory (as opposed to `docs/clones`).
using MultiDocumenter
import Documenter
clonedir = ("--temp" in ARGS) ? mktempdir() : joinpath(@__DIR__, "clones")
outpath = mktempdir()
@info """
Cloning packages into: $(clonedir)
Building aggregate site into: $(outpath)
"""
@info "Building Documenter site for MultiDocumenter"
open(joinpath(@__DIR__, "src", "index.md"), write = true) do io
write(io, read(joinpath(@__DIR__, "..", "README.md")))
write(
io,
"""
## Docstrings
```@autodocs
Modules = [MultiDocumenter]
```
""",
)
end
cp(
joinpath(@__DIR__, "..", "sample.png"),
joinpath(@__DIR__, "src", "sample.png"),
force = true,
)
Documenter.makedocs(
sitename = "MultiDocumenter",
modules = [MultiDocumenter],
warnonly = true,
pages = ["index.md", "internal.md"],
)
@info "Building aggregate MultiDocumenter site"
docs = [
# We also add MultiDocumenter's own generated pages
MultiDocumenter.MultiDocRef(
upstream = joinpath(@__DIR__, "build"),
path = "docs",
name = "MultiDocumenter",
fix_canonical_url = false,
),
MultiDocumenter.DropdownNav(
"Debugging",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
],
),
MultiDocumenter.MegaDropdownNav(
"Mega Debugger",
[
MultiDocumenter.Column(
"Column 1",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
],
),
MultiDocumenter.Column(
"Column 2",
[
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Infiltrator"),
path = "inf",
name = "Infiltrator",
giturl = "https://github.com/JuliaDebug/Infiltrator.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "JuliaInterpreter"),
path = "debug",
name = "JuliaInterpreter",
giturl = "https://github.com/JuliaDebug/JuliaInterpreter.jl.git",
),
],
),
],
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "DataSets"),
path = "data",
name = "DataSets",
giturl = "https://github.com/JuliaComputing/DataSets.jl.git",
# or use ssh instead for private repos:
# giturl = "[email protected]:JuliaComputing/DataSets.jl.git",
),
]
MultiDocumenter.make(
outpath,
docs;
search_engine = MultiDocumenter.SearchConfig(
index_versions = ["stable"],
engine = MultiDocumenter.FlexSearch,
),
rootpath = "/MultiDocumenter.jl/",
canonical_domain = "https://juliacomputing.github.io/",
sitemap = true,
)
if "deploy" in ARGS
@warn "Deploying to GitHub" ARGS
gitroot = normpath(joinpath(@__DIR__, ".."))
run(`git pull`)
outbranch = "gh-pages"
has_outbranch = true
if !success(`git checkout $outbranch`)
has_outbranch = false
if !success(`git switch --orphan $outbranch`)
@error "Cannot create new orphaned branch $outbranch."
exit(1)
end
end
for file in readdir(gitroot; join = true)
endswith(file, ".git") && continue
rm(file; force = true, recursive = true)
end
for file in readdir(outpath)
cp(joinpath(outpath, file), joinpath(gitroot, file))
end
run(`git add .`)
if success(`git commit -m 'Aggregate documentation'`)
@info "Pushing updated documentation."
if has_outbranch
run(`git push`)
else
run(`git push -u origin $outbranch`)
end
run(`git checkout main`)
else
@info "No changes to aggregated documentation."
end
else
@info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS
cp(outpath, joinpath(@__DIR__, "out"), force = true)
end