-
Notifications
You must be signed in to change notification settings - Fork 55
/
gen_gh_pages.lua
48 lines (39 loc) · 1.79 KB
/
gen_gh_pages.lua
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
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
require "os"
require "io"
require "string"
local function output_menu(output_dir, version)
local fh = assert(io.open(string.format("%s/SUMMARY.md", output_dir), "w"))
fh:write(string.format("* [Hindsight (%s)](README.md)\n\n", version))
fh:write([[
* [Architecture](architecture.md)
* [Performance](performance.md)
* [Configuration](configuration.md)
* [Command Line Version](hindsight_cli.md)
* [Execution Profiling](hindsight_timer_report.md)
* [Heka Sandbox Documentation](http://mozilla-services.github.io/lua_sandbox/heka/index.html)
* [Sandbox Extensions Documentation](http://mozilla-services.github.io/lua_sandbox_extensions/index.html)
### Tutorials
* [Using Decoders with Input Plugins](tutorials/using_decoders_with_input_plugins.md)
* [Common Configuration Cookbooks](tutorials/cookbooks.md)
]])
fh:close()
end
local args = {...}
local function main()
local output_dir = string.format("%s/gb-source", arg[3])
local rv = os.execute(string.format("rsync -rav docs/ %s/", output_dir))
if rv ~= 0 then error"rsync setup" end
local fh = assert(io.open(string.format("%s/book.json", output_dir), "w"))
fh:write([[{"plugins" : ["collapsible-menu", "navigator"]}]])
fh:close()
os.execute(string.format("cd %s;gitbook install", output_dir))
os.execute(string.format("mv %s/index.md %s/README.md", output_dir, output_dir))
output_menu(output_dir, args[1])
os.execute(string.format("gitbook build %s", output_dir))
local rv = os.execute(string.format("rsync -rav %s/_book/ %s/", output_dir, "gh-pages/"))
if rv ~= 0 then error"rsync publish" end
end
main()