Skip to content

Commit

Permalink
bump | update semver#head
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed May 10, 2023
1 parent a852081 commit 55da5ad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions pkginfo.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.3"
version = "0.1.4"
author = "George Lemon"
description = "A tiny utility package to extract Nimble information from any project"
license = "MIT"
Expand All @@ -10,7 +10,7 @@ srcDir = "src"
# Dependencies

requires "nim >= 1.6.4"
requires "semver >= 1.1.1"
requires "semver#head"

task tests, "Run tests":
exec "testament p 'tests/*.nim'"
4 changes: 2 additions & 2 deletions src/pkginfo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ template parsePkg(dep: JsonNode, hasStaticPkgInfo: bool) =
elif pkgName in ["nim", "pkginfo"]: continue
let pkgNimbleContents = staticExec("nimble dump " & pkgName & " --json" )
nimblePkg = parseJson(pkgNimbleContents)
else: nimblePkg = dep
else:
nimblePkg = dep
Package.dependencies[pkgName] = Pkg(pkgType: Dep)
Package.dependencies[pkgName].name = nimblePkg["name"].getStr
Package.dependencies[pkgName].version = nimblePkg["version"].getStr
Expand Down Expand Up @@ -234,7 +235,6 @@ proc nimVersion*(): Version {.compileTime.} =
proc dumpProject*(): Pkg {.compileTime.} =
result = Pkg(pkgType: Main)
let localNimble = parseJson(staticExec("nimble dump" & indent(getProjectPath() /../ "", 1) & " --json" ))
echo localNimble
for k, v in pairs(localNimble):
if k == "name":
result.name = v.getStr
Expand Down
34 changes: 17 additions & 17 deletions tests/test1.nim
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import unittest, pkginfo

test "when not requires <pkg>":
when not requires "toktok":
static: assert pkg("toktok") == nil
when not requires "toktok":
static: assert pkg("toktok") == nil

test "when requires <pkg>":
when requires "semver":
static:
assert pkg("semver") != nil
when requires "semver":
static:
assert pkg("semver") != nil

test "when requires <pkg> -- check `version`":
when requires "semver":
static:
assert pkg("semver").getVersion >= v "1.1.1"
when requires "semver":
static:
assert pkg("semver").getVersion > v("1.1.1")

test "when requires <pkg> -- check `license`":
when requires "semver":
static:
assert pkg("semver").getLicense == "BSD3"
when requires "semver":
static:
assert pkg("semver").getLicense == "BSD3"

test "check `nimVersion`":
static:
assert nimVersion() == v "1.6.4"
static:
assert nimVersion() == v "1.6.4"

test "check `pkg` `version`":
static:
assert pkg().getVersion >= v "0.1.0"
static:
assert pkg().getVersion >= version("0.1.0")

test "check `pkg` `license`":
static:
assert pkg().getLicense == "MIT"
static:
assert pkg().getLicense == "MIT"

0 comments on commit 55da5ad

Please sign in to comment.