-
Notifications
You must be signed in to change notification settings - Fork 2
/
timezones.nimble
63 lines (48 loc) · 1.9 KB
/
timezones.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
import std / os
import timezones / private / tzversion
version = "0.5.4"
author = "Oscar Nihlgård"
description = "Timezone library compatible with the standard library"
license = "MIT"
bin = @["timezones/fetchjsontimezones"]
installDirs = @["timezones"]
installFiles = @[TzDbVersion & ".json", "timezones.nim"]
requires "nim >= 0.19.9"
# Tasks
task fetch, "Fetch the timezone database":
exec "nim c -d:timezonesNoEmbeed -r timezones/fetchjsontimezones " &
TzDbVersion & " --out:" & thisDir() / TzDbVersion & ".json"
task test, "Run the tests":
echo thisDir()
let tzdataPath = thisDir() / TzDbVersion & ".json"
# Run tests with various backends and options
echo "\nRunning tests (C)"
echo "==============="
exec "nim c --hints:off -r tests/tests.nim"
echo "\nRunning tests (C in release mode)"
echo "==============="
exec "nim c --hints:off -r -d:release tests/tests.nim"
echo "\nRunning tests (JS)"
echo "================"
exec "nim js -d:nodejs --hints:off -r tests/tests.nim"
echo "\nTesting -d:timezonesPath (C)"
echo "================"
exec "nim c --hints:off -d:timezonesPath=\"" & tzdataPath &
"\" -r tests/tests.nim"
echo "\nTesting -d:timezonesPath (JS)"
echo "================"
exec "nim js -d:nodejs --hints:off -d:timezonesPath=\"" & tzdataPath &
"\" -r tests/tests.nim"
rmFile "tests/tests"
rmFile "tests/tests.js"
# Test `fetchjsontimezones`
when defined(posix):
exec "nim c --hints:off -r timezones/fetchjsontimezones " &
"2020d --out:testdata.json"
rmFile "testdata.json"
rmFile "timezones/fetchjsontimezones"
else:
exec "nim c --hints:off timezones/fetchjsontimezones"
task docs, "Generate docs":
exec "nim doc -o:docs/timezones.html timezones.nim"
exec "nim doc -o:docs/posixtimezones.html timezones/posixtimezones.nim"