-
Notifications
You must be signed in to change notification settings - Fork 2k
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
First cut at issue 35: single file templates #885
First cut at issue 35: single file templates #885
Conversation
If __target__ is set in cookiecutter.json then files are placed at this location within the directory tree rather than creating a new directory. Pre-existing files are unaffected. A common case would be __target__ to '.' . The source directory in the template can be any cookiecutter template expression, but this is ignored. A value like {{cookiecutter.files}} is suggested.
71e3163
to
439112c
Compare
Current coverage is 100% (diff: 100%)@@ master #885 diff @@
====================================
Files 17 17
Lines 685 708 +23
Methods 0 0
Messages 0 0
Branches 0 0
====================================
+ Hits 685 708 +23
Misses 0 0
Partials 0 0
|
Fixing coverage at the moment. |
Raise errors when overwriting files if not rendering
Okay that should fix the coverage. Cue argument about "#pragma: no cover" in switch statement... |
Okay, I've actually rendered the documentation and looked at it now. At this point I'm tempted to do a rebase but imagine this might annoy people... |
Some thoughts on actually using this in anger: This feature allows you for have generated code co-existing with code that people have written, this opens up a number of issues:
|
Another potential-complexity / creeping-feature from using this in practice:
"Right, lets set up the base project with this cookie cutter" I don't know what I think about the argument that these should all be in the same template... |
|
Thanks for the feedback @sergray
This is the current behaviour.
I have no strong opinions about this. The directory can be called anything: |
It seems all checks have passed but the code hasn’t been merged? |
Is anybody working on resolving the conflicts? |
I'm closing this PR due to its age. |
Pull request for issue #35
I imagine people might have quite a lot of opinions about how this should be implemented. But I really want this feature, so I'll throw up a strawman for people to have opinions on.
The approach here is to add a
_target
setting tocookiecutter.json
which gets rendered to a directory into which files get copied.Demonstrating I've read the contributing file:
Some thorny issues that people might have opinions on:
-f
flag is givenI've written some documentation but was unable to get make the documentation run,
make servedocs
hangs withand no ports are listened on.