Created
February 18, 2016 00:41
-
-
Save dustinlacewell/c13f1a6998abac8c37e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
import sequtils | |
import ospaths | |
let | |
root_path = thisDir() | |
source_path = root_path / "dadren" | |
docs_path = root_path / "docs" | |
build_path = root_path / "gh_pages" | |
task docs, "build the dadren documentation": | |
rmDir(build_path) | |
mkDir(build_path) | |
withDir(build_path): | |
for file in listFiles(source_path): | |
let (dir, name, ext) = splitFile(file) | |
if ext == ".nim": | |
let cmd = "nim --index:on -p=$1 doc2 $2".format(root_path, file) | |
try: exec(cmd) | |
except: discard | |
for file in listFiles(docs_path): | |
let (dir, name, ext) = splitFile(file) | |
if ext == ".rst": | |
let cmd = "nim rst2html $1".format(file) | |
try: exec(cmd) | |
except: discard | |
for file in listFiles(docs_path): | |
let (dir, name, ext) = splitFile(file) | |
if ext == ".html": | |
let | |
filename = name & ext | |
htmlfile = name & ".html" | |
fullpath = joinPath(build_path, htmlfile) | |
echo "File:" | |
echo(file) | |
echo "Build path:" | |
echo(build_path) | |
echo "Htmlfile:" | |
echo(htmlfile) | |
echo "Full path:" | |
echo(fullpath) | |
echo("moving $1 to $2".format(file, fullpath)) | |
mvFile(file, fullpath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File: | |
/home/dlacewell/nim/dadren/docs/overview.html | |
Build path: | |
/home/dlacewell/nim/dadren/docs/overview.rst | |
Htmlfile: | |
overview.html | |
Full path: | |
/home/dlacewell/nim/dadren/docs/overview.rst/overview.html | |
moving /home/dlacewell/nim/dadren/docs/overview.html to /home/dlacewell/nim/dadren/docs/overview.rst/overview.html | |
stack trace: (most recent call last) | |
lib/system/nimscript.nim(253) | |
lib/system/nimscript.nim(228) docsTask | |
lib/system/nimscript.nim(131) cd | |
lib/system/nimscript.nim(131, 19) Error: unhandled exception: Not a directory Not a directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment