Fixes #126.
This commit is contained in:
parent
5524024229
commit
96ddb12da8
4 changed files with 44 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ proc validatePackageName*(name: string) =
|
|||
|
||||
if name[0] in {'0'..'9'}:
|
||||
raise newException(NimbleError,
|
||||
"Invalid package name: cannot beging with " & name[0])
|
||||
"Invalid package name: cannot begin with " & name[0])
|
||||
|
||||
var prevWasUnderscore = false
|
||||
for c in name:
|
||||
|
|
@ -90,6 +90,11 @@ proc validatePackageInfo(pkgInfo: PackageInfo, path: string) =
|
|||
if pkgInfo.name == "":
|
||||
raise newException(NimbleError, "Incorrect .nimble file: " & path &
|
||||
" does not contain a name field.")
|
||||
|
||||
if pkgInfo.name.normalize != path.splitFile.name.normalize:
|
||||
raise newException(NimbleError,
|
||||
"The .nimble file name must match name specified inside it.")
|
||||
|
||||
if pkgInfo.version == "":
|
||||
raise newException(NimbleError, "Incorrect .nimble file: " & path &
|
||||
" does not contain a version field.")
|
||||
|
|
@ -231,6 +236,8 @@ proc readPackageInfo*(nf: NimbleFile; onlyMinimalInfo=false): PackageInfo =
|
|||
## populated. The isNimScript field can also be relied on.
|
||||
result = initPackageInfo(nf)
|
||||
|
||||
validatePackageName(nf.splitFile.name)
|
||||
|
||||
var success = false
|
||||
var iniError: ref NimbleError
|
||||
# Attempt ini-format first.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue