1797 Commits

Author SHA1 Message Date
Timothée Mazzucotelli
18ab2f2966 Stop using deprecated semver.compare function 2020-05-19 21:36:18 +02:00
Jairo Llopis
ebdf05bcd4
Merge pull request #207 from Tecnativa/tmdrel
Improve tasks & migration docs, prepare v3.1.0 release
v3.1.0
2020-05-11 08:52:45 +01:00
Jairo Llopis
cce3a5d961
Improve tasks & migration docs, prepare v3.1.0 release
Fixes #195.
2020-05-11 08:49:45 +01:00
Jairo Llopis
a8e684736b
Merge pull request #205 from pawamoy/minimum-version-required
Add minimum copier version verification
2020-05-11 08:11:36 +01:00
Timothée Mazzucotelli
cfb6ca921d Add minimum copier version verification 2020-05-10 15:23:23 +02:00
Jairo Llopis
6001b1dfc2
Merge pull request #204 from pawamoy/pytest-dev-dep
Move pytest-xdist as development dependency
2020-05-07 08:17:51 +01:00
Timothée Mazzucotelli
9e152704d9 Move pytest-xdist as development dependency 2020-05-06 14:07:55 +02:00
Jairo Llopis
978edd8965
Merge pull request #192 from pawamoy/docs-readme-improvements
Update README structure
2020-05-06 11:00:43 +01:00
Timothée Mazzucotelli
92472ce639 Update README structure
Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com>
2020-05-05 10:49:43 +02:00
Jairo Llopis
86ed02052c
Merge pull request #194 from pawamoy/ignore-stuff
Ignore IntelliJ conf dir and testing artifacts
2020-05-04 09:26:52 +01:00
Jairo Llopis
df75df6590
Merge pull request #188 from Tecnativa/beautier-prompts
[IMP] Make prompts more beautiful
2020-05-04 09:26:29 +01:00
Jairo Llopis
95495bcf44
Merge pull request #202 from Tecnativa/recommend-topic
Recommend copier-template GH topic
2020-05-04 09:20:13 +01:00
Jairo Llopis
040262d949
[IMP] Make prompts more beautiful
- Help messages were too separated from question and too close to previous question due to weird newlines.
- Secrets had no indication that they were secrets. Now they have a 🕵️ icon.
2020-05-04 09:19:51 +01:00
Jairo Llopis
08c1a5231b
Recommend copier-template GH topic
Fix #201
2020-05-04 09:15:42 +01:00
Jairo Llopis
11bc27de8d
Merge pull request #190 from pawamoy/add-prompt-templating
Add prompt templating
2020-04-30 10:02:06 +01:00
Timothée Mazzucotelli
59f1f3a8ee Add prompt templating 2020-04-29 12:45:42 +02:00
Timothée Mazzucotelli
9ee93eca9c Ignore IntelliJ conf dir and testing artifacts 2020-04-26 15:58:23 +02:00
Jairo Llopis
50b854616d
Merge pull request #180 from pawamoy/patch-1
Fix link
2020-04-20 20:20:04 +01:00
Timothée Mazzucotelli
8d6a0233e6
Fix link 2020-04-16 13:12:32 +02:00
Jairo Llopis
9c3fe7cc02
Merge pull request #177 from Tecnativa/fix-choice-types
Fix type castings in choices
v3.0.6
2020-04-13 12:38:19 +01:00
Jairo Llopis
184a1ca98d
Fix type castings in choices
When data came from `--data` flag, it was always a string.

If some data was expected to be of another type, it could make the template fail.

The type casting system must be applied also to user answers, so here's the patch, docs and tests.

