123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- # Package
- version = "0.1.0"
- author = "NerdRat"
- description = "Examples and exercises from nim basics tutorial in https://narimiran.github.io/nim-basics/"
- license = "GPLv3"
- srcDir = "src"
- bin = @["nim_basics"]
- # Dependencies
- requires "nim >= 0.18.0"
- task test, "Run nim_basics tests":
- withDir "tests":
- exec "nim c -r test"
- task docs, "Build nim_basics documentation":
- echo "Building documentation..."
- if not dirExists "doc":
- mkDir "doc"
- let
- docDir = thisDir() & "/doc"
- sourceDir = thisDir() & "/" & srcDir
- mainFilename = sourceDir & "/" & (bin[0] & ".nim")
- buildCommand = "nim doc --project --index:on --outdir:" & docDir & " " & mainFilename
- buildIndexCommand = "nim buildIndex -o:" & docDir & "/index.html " & docDir
- exec buildCommand
- exec buildIndexCommand
- task info, "Print nimscript variables":
- echo("mode: ", mode)
- echo("packageName: ", packageName)
- echo("version: ", version)
- echo("author: ", author)
- echo("description: ", description)
- echo("license: ", license)
- echo("srcDir: ", srcDir)
- echo("binDir: ", binDir)
- echo("backend: ", backend)
- echo("skipDirs: ", skipDirs)
- echo("skipFiles: ", skipFiles)
- echo("skipExt: ", skipExt)
- echo("installDirs: ", installDirs)
- echo("installFiles: ", installFiles)
- echo("installExt: ", installExt)
- echo("bin: ", bin)
- echo("requiresData: ", nimscriptapi.requiresData)
- echo("buildOS: ", buildOS)
- echo("buildCPU: ", buildCPU)
- echo("listDirs(): ", listDirs(getCurrentDir()))
- echo("listFiles(): ", listFiles(getCurrentDir()))
- echo("getCurrentDir(): ", getCurrentDir())
-
- for param in 0..paramCount():
- echo "paramStr($1): $2" % [$param, paramStr(param)]
- echo("paramCount(): ", paramCount())
- echo("getCommand(): ", getCommand())
- echo("projectDir(): ", projectDir())
- echo("thisDir(): ", thisDir())
- task clean, "Cleaning nimcache and executables...":
- if fileExists bin[0]:
- rmFile bin[0]
- withDir "tests":
- if fileExists "test":
- rmFile "test"
- if dirExists "doc":
- rmDir "doc"
|