1797 Commits

Author SHA1 Message Date
Jairo Llopis
4ef0a8bc76
Cache ~/.local in CI builds
This will make dependencies installation much faster.
2020-03-13 13:40:18 +00:00
Jairo Llopis
2d1f6f3857
Tasks and migrations env utilities
The rendering context now includes `_copier_conf`, which is a copy of the raw `ConfigData` object, but removing anything not JSON-serializable (a.k.a. `data.now` and `data.make_secret`).

This is useful for a number of purposes:

1. Imagine you have migration scripts but you want to store them on your template and NOT in your copies. Then you can use `_copier_conf.src_path` to find the local clone and call anything from there. This fixes #95 and fixes #157.
2. In the execution environment, it includes `$STAGE` (can be `task`, `after` or `before`), and in the case of migrations also `$VERSION_{FROM,TO,CURRENT}` to let migration scripts know where they are in the moment they're called, so we can reuse migration scripts and unleash their full power.

Now you can write your scripts in any language you want, and use any task execution system you want. Tests include a bash script and a python script, and docs include how to integrate with Invoke.

@Tecnativa TT20357
2020-03-13 13:33:58 +00:00
Jairo Llopis
491366482e
Merge pull request #158 from Tecnativa/more_spaced_questions
More space among questions
2020-03-10 09:43:55 +00:00
Jairo Llopis
9dbad43f6d
More space among questions
As questions can include now a more detailed help and types, it would be helpful to have them more spaced. It looks better.
2020-03-09 13:50:57 +00:00
Ben Felder
97e5f300b4
Merge pull request #153 from pykong/update_changelog
Update changelog for 3.0.0
2020-03-05 10:56:45 +01:00
Ben Felder
d82a7430d9
Update CHANGELOG.md
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
2020-03-05 10:35:22 +01:00
Ben Felder
33ce754220
Update CHANGELOG.md
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
2020-03-05 10:35:15 +01:00
Ben Felder
548eb1f683
Update CHANGELOG.md
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
2020-03-05 10:35:07 +01:00
Ben Felder
ffcac7216d
Update CHANGELOG.md
Co-Authored-By: Jairo Llopis <Yajo@users.noreply.github.com>
2020-03-05 10:34:56 +01:00
Jairo Llopis
f283313d67
Merge pull request #156 from Tecnativa/good_precopy_when_updatediff
Do not attempt to run latter tasks in previous copies
3.0.0-alpha6
2020-03-04 13:52:11 +00:00
Jairo Llopis
5a83f411d4
Faster CI
- Parallel tests with pytest-xdist
- Sane cache usage
2020-03-04 13:49:09 +00:00
Jairo Llopis
48c72c61c3
Do not attempt to run latter tasks in previous copies
Due to copier not reloading the `copier.yml` file when doing the previous step to diff updates, it was trying to run tasks from let's say `v2` of the template after copying its `v1` version.

After this change, when copying `v1`, its `copier.yml` is reloaded, loading tasks for that version only (and executing them as usual).

The patch includes a git bundle that is a git repo with a couple of commits required to replicate the bug.

@Tecnativa TT20357
2020-03-04 13:41:37 +00:00
Ben Felder
655e1bc138
Up pre-release version to 3.0.0-alpha5 3.0.0-alpha5 2020-03-03 14:33:18 +01:00
Ben Felder
fa2ff83fba
Up pre-release 2020-03-03 14:05:39 +01:00
Jairo Llopis
bf42ca0a37
Merge pull request #155 from Tecnativa/secret_answers
Add secret questions support
v3.0.0-alpha4
2020-03-02 11:53:08 +00:00
Jairo Llopis
293d84f73d
Add secret questions support
Secrets questions are available in the jinja render context, but are not logged into `.copier-answers.yml` by default.

To mark a question as secret, just set `secret: true` into its definition. You can also pass a list of question keys in `_secret_questions` if you prefer.

