2024-09-19 12:07:07 -05:00
|
|
|
import std/[os, strformat, strutils]
|
|
|
|
|
2024-09-17 17:28:21 -05:00
|
|
|
task test, "run tests":
|
|
|
|
selfExec "r tests/tbbansi.nim"
|
2024-09-18 13:27:01 -05:00
|
|
|
|
|
|
|
task develop, "install cligen for development":
|
|
|
|
exec "nimble install -l 'cligen@1.7.5'"
|
|
|
|
|
2024-09-26 08:53:01 -05:00
|
|
|
proc docFixup(deployDir:string, pkgName: string) =
|
|
|
|
## apply renames to api docs
|
2024-09-19 12:07:07 -05:00
|
|
|
withDir deployDir:
|
|
|
|
mvFile(pkgName & ".html", "index.html")
|
|
|
|
for file in walkDirRec(".", {pcFile}):
|
|
|
|
# As we renamed the file, we need to rename that in hyperlinks
|
|
|
|
exec(r"sed -i -r 's|$1\.html|index.html|g' $2" % [pkgName, file])
|
|
|
|
# drop 'src/' from titles
|
|
|
|
exec(r"sed -i -r 's/<(.*)>src\//<\1>/' $1" % file)
|
|
|
|
|
2024-09-26 08:53:01 -05:00
|
|
|
task docs, "Deploy doc html + search index to public/ directory":
|
|
|
|
let
|
|
|
|
deployDir = getCurrentDir() / "public"
|
|
|
|
pkgName = "hwylterm"
|
|
|
|
gitFlags = fmt"--git.url:'https://github.com/daylinmorgan/{pkgName}' --git.commit:main"
|
2024-09-27 15:01:05 -05:00
|
|
|
when defined(clean):
|
2024-09-30 13:54:42 -05:00
|
|
|
echo fmt"clearing {deployDir}"
|
2024-09-27 15:01:05 -05:00
|
|
|
rmDir deployDir
|
2024-09-30 17:06:57 -05:00
|
|
|
for module in ["cligen", "chooser", "logging", "cli"]:
|
2024-09-26 08:53:01 -05:00
|
|
|
selfExec fmt"doc --docRoot:{getCurrentDir()}/src/ --index:on --outdir:{deployDir} src/hwylterm/{module}"
|
|
|
|
selfExec fmt"doc --project --index:on {gitFlags} --outdir:{deployDir} --project src/{pkgName}.nim"
|
|
|
|
docFixup(deployDir,pkgName)
|
|
|
|
|
2024-09-19 12:07:07 -05:00
|
|
|
when withDir(thisDir(), system.dirExists("nimbledeps")):
|
|
|
|
--path:"./nimbledeps/pkgs2/cligen-1.7.5-f3ffe7329c8db755677d3ca377d02ff176cec8b1"
|