Merge pull request #14 from jyapayne/reset_files

Add section for resetting files
This commit is contained in:
genotrance 2018-07-10 12:30:56 -05:00 committed by GitHub
commit ef59bd105d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -118,6 +118,14 @@ The following keys can be used to prepare dependencies such as downloading ZIP f
```copy``` = copy a file to another location. Preferred over moving to preserve original. Comma separate for multiple entries. E.g. copy = "output/config.h.in=output/config.h"
_[n.post]_
This section is the same as the prepare section, but for performing actions after the project has been processed.
```reset``` = whether or not to perform a git reset on all files after processing [default: false]
```execute``` = command to run after processing
_[n.wildcard]_
File wildcards such as *.nim, ssl*.h, etc. can be used to perform tasks across a group of files. This is useful to define common operations such as global text replacements without having to specify an explicit section for every single file. These operations will be performed on every matching file that is defined as a _sourcefile_ or recursed files. Only applies on source files following the wildcard declarations.

View file

@ -811,11 +811,22 @@ proc runCfg(cfg: string) =
gConfig["n.wildcard"][wild])
for file in gConfig.keys():
if file in @["n.global", "n.include", "n.exclude", "n.prepare", "n.wildcard"]:
if file in @["n.global", "n.include", "n.exclude",
"n.prepare", "n.wildcard", "n.post"]:
continue
runFile(file, gConfig[file])
if gConfig.hasKey("n.post"):
for post in gConfig["n.post"].keys():
let (key, val) = getKey(post)
if val == true:
let postVal = gConfig["n.post"][post]
if key == "reset":
gitReset()
elif key == "execute":
discard execProc(postVal)
# ###
# Main loop