-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
QRgen.nimble
73 lines (64 loc) · 1.92 KB
/
QRgen.nimble
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Package
version = "3.1.0"
author = "aruZeta"
description = "A QR code generation library."
license = "MIT"
srcDir = "src"
skipFiles = @["generateRepoImages.nim"]
# Dependencies
requires "nim >= 1.6.0"
# Tasks
import std/[strformat, strutils]
from os import walkDir, extractFilename
const repo = "https://github.com/aruZeta/QRgen"
const branches = ["develop", "main"]
const mainFile = "src/QRgen.nim"
task gendocs, "Generate documentation in docs folder":
proc getName: string =
for param in commandLineParams:
if param[0] != '-': return param
quit("You have to pass a name as the directory to store the generated docs")
let dir = getName()
if not(dir in branches or dir[0] == 'v'):
quit("The name can only be a branch name or tag name")
let flags = [
"--project",
&"--git.url:\"{repo}\"",
(if dir == "develop": "--docInternal"
else: ""),
&"--git.commit:{dir}",
].join " "
exec &"nim doc {flags} --path:.. --outdir:docs/QRgen src/QRgen/renderer.nim"
exec &"nim doc {flags} --path:. --outdir:docs {mainFile}"
task test, "Run tests on /test":
let flags = [
"--colors:on",
"--verbosity:2",
"--hints:off",
"--hint:GCStats:on",
"--hint:LineTooLong:on",
"--hint:XDeclaredButNotUsed:on",
"-w:on",
"--styleCheck:hint",
"--spellsuggest:auto",
"-f"
].join " "
for file in walkDir("tests/"):
let fileName = file.path.extractFilename
if fileName[0..3] == "test" and fileName[^4..^1] == ".nim":
exec &"nim c -r {flags} {file.path}"
task benchmark, "Run benchmarks on /test":
let flags = [
"--colors:on",
"--verbosity:0",
"--hints:off",
"-w:off",
"-f",
"-d:benchmark",
"--mm:orc",
"-d:lto"
].join " "
for file in walkDir("tests/"):
let fileName = file.path.extractFilename
if fileName[0..3] == "test" and fileName[^4..^1] == ".nim":
exec &"nim c -r {flags} {file.path}"