@Tecnativa TT20357
2020-04-13 12:31:45 +01:00
Jairo Llopis
d1b6725af2
Merge pull request #176 from Tecnativa/old-git-dont-die
Do not die with old git versions
2020-04-13 10:08:55 +01:00
Jairo Llopis
90ca9380c2
Do not die with old git versions
Close #175 by supporting old git versions. These will provide a worse update experience, but still work. Instead of failing, a warning is printed for the user.
2020-04-13 09:59:41 +01:00
Jairo Llopis
a162956e0f
Merge pull request #174 from Tecnativa/installation
Add installation instructions
2020-04-13 09:57:39 +01:00
Jairo Llopis
3fec147a10
Add installation instructions
- Without Git, Copier doesn't work.
- With older Git versions, `copier update` fails.
- Recommend using pipx for CLI usage.
2020-04-08 13:46:57 +01:00
Jairo Llopis
7f2bcf6205
Merge pull request #172 from Tecnativa/update-docs
Update docs and add better autoformatting for them
v3.0.5
2020-04-08 12:11:12 +01:00
Jairo Llopis
66ea5ee77a
Refresh copier update docs
Be more specific about what those `*.rej` files are and what to do with them.
2020-04-08 12:08:17 +01:00
Jairo Llopis
63842f5087
Add proseWrap: always to prettier configuration, and re-run pre-commit
This makes YAML and MD files to be automatically wrapped when possible and when it doesn't alter the content meaning. All looks better this way.
2020-04-08 12:01:06 +01:00
Jairo Llopis
485d840fcd
Merge pull request #171 from Tecnativa/fix-updatediff
Update diff fixes
2020-04-08 11:59:12 +01:00
Jairo Llopis
6d7ab7f941
Update diff fixes
- Do not produce contextless diff (`--unified=0`), as it leads to weird results sometimes. `.rej` files provide a saner output. Actually https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---unidiff-zero recommends not using contextless patches.
- Ask `git diff` to *never* join 2 code hunks, even if they are only separated by 1 line (`--inter-hunk-context=-1`). This gives Copier most chances to reduce the amount of rejected hunks.
- When a template is to be reformatted by a pre-commit hook after copy, make sure git hooks are respected, so the updated diff matches reality more closely.
- Add and use a new helper to comfortably build a file tree from a test, to provide a way to avoid having dangling sample trees and git samples.

@Tecnativa TT20357
2020-04-08 11:51:44 +01:00
Jairo Llopis
acb579cdb6
Always have a git user and email in CI 2020-04-08 11:51:44 +01:00
Jairo Llopis
58644e0ee1
Merge pull request #170 from Tecnativa/fix-updatediff
Fix updatediff when using copier update with --data
2020-04-06 13:49:28 +01:00
Jairo Llopis
80105bb86c
Fix base copy answers
When somebody calls `copier update` to reapply a template, respecting subproject evolution, but just to apply some changes to some answers, the updatediff system reverted those changes.

Now they are respected, so if calling `copier update` with new data, that new data will be applied to the subproject.

The basic fix is that when creating the temporary copy in the old commit (the one used to compare), it is created using last answers obtained from the subproject, excluding any new answers passed by the user.

#169 improved the situation but certainly it didn't fix it completely. This hardened test proves it works better now.
2020-04-06 13:46:42 +01:00
Jairo Llopis
c4726b4fe7
Prefix all temp directories
This way it's easier to track where each one is created. Most usefil while debugging tests.
2020-04-06 13:43:13 +01:00
Jairo Llopis
708099d34d
Merge pull request #169 from Tecnativa/fix-updatediff-default-data
Fix updates getting diffed without proper answers
v3.0.4
2020-03-27 12:39:38 +00:00
Jairo Llopis
a00624eaa8
Fix updates getting diffed without proper answers
There was a bug in how update diff was computed. As you can see, the temporary copy that was made to produce that diff didn't get the same answers as the current project. Thus, every time the user answered something different, a diff was generated and a `.rej` file was created.

Just try this and you'll see:

```bash
copier -f update
git add .
git commit -m updated
copier -f update
git status
```

The 2nd time you update, all files should be identical and untouched. However, that wasn't the case.

I took the chance to update this test's fixture from `dst` to `tmpdir`, which is more standard and comfortable to debug.

@Tecnativa TT20357
2020-03-27 12:36:04 +00:00
Ben Felder
fe0ffb3fdc
Merge pull request #167 from Tecnativa/fix-shortcodes
Fix shortcode without .git suffix
v3.0.3
2020-03-25 18:41:37 +01:00
Jairo Llopis
c7eddc1509
Fix shortcode without .git suffix
Fixes https://github.com/Tecnativa/doodba-copier-template/issues/14
2020-03-25 15:59:00 +00:00
Jairo Llopis
7049a62916
Merge pull request #166 from Tecnativa/fix-custom-answers-file-cli
Fix --answers-file
v3.0.2
2020-03-25 10:37:06 +00:00
Jairo Llopis
58210e6ed6
Fix --answers-file
This is a switch attribute, not a flag.

Without this patch, using this feature yields this error:

