|
1 |
| -[tasks.doc-build] |
| 1 | +# Modify these to suit your needs |
| 2 | +[env] |
| 3 | +BIBFILE = "cite.bib" |
| 4 | +STYLE = "apa" |
| 5 | + |
| 6 | +# actually generate the docs |
| 7 | +[tasks.doc-gen] |
2 | 8 | command = "cargo"
|
3 | 9 | args = ["doc", "--no-deps", "-q"]
|
4 | 10 |
|
5 |
| -[tasks.doc-post-proc] |
| 11 | +[tasks.doc-post-process] |
| 12 | +# we'll use fd to find all the doc files |
6 | 13 | command = "fd"
|
7 | 14 | args = [
|
8 | 15 | ".",
|
9 |
| - "./${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/doc/${CARGO_MAKE_CRATE_FS_NAME}", |
| 16 | + "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/doc/${CARGO_MAKE_CRATE_FS_NAME}", # search the generated doc files |
10 | 17 | "-e",
|
11 |
| - "html", |
12 |
| - "-x", |
| 18 | + "html", # only those with extention html |
| 19 | + "-x", # run the cmb command on each file found |
13 | 20 | "cmb",
|
14 |
| - "-b", |
15 |
| - "cite.bib", |
16 |
| - "--style", |
17 |
| - "apa", |
18 |
| - "--format", |
| 21 | + "-b", # use bibfile cite.bib |
| 22 | + "${BIBFILE}", |
| 23 | + "--style", # use style defined in env table |
| 24 | + "${STYLE}", |
| 25 | + "--format", # generate in html so it looks good in docs |
19 | 26 | "html",
|
20 |
| - "-i", |
21 |
| - "{}", |
| 27 | + "-i", # modify files inplace |
| 28 | + "{}", # fd shorthand for "the file you just found" |
22 | 29 | ]
|
23 |
| -dependencies = ["fd", "doc-build"] |
| 30 | +# dependencies to make sure the necessary binaries are installed |
| 31 | +# and the docs are actually generated |
| 32 | +dependencies = ["fd", "cmb", "doc-gen"] |
24 | 33 |
|
25 |
| -[tasks.doc-http] |
| 34 | +# serve docs over simple http server |
| 35 | +[tasks.doc-serve] |
26 | 36 | command = "http-server"
|
27 |
| -args = ['-i', '--cors', 'target/doc'] |
| 37 | +args = ['-i', '--cors', 'target/doc'] # -i to open index.html in dir |
| 38 | +dependencies = ["http", "doc-post-process"] |
28 | 39 |
|
29 |
| -[tasks.doc-serve] |
30 |
| -run_task = [{ name = ['doc-http', "doc-post-proc"], parallel = true }] |
| 40 | +# just an alias |
| 41 | +[tasks.doc-build] |
| 42 | +run_task = "doc-post-process" |
31 | 43 |
|
| 44 | +# needed for finding the files to modify in a cross platform way |
32 | 45 | [tasks.fd]
|
33 | 46 | install_crate = { crate_name = "fd-find", binary = "fd", test_arg = ["--help"] }
|
34 | 47 |
|
| 48 | +# simple http server we can bootstrap from crates.io directly |
35 | 49 | [tasks.http]
|
36 |
| -install_crate = { crate_name = "http-server", binary = "http-server", test_arg = [ |
37 |
| - "--help", |
38 |
| -] } |
| 50 | +install_crate = { crate_name = "http-server", binary = "http-server", test_arg = "--help" } |
| 51 | + |
| 52 | +# that's us of course |
| 53 | +[tasks.cmb] |
| 54 | +install_crate = { crate_name = "cite-me-bro", binary = "cmb", test_arg = "--help" } |
0 commit comments