Skip to content

Commit

Permalink
nimble: set version from configlet.version file (#616)
Browse files Browse the repository at this point in the history
Configlet has been using pre-release semantic versions (which contain a
hyphen) like `4.0.0-beta.1`. However, such a version is currently
not allowed in the nimble file:

    $ nimble check
         Error: Version may only consist of numbers and the '.' character but found '-'.
       Failure: Validation failed

As a workaround, we have been specifying the configlet version in a
custom `configlet.version` file (see commit e90c5ec) that can
contain anything.

Let's use that file to set the nimble file `version`. This will allow
future major/minor/patch version bumps to occur only in the dedicated
file, like the pre-release ones, which will also simplify the version
bumping script.

This commit does not change the version string:

    $ nimble dump | grep version
    version: "4.0.0"
  • Loading branch information
ee7 committed Jun 17, 2022
1 parent 3f4193f commit 4a39d4a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion configlet.nimble
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import std/[hashes, os, strutils]

proc getVersionStart: string =
# Returns the `major.minor.patch` version in the `configlet.version` file
# (that is, omitting any pre-release version information).
result = staticRead("configlet.version")
for i, c in result:
if c notin {'0'..'9', '.'}:
result.setLen(i)
return result

# Package
version = "4.0.0"
version = getVersionStart() # Must consist only of digits and '.'
author = "ee7"
description = "A tool for managing Exercism language track repositories"
license = "AGPL-3.0-only"
Expand Down

0 comments on commit 4a39d4a

Please sign in to comment.