-
Notifications
You must be signed in to change notification settings - Fork 0
/
lodns.nimble
44 lines (37 loc) · 971 Bytes
/
lodns.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
# Package
version = "0.1.9"
author = "vandot"
description = "Simple DNS server for local development"
license = "MIT"
srcDir = "src"
bin = @["lodns"]
binDir = "build"
installExt = @["nim"]
skipDirs = @[
".github",
]
# Dependencies
requires "nim >= 1.6.6"
requires "dnsprotocol"
requires "https://github.com/vandot/nim-sudo#head"
# Tasks
proc updateNimbleVersion(ver: string) =
let fname = currentSourcePath()
let txt = readFile(fname)
var lines = txt.split("\n")
for i, line in lines:
if line.startsWith("version"):
let s = line.find('"')
let e = line.find('"', s+1)
lines[i] = line[0..s] & ver & line[e..<line.len]
break
writeFile(fname, lines.join("\n"))
task version, "update version":
# last params as version
let ver = paramStr( paramCount() )
if ver == "version":
# print current version
echo version
else:
withDir thisDir():
updateNimbleVersion(ver)