-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbf5c4c
commit 6e30f0a
Showing
2 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
# Note: cookiecutter first makes the main level directory using | ||
# directory_name from cookiecutter.json before running this hook | ||
|
||
{{ cookiecutter.update({ | ||
"package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), | ||
"directory_name": cookiecutter.directory_name.lower().replace(" ", "-"), | ||
"full_name": cookiecutter.full_name.replace('\"', '\\\"'), | ||
"repository": "git@github.com:" + cookiecutter.github_organization + "/" + cookiecutter.directory_name.lower().replace(" ", "-"), | ||
"repository_url": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.directory_name.lower().replace(" ", "-"), | ||
"package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"') | ||
}) }} | ||
import os | ||
import yaml | ||
|
||
def update_config(): | ||
with open("copier.yml") as f: | ||
config = yaml.safe_load(f) | ||
|
||
config.update({ | ||
"package_name": config["package_name"].lower().replace(" ", "_").replace("-", "_"), | ||
"directory_name": config["directory_name"].lower().replace(" ", "-"), | ||
"full_name": config["full_name"].replace('\"', '\\\"'), | ||
"repository": "git@github.com:" + config["github_organization"] + "/" + config["directory_name"].lower().replace(" ", "-"), | ||
"repository_url": "https://github.com/" + config["github_organization"] + "/" + config["directory_name"].lower().replace(" ", "-"), | ||
"package_short_description": config["package_short_description"].replace('\"', '\\\"') | ||
}) | ||
|
||
with open("copier.yml", "w") as f: | ||
yaml.safe_dump(config, f) | ||
|
||
if __name__ == "__main__": | ||
update_config() |