New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve update command #159
Conversation
b2a1b03
to
8c98eba
Compare
Codecov ReportBase: 99.77% // Head: 99.78% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #159 +/- ##
=======================================
Coverage 99.77% 99.78%
=======================================
Files 21 21
Lines 899 934 +35
=======================================
+ Hits 897 932 +35
Misses 2 2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@samj1912 let me know when you have some time to review this one :) |
8c98eba
to
6ad8fc3
Compare
I was planning to submit a similar PR (see my proposal in #57 (comment)), good to see we're not the only ones looking for a more versatile update command. |
This commit adds support for providing cookiecutter arguments on the command line for `cruft update`. If any arguments are provided on the command line `cruft update` will always render the template regardless of whether the user has requested to update to a new template version or not. Ideally this change will be applied after cruft#159 as it's been developed on top of that PR originally.
This commit adds support for providing cookiecutter arguments on the command line for `cruft update`. If any arguments are provided on the command line `cruft update` will always render the template regardless of whether the user has requested to update to a new template version or not. Ideally this change will be applied after cruft#159 as it's been developed on top of that PR originally.
This commit adds support for providing cookiecutter arguments on the command line for `cruft update`. If any arguments are provided on the command line `cruft update` will always render the template regardless of whether the user has requested to update to a new template version or not. Ideally this change will be applied after cruft#159 as it's been developed on top of that PR originally.
Branch `patched-update` includes cruft/cruft#159 and cruft/cruft#167.
With Cookiecutter 2.2.0's support for boolean variables, perhaps this PR could also be extended to support transitioning from string values such as "0" or "1" to the boolean values Specifically, the documentation on boolean variables says that these values should map to
|
@lsorber not sure if is related to these changes. Better do it in a separate PR. |
6ad8fc3
to
8c9ecd2
Compare
If the user asks to re-input the cookiecutter context, it might try to update some value. In that case, it is intersting to skip the early return of the same template commit revision.
If we reuse the same inputs for both current and new context cruft will not be able to capture inputs changes, resulting in less changes than the expected.
At this moment, it is not possible to update a cookiecutter private variable with the update command because the current context are not aware of the template changes. Removing the private variables from cruft_state before creating the updated context seems to refresh the private variables from the template.
8c9ecd2
to
5d6c067
Compare
bump, any updates on this feature? |
This PR tries to improve how the update command works in cases where the cookiecutter template receives new variable values.
It handles two scenarios:
--cookiecutter-input
flag--refresh-private-variables
flag (feel free to suggest some better naming 😄 )To test those changes, I created a fork of the https://github.com/cruft/cookiecutter-test repo and used those two branches:
https://github.com/gmsantos/cookiecutter-test/tree/input
https://github.com/gmsantos/cookiecutter-test/tree/input-updated
Those branches can be added back in a similar way as cruft/cookiecutter-test#1 (I can sync the tests after that).