49 Commits

Author SHA1 Message Date
Sigurd Spieckermann
befe8c5ea5 docs: always use ordered list marker "1." 2022-09-09 16:04:20 +01:00
Sigurd Spieckermann
5a6d930a45 docs: update Jinja2 docs URL to v3.1.x 2022-08-28 09:18:17 +01:00
Sigurd Spieckermann
fc6bb03a6d docs: fix spelling 2022-08-26 09:47:49 +01:00
Talley Lambert
6fcd7e02b8
feat: add validator field to Question (#719)
* docs: add note to docstring

* feat: print spawn logs on failure, and fix failure in test

The test was failing because it turns out that `tui` won't print letters that must not change, when running an interactive TUI.

I changed the error message for something that will force all letters to change. This way it works as expected.

Co-authored-by: Jairo Llopis <yajo.sk8@gmail.com>
2022-08-06 15:48:21 +00:00
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
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
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
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
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
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
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
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
6e7cff8b37 Allow multidoc copier.yml with glob include
Before this patch, using `!include` was a bit absurd because it would fail under any useful scenario:

- Including with a glob.
- Trying to include more than 1 file.

Now all those are supported, and they can coexist. Besides, the patch is quite simple, which makes it more attractive.

Fix #237.
2020-09-05 11:22:42 +00:00
Jairo Llopis
d6324eb7a4 Fix admonitions
Little bug that made these docs look like code instead of normal docs.
2020-08-13 12:14:48 +00:00
Jairo Llopis
1e464dad0f Add --prereleases support
Before this patch, Copier didn't ignore prereleases when detecting latest template tag.

This is mostly a bug because there's no way to safely upgrade a template to the latest non-prerelease tag automatically.

This a behavioral change that probably didn't hit anybody out there, but enough to make a new big release.
2020-08-13 11:45:18 +00:00
Jairo Llopis
8be4bbe93a Better docs for CLI
- Add `only_diff` docs.
- Link CLI docs with those from configuration.
- Add link on `copier --help` to the docs.
- Include `copier --help-all` in the online docs.
2020-08-13 10:17:23 +00:00
Jairo Llopis
cdb563a96d Add 4-space indentation to .md files
Mkdocs uses `python-markdown`, and [they say](https://python-markdown.github.io/#differences):

> The syntax rules clearly state that when a list item consists of multiple paragraphs, “each subsequent paragraph in a list item must be indented by either 4 spaces or one tab” (emphasis added). However, many implementations do not enforce this rule and allow less than 4 spaces of indentation. The implementers of Python-Markdown consider it a bug to not enforce this rule.

As we were using 2 spaces for markdown files (which looks better in source code), some indented lists were not displaying properly in the docs page.

Thus I change the setting to 4 spaces. Prettier will now enforce them, and mkdocs will display things properly.
2020-08-10 12:59:07 +00:00
Jairo Llopis
a456f59b7a A little polish on docs
- Prepare for a new release.
- Add configuring page, with more explicit docs and examples for each option.
- Remove configuration stuff from creation page.
- Comparisons are ugly, so remove them from the index page.
2020-08-10 11:27:52 +00:00