forked from Vindaar/ggplotnim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathggplotnim.nimble
More file actions
54 lines (45 loc) · 1.5 KB
/
ggplotnim.nimble
File metadata and controls
54 lines (45 loc) · 1.5 KB
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
# Package
version = "0.1.6"
author = "Sebastian Schmidt"
description = "A port of ggplot2 for Nim"
license = "MIT"
srcDir = "src"
# Dependencies
requires "nim >= 1.0.0"
requires "https://github.com/Vindaar/seqmath >= 0.1.3"
requires "ginger >= 0.1.3"
requires "persvector >= 1.0.0"
task test, "Run tests":
exec "nim c -r tests/testDf.nim"
exec "nim c -r tests/tests.nim"
exec "nim c -r tests/test_issue2.nim"
exec "nim c -r tests/test_issue20.nim"
import ospaths, strutils, strformat
const
pkgName = "ggplotnim"
orgFile = "docs" / (pkgName & ".org")
rstFile = "docs" / (pkgName & ".rst")
rstFileAuto = "docs" / (pkgName & "_autogen.rst")
proc basename(f: string): string =
let (dir, name, ext) = f.splitFile
result = name
proc removePrefix(f, prefix: string): string =
result = f
result.removePrefix(prefix)
# doc generation inspired by `strfmt`
task docs, "Generate HTML docs using the Org file":
# https://github.com/jgm/pandoc/issues/4749
exec "pandoc " & orgFile & " -o " & rstFile
var files: seq[string]
template walk(path: string, outf: untyped): untyped {.dirty.} =
for filePath in listFiles(path):
if filePath.endsWith(".nim"):
let outfile = outf
exec &"nim doc {outfile} {filePath}"
files.add outfile.removePrefix("-o:")
walk("src", "-o:index.html")
walk("src" / pkgName, &"-o:{filePath.basename}.html")
mvFile rstFile, rstFileAuto
for f in files:
let fname = f.basename & ".html"
mvFile fname, "docs/" & $fname