This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Avoid overwrite when regenerating project#22
Merged
Conversation
Restructured code so post-gen hook writes values for placeholders to yaml file. This allows for values such as "current_dir" to be replaced by final output directory instead of tmp directory.
This version adequately deals with changes in template files between cookiecutter generations TODO: need to find better way to identify path to store any prompt population yaml files and manifest file. Current implementation makes assumptions about the CWD which may be unsafe Potential bug if the original generation is done to a directory which is non-empty and contains files with the same name as those being generated
- Manifest files now saved in base of output directory - Prompt population yaml saved in temporary directory so it can be accessed and removed after displaying final messages - Fixed type annotations/removed debug comments
address issue stemming from files existing in output directory before generation
Address workflow failures stemming from not being able to locate coverage info See here: https://github.com/varun646/PythonProjectBootstrapperTest/actions/runs/8691233105/job/23833091301
davidbrownell
suggested changes
Apr 15, 2024
###Changes - Moved functions to separate file - Added tests - Removed old tests that were failing (likely) due to changes in working directory - Fixed pylint issues TODO: check that the prompt file is being created at the ideal place TODO: look into whether another test needs to be added for generating to a directory where a file name already exists but not in the manifest
davidbrownell
suggested changes
Apr 19, 2024
- Remove `hashlib.file_digest()` function which is no longer used Should address workflow failures on mac
change copy function so it no longer copies metadata. It seems like errors were coming up from trying to get file data so this could be the cause
- Manifest keys are now posix strings (path sep == '/') for support on Windows (where path sep == '\') - No longer running cross-os tests (e.g. no longer running "MacOS" on "Linux" machines). We exercise those tests in the CI process.
- Make functions public - Nit comments - Remove unnecessary casting
davidbrownell
suggested changes
Apr 25, 2024
0d8b69c to
99f7b39
Compare
Address comments from commit 99f7b39
davidbrownell
approved these changes
Apr 26, 2024
Contributor
davidbrownell
left a comment
There was a problem hiding this comment.
Looks good - congrats!
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Currently, any changes made locally are overwritten when regenerating a project to that directory. This is addressed by creating a temporary directory, generating to that directory, copying over content if the user has made no changes to the files which we will overwrite, and finally removing the temporary dir.
To keep track of whether a user has made changes, we store a file hash for each file at the point that the file is originally generated (or if it is removed from the output directory then generated again, the stored hash will correspond to the status of the file at regeneration). These values are stored in
<output_dir>/.manifest.ymlso they can be checked into GitHub and can be accessed if a user changes devices.