-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow create_ entries to be templates
- Loading branch information
Showing
3 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# test that chezmoi apply creates a file from a template | ||
mkdir $CHEZMOISOURCEDIR | ||
cp golden/create_dot_create.tmpl $CHEZMOISOURCEDIR | ||
chezmoi apply --force | ||
cmp $HOME/.create golden/.create | ||
|
||
[windows] skip 'UNIX only' | ||
[!exec:age] skip 'age not found in $PATH' | ||
|
||
chhome home2/user | ||
|
||
# test that chezmoi apply creates encrypted create_ targets | ||
mkageconfig | ||
mkdir $CHEZMOISOURCEDIR | ||
chezmoi encrypt --output=$CHEZMOISOURCEDIR/create_encrypted_dot_create.age golden/.create | ||
grep '-----BEGIN AGE ENCRYPTED FILE-----' $CHEZMOISOURCEDIR/create_encrypted_dot_create.age | ||
chezmoi apply --force | ||
cmp $HOME/.create golden/.create | ||
|
||
chhome home3/user | ||
|
||
# test that chezmoi apply creates encrypted template create_ targets | ||
mkageconfig | ||
mkdir $CHEZMOISOURCEDIR | ||
chezmoi encrypt --output=$CHEZMOISOURCEDIR/create_encrypted_dot_create.tmpl.age golden/create_dot_create.tmpl | ||
grep '-----BEGIN AGE ENCRYPTED FILE-----' $CHEZMOISOURCEDIR/create_encrypted_dot_create.tmpl.age | ||
chezmoi apply --force | ||
cmp $HOME/.create golden/.create | ||
|
||
chhome home4/user | ||
|
||
# test that chezmoi manage does not execute template create_ targets | ||
chezmoi managed | ||
cmp stdout golden/managed | ||
|
||
-- golden/.create -- | ||
# contents of .create | ||
-- golden/create_dot_create.tmpl -- | ||
{{ "# contents of .create" }} | ||
-- golden/managed -- | ||
.create | ||
-- home4/user/.local/share/chezmoi/create_dot_create.tmpl -- | ||
{{ fail "Template should not be executed }} |
This file was deleted.
Oops, something went wrong.