Skip to content

Commit

Permalink
Change template indicator to ##yadm.j2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLocehiliosan committed Mar 31, 2017
1 parent 0b1b810 commit 9824de5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions test/113_accept_jinja_alt.bats
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function test_alt() {
@test "Command 'alt' (envtpl missing)" {
echo "
When the command 'alt' is provided
and file matches ##yadm_tmpl
and file matches ##yadm.j2
Report jinja template as unprocessed
Exit with 0
"
Expand All @@ -110,7 +110,7 @@ function test_alt() {
@test "Command 'alt' (select jinja)" {
echo "
When the command 'alt' is provided
and file matches ##yadm_tmpl
and file matches ##yadm.j2
Report jinja template processing
Verify that the correct content is written
Exit with 0
Expand All @@ -123,7 +123,7 @@ function test_alt() {
echo "
When a command possibly changes the repo
and auto-alt is configured true
and file matches ##yadm_tmpl
and file matches ##yadm.j2
automatically process alternates
report no linking (not loud)
Verify that the correct content is written
Expand All @@ -136,7 +136,7 @@ function test_alt() {
echo "
When a command possibly changes the repo
and auto-alt is configured false
and file matches ##yadm_tmpl
and file matches ##yadm.j2
Report no jinja template processing
Verify no content
"
Expand All @@ -147,7 +147,7 @@ function test_alt() {
@test "Command 'alt' (overwrite existing content)" {
echo "
When the command 'alt' is provided
and file matches ##yadm_tmpl
and file matches ##yadm.j2
and the real file exists, and is wrong
Report jinja template processing
Verify that the correct content is written
Expand All @@ -160,7 +160,7 @@ function test_alt() {
@test "Command 'alt' (overwritten settings)" {
echo "
When the command 'alt' is provided
and file matches ##yadm_tmpl
and file matches ##yadm.j2
after setting local.*
Report jinja template processing
Verify that the correct content is written
Expand Down
2 changes: 1 addition & 1 deletion test/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function create_worktree() {
make_parents "$DIR_WORKTREE/$f"
echo "$f" > "$DIR_WORKTREE/$f"
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


Expand Down
4 changes: 2 additions & 2 deletions yadm
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ function alt() {
done

#; 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 match="^(.+)##yadm_tmpl$"
local match="^(.+)##yadm\\.j2$"
for tracked_file in $("$GIT_PROGRAM" ls-files | sort) $(cat "$YADM_ENCRYPT" 2>/dev/null); do
tracked_file="$YADM_WORK/$tracked_file"
if [ -e "$tracked_file" ] ; then
Expand Down
4 changes: 2 additions & 2 deletions yadm.1
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ templates will also be processed to create or overwrite real files.
.B yadm
will treat files ending in

##yadm_tmpl
##yadm.j2

as Jinja templates. During processing, the following variables are set
according to the rules explained in the ALTERNATES section:
Expand All @@ -513,7 +513,7 @@ according to the rules explained in the ALTERNATES section:
YADM_USER

For example, a file named
.I whatever##yadm_tmpl
.I whatever##yadm.j2
with the following content

{% if YADM_USER == 'harvey' -%}
Expand Down

0 comments on commit 9824de5

Please sign in to comment.