Skip to content

Commit

Permalink
Add not_these_templates
Browse files Browse the repository at this point in the history
Fixes #4.
  • Loading branch information
annevk committed Apr 23, 2020
1 parent 6680c13 commit 5f1f2ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions factory.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
},
"html": {
"only_these_templates": ["LICENSE", "PULL_REQUEST_TEMPLATE.md"]
},
"infra": {
"not_these_templates": ["PULL_REQUEST_TEMPLATE.md"]
}
}
7 changes: 5 additions & 2 deletions factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def fill_templates(templates, variables):

def fill_template(contents, variables):
for variable, data in variables.items():
if variable == "only_these_templates":
if variable in ("not_these_templates", "only_these_templates"):
continue
elif variable == "extra_files" and data != "":
data = "\n\tEXTRA_FILES=\"{}\" \\".format(data)
Expand Down Expand Up @@ -66,6 +66,8 @@ def update(templates, variables):
for file in files:
if variables["only_these_templates"] and file not in variables["only_these_templates"]:
continue
elif variables["not_these_templates"] and file in variables["not_these_templates"]:
continue
write_file(file, files[file])
subprocess.run(["git", "add", file], capture_output=True)
if b"Changes to be committed" in subprocess.run(["git", "status"], capture_output=True).stdout:
Expand All @@ -92,7 +94,8 @@ def main():
"extra_files": "",
"post_build_step": "",
".gitignore": [],
"only_these_templates": None
"only_these_templates": None,
"not_these_templates": None
}
if shortname in local_db:
variables.update(local_db[shortname])
Expand Down

0 comments on commit 5f1f2ea

Please sign in to comment.