170 Commits

Author SHA1 Message Date
StefanBRas
930a0c0787 Update configuring.md
Correctly format yaml codeblock.
2022-08-02 14:24:43 +02:00
Ludovico Bianchi
1efb213dc0 docs: use gender-neutral pronouns to refer to user 2022-07-30 07:37:17 +01:00
Can Kutlu Kınay
ef11f05a98 docs: add missing link to PEP-440 2022-07-27 14:45:46 +01:00
Jairo Llopis
04c99e85a9 feat: support getting template commit hash with {{ _copier_conf.vcs_ref_hash }}
When targeting reproducible builds, we need to have exact and immutable hashes.

Until now, there was only one way to get template commit. You could only get the tag, or the best serializable approach to obtain a commit from a tag.

Using this new helper, you can get what you need.
2022-06-13 10:44:04 +01:00
Jairo Llopis
e93fa227b9
docs: fix choice instructions
In copier 5 they had to type 1 or 2, but now it's interactive.
2022-06-12 09:34:23 +01:00
Paul Moore
05c5f09034
feat: simplify the format of the question prompt (#689)
Closes https://github.com/copier-org/copier/issues/674
2022-06-04 11:02:37 +00:00
Jairo Llopis
c16b0b8a7b
docs: skip_if_exists must be a list 2022-05-25 07:44:40 +01:00
Kian-Meng Ang
4684c78b5b Fix typos 2022-05-03 11:54:59 +08:00
Timothée Mazzucotelli
945238bdf6
docs: Document the context hook extension (#641)
Co-authored-by: Tom Verdaat <66591885+verdaatt@users.noreply.github.com>
2022-04-24 14:31:42 +01:00
Andrew Leech
e5dfa08c16 feat: Add jinja variable "_copier_python" to get sys.executable. 2022-03-22 17:25:44 +00:00
Yajo
8156846a35 docs(subdirectory): explain how to use subdirectory to host multiple templates in a single git repository
Also explain why it's a bad idea.

Fixes https://github.com/copier-org/copier/issues/578
2022-03-06 10:16:28 +00:00
Yajo
79e7622926 docs: clarify that answers file path must be relative to project root
This was already explained when running `copier --help`, but it still caused some confusion on users.

Fixes https://github.com/copier-org/copier/issues/579
2022-02-27 11:42:14 +00:00
Jairo Llopis
af0dbac4ab fix: correct default for skipped questions
A skipped question was not saved by Questionary, so I need to check if the answer is exactly like the question and, in that case, re-render it again.

Docs clarified to avoid false expectations on what should be the answer.

Fixes https://github.com/copier-org/copier/issues/529
2022-02-26 10:03:05 +00:00
Andrew Leech
c7d0402091 docs/generating: Add details about template version usage. 2022-02-26 08:44:36 +00:00
Timothée Mazzucotelli
3427b6d4ea docs: Use native Mermaid integration 2022-02-17 17:49:22 +00:00
Ben Yang
b255de2e34 Update configuring.md "Conditional files" section
Use the correct default syntax of `{%`, instead of `{{`.
2022-01-29 20:34:18 +00:00
Timothée Mazzucotelli
d2f5998b51
docs: Change diagram colors when switching between dark and light themes (#544) 2022-01-18 15:57:17 +01:00
eyllanesc
2dbdeaaa83 docs: enable footnotes and navigation.tracking 2022-01-15 15:41:45 +01:00
Yajo
1dc3a1bbce docs: fix some errors and lies, change colors
Old color palette wasn't easy to read in the dark.

New one is more readable and fits better with our logo.
2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
1afbae1181 docs: Add titles to code blocks where relevant 2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
3d41685a39 docs: Add minimal example to "creating" page 2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
616829db75 docs: Add native Jinja2 extensions 2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
3164f208e2 docs: Document condition files and directories 2022-01-13 21:35:11 +01:00
Timothée Mazzucotelli
77e3e53c4b refactor: Remove json method from Copier conf 2021-12-20 14:50:20 +00:00
Jairo Llopis
745a490415
fix: always compare versions as PEP440 strings (#434)
In migration scripts, environment variables `$VERSION_FROM`, `$VERSION_CURRENT` and `$VERSION_TO` didn't always get a valid PEP440 version identifier, but the tag. Now we add the PEP440 variants of those variables, autogenerated with dunamai, and these are used instead to sort the versions. This will help comparing template evolution when doing a checkout to an untagged version, or when you happen to add a tag without `v` when the previous one had it. If you want to get the exact commit or version, you can still use the old variables in your scripts, so no backwards incompatibility is introduced. It should remove some false negatives when comparing those version strings.

Fixes https://github.com/copier-org/copier/issues/269.
2021-11-01 08:28:58 +00:00
Timo Furrer
5ab752c11f
feat: keep trailing newlines for Jinja templates by default (#465)
Closes #464
2021-10-31 07:28:43 +00:00
Timothée Mazzucotelli
b3860dd274
fix: Fix unicode error on binary files (#436)
* fix: Fix unicode error on binary files

If a unicode decode error is raised
while trying to compile a file as a Jinja2 template,
and the templates suffix is empty,
we fallback to copying this file as is.

Fixes #433.
2021-08-03 17:19:04 +01:00
Jairo Llopis
2fe3072d6d docs: migration strategies across major copier versions
Try to answer a good question: when you upgrade one subproject from template v1 to v2, the template itself needs to be properly rendered in v1 to be compared to the subproject and extract the diff... well, we all know this at this point. But if Copier 6 renders differently the template v1 as compared to how Copier 5 would, then the template developer is on big trouble: How to evolve a subproject from a Copier v5-only template to a Copier v6-only template?

Fix https://github.com/copier-org/copier/issues/348
2021-07-17 08:37:30 +01:00
Dennis Roche
cfb9ec3bbc feat: Add additional flags for using default questions or overwriting files 2021-07-02 15:34:51 +01:00
Timothée Mazzucotelli
8bed0441a9 docs: Fix typo 2021-06-28 13:31:37 +01:00
Jairo Llopis
20c151e9f4 fix!: only support explicit types for multi-type choice questions
- Inform about `null` value being converted to choice key.
- Warn about problems when using multiple types in choices.

Fixes https://github.com/copier-org/copier/issues/405.
2021-05-21 16:54:30 +01:00
Timothée Mazzucotelli
23f5695a96 feat: Handle empty templates suffix 2021-05-17 13:29:13 +01:00
Jairo Llopis
2a944bf736 docs: update with latest changes
🤦‍♂️ it seems I forgot to document a lot of changes.
2021-04-20 07:21:36 +01:00
Jairo Llopis
054b962d70 docs: enable mermaid code fences 2021-04-20 07:21:36 +01:00
Jairo Llopis
bd29342502 docs: update questionary configuration
All those new things were not documented... 🤦‍♂️

Fix https://github.com/copier-org/copier/issues/297
2021-04-17 09:53:12 +01:00
Yajo
bbdbeb86c3 build: better gitpod and vscode UX
These days, Gitpod supports VSCode workspaces instead of only Theia.

Theia understands settings under `.vscode` as well as under `.theia`, but VSCode only understands settings under `.vscode`. Thus, it seems reasonable to move settings to that new location and then provide a good UX on both local VSCode and Gitpod's.

I also install new tools such as commitizen.

The goal is that just clicking on Gitpod badge, you have a full dev environment ready to hack.
2021-04-15 17:46:24 +01:00
Timothée Mazzucotelli
b3886a3730 docs: Add copier-templates-extensions in the extensions list 2021-04-05 13:05:42 +01:00
Timothée Mazzucotelli
bd83f15bd6
feat: Add extensions option allowing to load additional Jinja2 extensions (#370)
Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com>
2021-03-27 22:07:56 +00:00
Jairo Llopis
a9f3523b4e
docs 2021-03-14 08:04:20 +00:00
Jairo Llopis
0441b86f0c
Refactor (#314)
* Refactor
* Fix #110.
* Rewrite test_config_exclude, test_config_exclude_overridden and test_config_include. These tests were badly designed, using a monkeypatch that would never happen in the real world, and actually producing false positives. I moved them to test_exclude.py and rewritten to test the what and not the how.
* Fix #214 by removing skip option. Relevant tests use the better skip_if_exists=["**"].
* Remove subdirectory flag from API/CLI. It was confusing and could lead to bad maintenance situations. Fixes #315.
* Remove extra_paths and fix #321
* Remember that you cannot use _copier_conf.src_path as a path now
* use dataclasses
* Create errors module, simplify some tests, fix many others
* Fix some tests, complete EnvOps removal
* Fix #214 and some tests related to it
* Reorder code
* Update docs and imports
* Modularize test_complex_questions
* Interlink worker and questionary a bit better
* Removal of Questionary class, which only had 1 meaningful method that is now merged into Worker to avoid circular dependencies.
* Fix #280 in a simple way: only user answers are type-casted inside API, and CLI transforms all `--data` using YAML always. Predictable.
* Use prereleases correctly.
* Reorder AnswersMap to have a more significative repr.
* Simpler cache for old `Question.get_choices()` method (renamed now).
* fix wrong test
* Fix test_subdirectory
* Fix test_tasks (and remove tests/demo_tasks)
* Fix path filter tests, and move it to test_exclude, where it belongs
* Make test_config pass
* Fix more wrongly designed tests
* Use cached_property backport if needed
* xfail test known to fail on mac
* force posix paths on windows
* Add typing_extensions for python < 3.8
* Sort dependencies in pyproject.toml
* Support python 3.6 str-to-datetime conversion
* Workaround https://bugs.python.org/issue43095
* xfail test_path_filter on windows
* Upgrade mkdocs and other dependencies to fix https://github.com/pawamoy/mkdocstrings/issues/222
* Add missing reference docs.
* Add workaround for https://github.com/pawamoy/mkdocstrings/pull/209
* Docs.
* Remove validators module
* Add workaround for https://github.com/pawamoy/mkdocstrings/issues/225
* Restore docs autorefs as explained in https://github.com/pawamoy/mkdocstrings/issues/226#issuecomment-775413562.
* Workaround https://github.com/pawamoy/pytkdocs/issues/86
2021-02-09 18:22:47 +00:00
Robin Schneider
07a66f793e Fix docs: Short version of --pretend is -n not -q 2021-01-28 08:33:34 +00:00
Timothée Mazzucotelli
60c5866a00 docs: Fix formatting 2020-12-30 05:43:22 +00:00
Jairo Llopis
c7b9f21f83 Advise users to never edit manually the copier answers file
This keeps happening once and again, and confuses users.

Let's clarify it here in the docs.

I also fix some broken links and update deps BTW.
2020-12-18 10:09:46 +00:00
Nikolaus Schlemm
ef7ddd274e fixed typo
"-f" makes more sense and matches https://github.com/copier-org/copier/blob/master/copier/cli.py#L138 ;)
2020-10-31 12:03:43 +00:00
Jairo Llopis
dfb7688910 Explain how to use multiple templates for the same project
This is very cool and it doesn't seem to be clearly explained anywhere.
2020-10-17 11:20:37 +00:00
Timothée Mazzucotelli
9e3f151eec Document the update process
Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com>
2020-09-27 22:21:21 +02:00
Jairo Llopis
56bddd080e Remove --only-diff flag
This flag was not working fine, after all.

Also, the only difference between `copier copy` and `copier update` is that copying should ignore subproject history, while updating should respect it.

Thus, the real CLI reflection of the `only_diff` option is whether you're using `copier copy` or `copier update`. Well, that's how it is now.

Besides all this, the real behavior of `only_diff=False` wasn't being tested. Fixed also, and updated docs.

Fixes #270.
2020-09-18 11:21:04 +00:00
Jairo Llopis
b479cb9804 Make exclude extend if called from CLI/API
When adding the `exclude` option from CLI/API, it extends the definitions found in `copier.yml`.

When adding it in `copier.yml`, it replaces the defaults.

Fixes #215, which explains that it was very unexpected that excluding some extra things included a lot of other things by accident.
2020-09-18 10:55:09 +00:00
Jairo Llopis
57d138caea Copier will only cleanup the folder if it created it
It's OK that Copier deletes the destination folder by default when Copier created it. After all, if something failed, you probably don't want that dangling folder around.

However, if the folder existed before (which is always true if you're updating), Copier should not delete it. Yes, this will leave garbage there, but it will be better than removing what is no garbage by accident.

Apart from enforcing this new behavior, a new `--no-cleanup` CLI flag is exposed to `copier copy` to disable this behavior altogether. The flag is not available for `copier update` because it will never work there, as explained above.

This patch fixes #262 and closes #264.
2020-09-17 20:10:31 +00:00
Jairo Llopis
dfe51f5c2b Reorder reference docs
`api/index.md` docs were repeating the reference ones. No sense. DRY.
2020-09-17 17:26:35 +00:00