nim_basics.nimble 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Package
  2. version = "0.1.0"
  3. author = "NerdRat"
  4. description = "Examples and exercises from nim basics tutorial in https://narimiran.github.io/nim-basics/"
  5. license = "GPLv3"
  6. srcDir = "src"
  7. bin = @["nim_basics"]
  8. # Dependencies
  9. requires "nim >= 0.18.0"
  10. task test, "Run nim_basics tests":
  11. withDir "tests":
  12. exec "nim c -r test"
  13. task docs, "Build nim_basics documentation":
  14. echo "Building documentation..."
  15. if not dirExists "doc":
  16. mkDir "doc"
  17. let
  18. docDir = thisDir() & "/doc"
  19. sourceDir = thisDir() & "/" & srcDir
  20. mainFilename = sourceDir & "/" & (bin[0] & ".nim")
  21. buildCommand = "nim doc --project --index:on --outdir:" & docDir & " " & mainFilename
  22. buildIndexCommand = "nim buildIndex -o:" & docDir & "/index.html " & docDir
  23. exec buildCommand
  24. exec buildIndexCommand
  25. task info, "Print nimscript variables":
  26. echo("mode: ", mode)
  27. echo("packageName: ", packageName)
  28. echo("version: ", version)
  29. echo("author: ", author)
  30. echo("description: ", description)
  31. echo("license: ", license)
  32. echo("srcDir: ", srcDir)
  33. echo("binDir: ", binDir)
  34. echo("backend: ", backend)
  35. echo("skipDirs: ", skipDirs)
  36. echo("skipFiles: ", skipFiles)
  37. echo("skipExt: ", skipExt)
  38. echo("installDirs: ", installDirs)
  39. echo("installFiles: ", installFiles)
  40. echo("installExt: ", installExt)
  41. echo("bin: ", bin)
  42. echo("requiresData: ", nimscriptapi.requiresData)
  43. echo("buildOS: ", buildOS)
  44. echo("buildCPU: ", buildCPU)
  45. echo("listDirs(): ", listDirs(getCurrentDir()))
  46. echo("listFiles(): ", listFiles(getCurrentDir()))
  47. echo("getCurrentDir(): ", getCurrentDir())
  48. for param in 0..paramCount():
  49. echo "paramStr($1): $2" % [$param, paramStr(param)]
  50. echo("paramCount(): ", paramCount())
  51. echo("getCommand(): ", getCommand())
  52. echo("projectDir(): ", projectDir())
  53. echo("thisDir(): ", thisDir())
  54. task clean, "Cleaning nimcache and executables...":
  55. if fileExists bin[0]:
  56. rmFile bin[0]
  57. withDir "tests":
  58. if fileExists "test":
  59. rmFile "test"
  60. if dirExists "doc":
  61. rmDir "doc"