1
0
Fork 0
mirror of synced 2024-06-29 01:51:10 -04:00

Change template indicator to ##yadm.j2

This commit is contained in:
Tim Byrne 2017-03-31 16:42:51 -05:00
parent 0b1b810722
commit 9824de5410
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12
4 changed files with 11 additions and 11 deletions

View file

@ -86,7 +86,7 @@ function test_alt() {
@test "Command 'alt' (envtpl missing)" { @test "Command 'alt' (envtpl missing)" {
echo " echo "
When the command 'alt' is provided When the command 'alt' is provided
and file matches ##yadm_tmpl and file matches ##yadm.j2
Report jinja template as unprocessed Report jinja template as unprocessed
Exit with 0 Exit with 0
" "
@ -110,7 +110,7 @@ function test_alt() {
@test "Command 'alt' (select jinja)" { @test "Command 'alt' (select jinja)" {
echo " echo "
When the command 'alt' is provided When the command 'alt' is provided
and file matches ##yadm_tmpl and file matches ##yadm.j2
Report jinja template processing Report jinja template processing
Verify that the correct content is written Verify that the correct content is written
Exit with 0 Exit with 0
@ -123,7 +123,7 @@ function test_alt() {
echo " echo "
When a command possibly changes the repo When a command possibly changes the repo
and auto-alt is configured true and auto-alt is configured true
and file matches ##yadm_tmpl and file matches ##yadm.j2
automatically process alternates automatically process alternates
report no linking (not loud) report no linking (not loud)
Verify that the correct content is written Verify that the correct content is written
@ -136,7 +136,7 @@ function test_alt() {
echo " echo "
When a command possibly changes the repo When a command possibly changes the repo
and auto-alt is configured false and auto-alt is configured false
and file matches ##yadm_tmpl and file matches ##yadm.j2
Report no jinja template processing Report no jinja template processing
Verify no content Verify no content
" "
@ -147,7 +147,7 @@ function test_alt() {
@test "Command 'alt' (overwrite existing content)" { @test "Command 'alt' (overwrite existing content)" {
echo " echo "
When the command 'alt' is provided When the command 'alt' is provided
and file matches ##yadm_tmpl and file matches ##yadm.j2
and the real file exists, and is wrong and the real file exists, and is wrong
Report jinja template processing Report jinja template processing
Verify that the correct content is written Verify that the correct content is written
@ -160,7 +160,7 @@ function test_alt() {
@test "Command 'alt' (overwritten settings)" { @test "Command 'alt' (overwritten settings)" {
echo " echo "
When the command 'alt' is provided When the command 'alt' is provided
and file matches ##yadm_tmpl and file matches ##yadm.j2
after setting local.* after setting local.*
Report jinja template processing Report jinja template processing
Verify that the correct content is written Verify that the correct content is written

View file

@ -202,7 +202,7 @@ function create_worktree() {
make_parents "$DIR_WORKTREE/$f" make_parents "$DIR_WORKTREE/$f"
echo "$f" > "$DIR_WORKTREE/$f" echo "$f" > "$DIR_WORKTREE/$f"
done done
echo "{{ YADM_CLASS }}-{{ YADM_OS }}-{{ YADM_HOSTNAME }}-{{ YADM_USER }}" > "$DIR_WORKTREE/alt-jinja##yadm_tmpl" echo "{{ YADM_CLASS }}-{{ YADM_OS }}-{{ YADM_HOSTNAME }}-{{ YADM_USER }}" > "$DIR_WORKTREE/alt-jinja##yadm.j2"
fi fi

4
yadm
View file

@ -197,9 +197,9 @@ function alt() {
done done
#; loop over all "tracked" files #; loop over all "tracked" files
#; for every file which is a *##yadm_tmpl create a real file #; for every file which is a *##yadm.j2 create a real file
local IFS=$'\n' local IFS=$'\n'
local match="^(.+)##yadm_tmpl$" local match="^(.+)##yadm\\.j2$"
for tracked_file in $("$GIT_PROGRAM" ls-files | sort) $(cat "$YADM_ENCRYPT" 2>/dev/null); do for tracked_file in $("$GIT_PROGRAM" ls-files | sort) $(cat "$YADM_ENCRYPT" 2>/dev/null); do
tracked_file="$YADM_WORK/$tracked_file" tracked_file="$YADM_WORK/$tracked_file"
if [ -e "$tracked_file" ] ; then if [ -e "$tracked_file" ] ; then

4
yadm.1
View file

@ -502,7 +502,7 @@ templates will also be processed to create or overwrite real files.
.B yadm .B yadm
will treat files ending in will treat files ending in
##yadm_tmpl ##yadm.j2
as Jinja templates. During processing, the following variables are set as Jinja templates. During processing, the following variables are set
according to the rules explained in the ALTERNATES section: according to the rules explained in the ALTERNATES section:
@ -513,7 +513,7 @@ according to the rules explained in the ALTERNATES section:
YADM_USER YADM_USER
For example, a file named For example, a file named
.I whatever##yadm_tmpl .I whatever##yadm.j2
with the following content with the following content
{% if YADM_USER == 'harvey' -%} {% if YADM_USER == 'harvey' -%}