Skip to content

Commit 3a2ff9a

Browse files
committed
docs: Add brief textual description of install/update mechanics
1 parent 935edf5 commit 3a2ff9a

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/how-it-works.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,39 @@ Review [Copier's basic
99
concepts](https://copier.readthedocs.io/en/stable/#basic-concepts) and [how
1010
updates
1111
work](https://copier.readthedocs.io/en/stable/updating/#how-the-update-works).
12+
13+
But in brief, when you install a template `template-foo` for app `bar` a few
14+
things happen:
15+
16+
1. The repository for `template-foo` is cloned to a local temporary directory.
17+
- Note, the latest tagged version in the repository is checked out by
18+
default. Overridable with the `--version` arg.
19+
1. The `copier.yml` file is read from the local `template-foo` clone, which
20+
provides the configuration and parameters of the template (e.g., what
21+
questions to ask the user).
22+
1. If there are template parameters that need answered (and they have not been
23+
provided explicitly via `--data` args), the user is prompted for them.
24+
1. A `.template-foo` directory is created at the top-level of the project with a
25+
`bar.yml` inside it, containing the version of the template used and the
26+
answers to the parameters for the `bar` instance of the template.
27+
1. The files in the local clone of `template-foo` are iterated over and copied
28+
to the project, with templates being populated with the provided answers.
29+
30+
On update:
31+
32+
1. The repository for `template-foo` is cloned to a local temporary directory.
33+
1. The version of `template-foo` currently used by the project is used to create
34+
a create a fresh instance of the template with the current project
35+
parameters, effectively a clean copy of the existing project as if it had
36+
just been created from the template.
37+
1. This clean copy of the project is then compared to the actual current
38+
project, and the diff recorded. Effectively capturing any changes that have
39+
be made to the project outside of the template process itself, to re-apply
40+
later.
41+
1. The latest tagged version (or value specified by `--version`) of
42+
`template-foo` is then applied to the project, prompting for any new
43+
parameters that need answers. Similar to the install process, though with
44+
some special logic around deleted files, etc.
45+
1. `.template-foo/bar.yml` file at the top-level of the project is updated for
46+
the answers to any new parameters and the updated template version.
47+
1. The diff of manual changes from before is applied.

0 commit comments

Comments
 (0)