-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpothole.nimble
executable file
·70 lines (58 loc) · 2.13 KB
/
pothole.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
# Package
version = "0.0.2"
author = "penguinite"
description = "A MastoAPI backend server and a general-purpose social media/microblogging library"
license = "AGPL-3.0-or-later"
srcDir = "src"
binDir = "build"
bin = @["pothole","potholectl"]
backend = "c"
## The following options are required
when not defined(phEmbedded):
switch("stackTrace","on") # For better debugging
switch("mm", "orc") # Required by mummy
switch("d", "useMalloc") # Required for fixing memory leak, git blame and see commit msg.
switch("threads","on") # Required by mummy
after clean:
if dirExists("static/"):
rmdir("static/")
if dirExists("uploads/"):
rmdir("uploads/")
if dirExists(binDir):
rmdir(binDir)
var
commit = ""
commitCmd = gorgeEx("git rev-parse HEAD^")
if commitCmd[1] == 0:
commit = commitCmd[0]
task pothole, "Builds pothole, with versioning embedded.":
exec "nimble -d:phVersion=\"" & version & " - " & commit & "\" -d:release build pothole"
from std/os import commandLineParams
task ctl, "Shorthand for nimble run potholectl":
proc cleanArgs(): seq[string] =
## commandLineParams() returns the command line params for the whole nimble commands.
## Which can fuck up the more advanced commands. (user new, post new and so on)
## So this command strips everything after the task name, which works well!
return commandLineParams()[commandLineParams().find("ctl") + 1..^1]
if dirExists(binDir) and fileExists(binDir & "/potholectl"):
exec binDir & "/potholectl " & cleanArgs().join(" ")
return
if fileExists("potholectl"):
exec "./potholectl " & cleanArgs().join(" ")
return
exec("nimble -d:release build potholectl")
exec(binDir & "/potholectl " & cleanArgs().join(" "))
after build:
cpFile("pothole.conf",binDir & "/pothole.conf")
cpFile("LICENSE", binDir & "/LICENSE")
# Dependencies
requires "nim >= 2.0.0"
requires "nimcrypto >= 0.5.4"
requires "rng >= 0.1.0"
requires "iniplus >= 0.3.3"
requires "temple >= 0.2.3"
requires "db_connector >= 0.1.0"
requires "mummy >= 0.4.2"
requires "waterpark >= 0.1.7"
requires "cligen >= 1.7.3"
requires "smtp"