all repos — hastysite @ 5ddb2f4a452dc5454a3e689bbef2095fb10d2a82

A high-performance static site generator.

Updated MiNiM version; improved logging.
h3rald h3rald@h3rald.com
Sat, 12 Nov 2016 17:49:55 +0100
commit

5ddb2f4a452dc5454a3e689bbef2095fb10d2a82

parent

5eb0cf822356d7cb2512f9724a8ac46709db302b

2 files changed, 13 insertions(+), 10 deletions(-)

jump to
M hastysite.nimhastysite.nim

@@ -8,7 +8,8 @@ securehash,

sequtils, tables, critbits, - streams + streams, + logging import minim,

@@ -40,6 +41,8 @@ files*: HastyFiles

NoMetadataException* = ref Exception DictionaryRequiredException* = ref Exception MetadataRequiredException* = ref Exception + +setLogFilter(lvlNotice) #### MiNiM Library

@@ -99,7 +102,7 @@ outfile = hs.dirs.output/path

else: infile = hs.dirs.assets/path outfile = hs.dirs.output/path - echo " - Copying: ", infile, " -> ", outfile + notice " - Copying: ", infile, " -> ", outfile outfile.parentDir.createDir copyFileWithPermissions(infile, outfile)

@@ -192,7 +195,7 @@ else:

return default proc confirmDeleteDir(hs: HastySite, dir: string): bool = - stdout.write("Delete directory '$1' and all its contents? [Y/n] " % dir) + warn "Delete directory '$1' and all its contents? [Y/n] " % dir let confirm = $stdin.readChar return confirm == "\n" or confirm == "Y" or confirm == "y"

@@ -230,8 +233,8 @@ result["type"] = %"asset"

result["id"] = %path.changeFileExt("") result["ext"] = %fdata.ext -proc interpret(hs: HastySite, file: string, debugging = false) = - var i = newMinInterpreter(debugging, file, file.parentDir) +proc interpret(hs: HastySite, file: string) = + var i = newMinInterpreter(file, file.parentDir) i.hastysite_module(hs) i.interpret(newFileStream(file, fmRead))

@@ -295,13 +298,13 @@ proc clean*(hs: HastySite) =

hs.dirs.temp.removeDir proc build*(hs: var HastySite) = - echo "Preprocessing..." + notice "Preprocessing..." hs.preprocess() - echo "Detecting changes..." + notice "Detecting changes..." hs.detectChanges() - echo "Processing rules..." + notice "Processing rules..." hs.interpret(hs.files.rules) - echo "All done." + notice "All done." when isMainModule:
M hastysite.nimblehastysite.nimble

@@ -7,4 +7,4 @@ license = "MIT"

bin = "hastysite" [Deps] -requires: "nim >= 0.15.0, yaml >= 0.7.0, hastyscribe >= 1.4.0, minim >= 0.2.0" +requires: "nim >= 0.15.0, yaml >= 0.7.0, hastyscribe >= 1.4.0, minim >= 0.3.0"