@Tecnativa TT20357
2020-03-02 11:42:11 +00:00
Jairo Llopis
2b41175dc3
Run linters under poetry venv 2020-03-02 11:12:13 +00:00
Ben Felder
ba165fdcff
Update changelog for 3.0.0. further 2020-02-28 20:54:03 +01:00
Ben Felder
268daea6ae
Update changelog for 3.0.0 2020-02-28 20:39:20 +01:00
Ben Felder
8666027f8e
Merge pull request #152 from pykong/packaging_dep
Re-add module packaging
2020-02-28 20:30:43 +01:00
Ben Felder
97019627e3
Re-add module packaging 2020-02-28 20:26:22 +01:00
Ben Felder
787ab79464
Merge pull request #151 from pykong/check_readme
Check readme
2020-02-28 20:21:53 +01:00
Ben Felder
785db845b4
Add mypy badge 2020-02-28 20:20:48 +01:00
Ben Felder
535efe74fe
Update description in pyproject.toml 2020-02-28 20:11:38 +01:00
Ben Felder
024cbb0770
Improve grammar of readme 2020-02-28 20:07:23 +01:00
Ben Felder
c7052677d7
Capitalize copier 2020-02-28 19:53:48 +01:00
Ben Felder
5625a28318
Delete copier.sublime-workspace 2020-02-28 19:07:03 +01:00
Ben Felder
ce9426a44d
Create vertical space between Warning and Usage 2020-02-28 18:32:56 +01:00
Ben Felder
f78cbb9989
Merge pull request #148 from pykong/up_config
Minor improvements to configurations
2020-02-28 17:47:24 +01:00
Ben Felder
eef211c2c4
Run poetry check as a pre-commit hook 2020-02-28 17:43:30 +01:00
Ben Felder
5d14f310f7
Tidy-up pre-commit config 2020-02-28 17:32:34 +01:00
Ben Felder
ca09cd6955
Add black section to pyproject.toml 2020-02-28 15:40:43 +01:00
Ben Felder
871a17df72
Update hooks in pre-commit config 2020-02-28 15:34:50 +01:00
Ben Felder
1ff51f7278
Delete copier.sublime-workspace 2020-02-28 15:26:04 +01:00
Ben Felder
c84d92b756
Delete copier.sublime-project 2020-02-28 15:25:48 +01:00
Ben Felder
d7f7342dbd
Merge pull request #146 from pykong/conf_include_key_coll_test
Include test for key collision when including more than two files
2020-02-28 15:24:42 +01:00
Ben Felder
74f4ca1ee2
Update pre-commit config 2020-02-28 15:20:31 +01:00
Jairo Llopis
6bc337006c
Merge pull request #147 from Tecnativa/type-cast-cli-data-arg
Use None instead of "None" for str answer defaults
2020-02-28 14:18:01 +00:00
Ben Felder
06f8195072
Update gitignore with entries for Sublime Text 2020-02-28 15:14:19 +01:00
Jairo Llopis
7cabec8936
Cache CI builds 2020-02-28 14:14:19 +00:00
Jairo Llopis
36662bcc15
Use None instead of "None" for str answer defaults
Any other method, if it gets casted from `None` it will return the answer default.

In the case of `str`, `None` would default to `"None"`, which is not desired.

@Tecnativa TT20357
2020-02-28 14:14:19 +00:00
Ben Felder
6ae7cc5c54
Update transclude tests 2020-02-28 15:12:51 +01:00
Ben Felder
10f08c5522
Adapt comment in pre-commit config 2020-02-28 14:14:53 +01:00
Ben Felder
319ce86949
Exclude newly written test file from prettier 2020-02-28 14:05:52 +01:00
Ben Felder
6028ac0639
Fix EOF 2020-02-28 13:58:22 +01:00
Ben Felder
1878854e57
Add test_config_data_multi_transclusion 2020-02-28 13:55:35 +01:00
Jairo Llopis
4c81fe3b56
Merge pull request #145 from Tecnativa/type-cast-cli-data-arg
Make sure --data works
2020-02-28 12:21:37 +00:00
Jairo Llopis
32f795f0b5
Make sure --data works
When using the `--data` CLI option, all incoming data are strings. This is the expected behavior because at this point we still don't know the expected types of all answers (we don't even know the questions).

Now the type casting is done smartly when strings come in any form.

There are 2 special cases handled here:

1. When the expected type is bool and the incoming data is string. Handled by YAML because strings like "false", "0" and "no" would evaluate to `True` otherwise.
2. When the expected type is JSON or YAML but the incoming data is not a string. This can only happen when data comes in from API calls (not CLI) or is loaded from default answers in `copier.yml`. In these cases, we don't need to do any type casting, because the input is already a scalar.

@Tecnativa TT20357
2020-02-28 12:17:22 +00:00
Ben Felder
845e009ad4
Merge pull request #144 from Tecnativa/safe_dump
Safer & faster YAML dump
2020-02-28 11:26:11 +01:00
Jairo Llopis
be0d1cd8eb
Safer & faster YAML dump
Leverage pyyaml for a couple of jobs:

- Harden the possibility of dumping unsafe YAML, which was almost impossible already, but it's safer now.
- Do not sort twice; pyyaml already sorts.

@Tecnativa TT20357
2020-02-28 10:16:13 +00:00