mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-03-23 14:10:06 +00:00
deprecated trans_r/w for install/update
This commit is contained in:
12
docs/config/config-dotfiles.md
vendored
12
docs/config/config-dotfiles.md
vendored
@@ -14,11 +14,13 @@ Entry | Description
|
||||
`ignoreempty` | If true, an empty template will not be deployed (defaults to the value of `ignoreempty`)
|
||||
`instignore` | List of patterns to ignore when installing (enclose in quotes when using wildcards; see [ignore patterns](config-file.md#ignore-patterns))
|
||||
`template` | If false, disable templating for this dotfile (defaults to the value of `template_dotfile_default`)
|
||||
`trans_read` | Transformation key to apply when installing this dotfile (must be defined in the **trans_read** entry below; see [transformations](config-transformations.md))
|
||||
`trans_write` | Transformation key to apply when updating this dotfile (must be defined in the **trans_write** entry below; see [transformations](config-transformations.md))
|
||||
`trans_install` | Transformation key to apply when installing this dotfile (must be defined in the **trans_install** entry below; see [transformations](config-transformations.md))
|
||||
`trans_update` | Transformation key to apply when updating this dotfile (must be defined in the **trans_update** entry below; see [transformations](config-transformations.md))
|
||||
`upignore` | List of patterns to ignore when updating (enclose in quotes when using wildcards; see [ignore patterns](config-file.md#ignore-patterns))
|
||||
<s>link_children</s> | Replaced by `link: link_children`
|
||||
<s>trans</s> | Replaced by `trans_read`
|
||||
<s>trans</s> | Replaced by `trans_install`
|
||||
<s>trans_read</s> | Replaced by `trans_install`
|
||||
<s>trans_write</s> | Replaced by `trans_update`
|
||||
|
||||
```yaml
|
||||
<dotfile-key-name>:
|
||||
@@ -37,8 +39,8 @@ Entry | Description
|
||||
- <action-key>
|
||||
template: (true|false)
|
||||
chmod: '<file-permissions>'
|
||||
trans_read: <transformation-key>
|
||||
trans_write: <transformation-key>
|
||||
trans_install: <transformation-key>
|
||||
trans_update: <transformation-key>
|
||||
```
|
||||
|
||||
## Dotfile actions
|
||||
|
||||
32
docs/config/config-transformations.md
vendored
32
docs/config/config-transformations.md
vendored
@@ -14,14 +14,14 @@ For examples of transformation uses, see:
|
||||
|
||||
There are two types of transformations available:
|
||||
|
||||
* **Read transformations**: used to transform dotfiles before they are installed ([config](config-config.md) key `trans_read`)
|
||||
* **Install transformations**: used to transform dotfiles before they are installed ([config](config-config.md) key `trans_install`)
|
||||
* Used for commands `install` and `compare`
|
||||
* They have two mandatory arguments:
|
||||
* **{0}** will be replaced with the dotfile to process
|
||||
* **{1}** will be replaced with a temporary file to store the result of the transformation
|
||||
* This Happens **before** the dotfile is templated (see [templating](../template/templating.md))
|
||||
|
||||
* **Write transformations**: used to transform files before updating a dotfile ([config](config-config.md) key `trans_write`)
|
||||
* **Update/Import transformations**: used to transform files before updating/importing a dotfile ([config](config-config.md) key `trans_update`)
|
||||
* Used for command `update` and `import`
|
||||
* They have two mandatory arguments:
|
||||
* **{0}** will be replaced with the file path to update the dotfile with
|
||||
@@ -36,13 +36,13 @@ Transformations also support additional positional arguments that must start fro
|
||||
|
||||
For example:
|
||||
```yaml
|
||||
trans_read:
|
||||
trans_install:
|
||||
targ: echo "$(basename {0}); {{@@ _dotfile_key @@}}; {2}; {3}" > {1}
|
||||
dotfiles:
|
||||
f_abc:
|
||||
dst: /tmp/abc
|
||||
src: abc
|
||||
trans_read: targ "{{@@ profile @@}}" lastarg
|
||||
trans_install: targ "{{@@ profile @@}}" lastarg
|
||||
profiles:
|
||||
p1:
|
||||
dotfiles:
|
||||
@@ -51,21 +51,21 @@ profiles:
|
||||
|
||||
will result in `abc; f_abc; p1; lastarg`.
|
||||
|
||||
## trans_read entry
|
||||
## trans_install entry
|
||||
|
||||
The **trans_read** entry (optional) contains a transformations mapping (See [transformations](config-transformations.md)).
|
||||
The **trans_install** entry (optional) contains a transformations mapping (See [transformations](config-transformations.md)).
|
||||
|
||||
```yaml
|
||||
trans_read:
|
||||
trans_install:
|
||||
<trans-key>: <command-to-execute>
|
||||
```
|
||||
|
||||
## trans_write entry
|
||||
## trans_update entry
|
||||
|
||||
The **trans_write** entry (optional) contains a write transformations mapping (See [transformations](config-transformations.md)).
|
||||
The **trans_update** entry (optional) contains a write transformations mapping (See [transformations](config-transformations.md)).
|
||||
|
||||
```yaml
|
||||
trans_write:
|
||||
trans_update:
|
||||
<trans-key>: <command-to-execute>
|
||||
```
|
||||
|
||||
@@ -77,10 +77,10 @@ and [template variables](../template/template-variables.md#template-variables)).
|
||||
|
||||
A very dumb example:
|
||||
```yaml
|
||||
trans_read:
|
||||
trans_install:
|
||||
r_echo_abs_src: echo "{0}: {{@@ _dotfile_abs_src @@}}" > {1}
|
||||
r_echo_var: echo "{0}: {{@@ r_var @@}}" > {1}
|
||||
trans_write:
|
||||
trans_update:
|
||||
w_echo_key: echo "{0}: {{@@ _dotfile_key @@}}" > {1}
|
||||
w_echo_var: echo "{0}: {{@@ w_var @@}}" > {1}
|
||||
variables:
|
||||
@@ -90,11 +90,11 @@ dotfiles:
|
||||
f_abc:
|
||||
dst: ${tmpd}/abc
|
||||
src: abc
|
||||
trans_read: r_echo_abs_src
|
||||
trans_write: w_echo_key
|
||||
trans_install: r_echo_abs_src
|
||||
trans_update: w_echo_key
|
||||
f_def:
|
||||
dst: ${tmpd}/def
|
||||
src: def
|
||||
trans_read: r_echo_var
|
||||
trans_write: w_echo_var
|
||||
trans_install: r_echo_var
|
||||
trans_update: w_echo_var
|
||||
```
|
||||
|
||||
24
docs/howto/sensitive-dotfiles.md
vendored
24
docs/howto/sensitive-dotfiles.md
vendored
@@ -37,9 +37,9 @@ First you need to define the encryption/decryption methods, for example
|
||||
```yaml
|
||||
variables:
|
||||
keyid: "11223344"
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "gpg -q --for-your-eyes-only--no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "gpg -q -r {{@@ keyid @@}} --armor --no-tty -o {1} -e {0}"
|
||||
```
|
||||
|
||||
@@ -60,17 +60,17 @@ Using GPG keys:
|
||||
```yaml
|
||||
variables:
|
||||
keyid: "11223344"
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "gpg -q --for-your-eyes-only--no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "gpg -q -r {{@@ keyid @@}} --armor --no-tty -o {1} -e {0}"
|
||||
```
|
||||
|
||||
Passphrase is stored in an environment variable:
|
||||
```yaml
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "echo {{@@ env['THE_KEY'] @@}} | gpg -q --batch --yes --for-your-eyes-only --passphrase-fd 0 --no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "echo {{@@ env['THE_KEY'] @@}} | gpg -q --batch --yes --passphrase-fd 0 --no-tty -o {1} -c {0}"
|
||||
```
|
||||
|
||||
@@ -78,9 +78,9 @@ Passphrase is stored as a variable:
|
||||
```yaml
|
||||
variables:
|
||||
gpg_password: "some password"
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --for-your-eyes-only --passphrase-fd 0 --no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --passphrase-fd 0 --no-tty -o {1} -c {0}"
|
||||
```
|
||||
|
||||
@@ -88,9 +88,9 @@ Passphrase is retrieved using a script:
|
||||
```yaml
|
||||
dynvariables:
|
||||
gpg_password: "./get-password.sh"
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --for-your-eyes-only --passphrase-fd 0 --no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --passphrase-fd 0 --no-tty -o {1} -c {0}"
|
||||
```
|
||||
|
||||
@@ -100,9 +100,9 @@ variables:
|
||||
gpg_password_file: "/tmp/the-password"
|
||||
dynvariables:
|
||||
gpg_password: "cat {{@@ gpg_password_file @@}}"
|
||||
trans_read:
|
||||
trans_install:
|
||||
_decrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --for-your-eyes-only --passphrase-fd 0 --no-tty -d {0} > {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
_encrypt: "echo {{@@ gpg_password @@}} | gpg -q --batch --yes --passphrase-fd 0 --no-tty -o {1} -c {0}"
|
||||
```
|
||||
|
||||
|
||||
6
docs/howto/store-compressed-directories.md
vendored
6
docs/howto/store-compressed-directories.md
vendored
@@ -1,13 +1,13 @@
|
||||
# Handle compressed directories
|
||||
|
||||
This is an example of how to use transformations (`trans_read` and `trans_write`) to store
|
||||
This is an example of how to use transformations (`trans_install` and `trans_update`) to store
|
||||
compressed directories and deploy them with dotdrop.
|
||||
|
||||
Start by defining the transformations:
|
||||
```yaml
|
||||
trans_read:
|
||||
trans_install:
|
||||
uncompress: "mkdir -p {1} && tar -xf {0} -C {1}"
|
||||
trans_write:
|
||||
trans_update:
|
||||
compress: "tar -cf {1} -C {0} ."
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user