```
➤ copier -fa .altered-copier-answers.yml update
Traceback (most recent call last):
  File "/home/yajo/.local/bin/copier", line 8, in <module>
    sys.exit(CopierApp.run())
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/plumbum/cli/application.py", line 577, in run
    inst, retcode = subapp.run(argv, exit=False)
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/plumbum/cli/application.py", line 572, in run
    retcode = inst.main(*tailargs)
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/cli.py", line 17, in _wrapper
    return method(*args, **kwargs)
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/cli.py", line 172, in main
    dst_path=destination_path, only_diff=self.only_diff,
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/cli.py", line 111, in _copy
    **kwargs,
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/main.py", line 123, in copy
    conf = make_config(**locals())
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/config/factory.py", line 59, in make_config
    answers_data.update(load_answersfile_data(dst_path, answers_file))
  File "/home/yajo/.local/pipx/venvs/copier/lib64/python3.7/site-packages/copier/config/user_data.py", line 90, in load_answersfile_data
    with open(Path(dst_path) / (answers_file or ".copier-answers.yml")) as fd:
  File "/usr/lib64/python3.7/pathlib.py", line 920, in __truediv__
    return self._make_child((key,))
  File "/usr/lib64/python3.7/pathlib.py", line 699, in _make_child
    drv, root, parts = self._parse_args(args)
  File "/usr/lib64/python3.7/pathlib.py", line 653, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not bool
```

@Tecnativa TT20357
2020-03-25 10:34:58 +00:00
Jairo Llopis
de5a1ec5b9
Merge pull request #165 from Tecnativa/version
Allow CLI to display version with `copier --version`
v3.0.0 v3.0.1
2020-03-18 11:50:24 +00:00
Jairo Llopis
c37b5ed39b
Allow CLI to display version with copier --version
This is a regression from #162 where `__version__` was removed due to conflicts with how black and poetry-dynamic-versioning work.

Now those conflicts are fixed and `copier --version` works again. This was what it was returning before:

```bash
➤ copier --version
copier (version not set)
```

BEWARE: In a development, it will always return `0.0.0`, but this is expected because poetry-dynamic-versioning autopatches this on release.

In `.pre-commit-config.yaml`, `require_serial: true` is added to all local tasks that run under `poetry run`. This is because when entering `poetry run`, poetry-dynamic-versioning does its magic and patches the versions in `pyproject.toml` and `__init__.py`, and unpatches them when ending the execution. If running in parallel (default pre-commit behavior), some patches are reverted and some aren't, producing random failed lints.

@Tecnativa TT20357
2020-03-18 11:39:19 +00:00
Jairo Llopis
58f4fad64b
Merge pull request #164 from Tecnativa/custom-answers-file
Fix default answers_file location
v3.0.0-beta1
2020-03-18 10:45:43 +00:00
Jairo Llopis
55a49c2386
Fix default answers_file location
After #163, a `copier.yml` file without a `_answers_file` definition would default to `None` instead of `".copier-answers.yml"` as expected.

I modified some tests to reproduce this failure, and fixed them.

@Tecnativa TT20357
2020-03-16 14:00:55 +00:00
Jairo Llopis
4a149b5db7
Merge pull request #163 from Tecnativa/custom-answers-file
Allow to choose custom answers file
v3.0.0-alpha8
2020-03-16 12:53:43 +00:00
Jairo Llopis
d44ba2fbfb
Allow to choose custom answers file
With this enhacenment, template designers are able to choose a different default path for the `.copier-answers.yml` file, and users are still able to alter it via their API/CLI calls.

The main purpose for this is to let users use several templates to fill the same destination directory, and still be able to autoupdate all of them by just providing the answers file path to use.

@Tecnativa TT20357
2020-03-16 12:50:02 +00:00
Jairo Llopis
52863518a1
Merge pull request #162 from Tecnativa/dynamic-versioning
Dynamic versioning
v3.0.0-alpha7
2020-03-15 17:36:27 +00:00
Jairo Llopis
a442fb72bc
Implement dynamic versioning
Fix #159.
2020-03-15 17:24:21 +00:00
Jairo Llopis
6486b278c5
Remove isort seed
It is not needed if we consider all unknown dependencies as third party by default. This will save an apparently unneeded diff and many possible git conflicts in the future.
2020-03-15 17:09:26 +00:00
Jairo Llopis
6d98400205
Merge pull request #160 from Tecnativa/conf-available-to-template
Tasks and migrations env utilities
2020-03-13 13:42:57 +00:00