diff options
-rwxr-xr-x | bin/rcdn.in | 3 | ||||
-rwxr-xr-x | bin/rcup.in | 1 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/rcdn-hooks.t | 19 | ||||
-rw-r--r-- | test/rcup-hooks.t | 18 |
5 files changed, 44 insertions, 2 deletions
diff --git a/bin/rcdn.in b/bin/rcdn.in index 90cfcd6..ae7aad8 100755 --- a/bin/rcdn.in +++ b/bin/rcdn.in @@ -31,7 +31,7 @@ handle_command_line() { local arg_tags= local verbosity=0 local version=0 - local run_hooks=0 + local run_hooks=1 local dotfiles_dirs= local files= local excludes= @@ -124,4 +124,5 @@ for dest_and_src in $dests_and_srcs; do remove_link "$dest" "$dest" "$sigil" done +IFS="$saved_ifs" run_hooks post down diff --git a/bin/rcup.in b/bin/rcup.in index e5c5cdb..f818258 100755 --- a/bin/rcup.in +++ b/bin/rcup.in @@ -302,4 +302,5 @@ for dest_and_src in $dests_and_srcs; do handle_file "$GENERATE" "$src" "$dest" "$sigil" done +IFS="$saved_ifs" run_hooks post up diff --git a/test/Makefile.am b/test/Makefile.am index 3aec9d7..065b2d1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -24,7 +24,10 @@ TESTS = \ rcup-hostname.t \ rcup-standalone.t \ rcup-symlink-dirs.t \ - rcup-usage.t + rcup-usage.t \ + rcdn-hooks.t \ + rcup-hooks.t + dist_check_SCRIPTS = $(TESTS) dist_check_DATA = helper.sh diff --git a/test/rcdn-hooks.t b/test/rcdn-hooks.t new file mode 100644 index 0000000..1edde40 --- /dev/null +++ b/test/rcdn-hooks.t @@ -0,0 +1,19 @@ + $ . "$TESTDIR/helper.sh" + +Pre-down and post-down hooks should run by default + + $ mkdir -p .dotfiles/hooks + > touch .dotfiles/hooks/pre-down .dotfiles/hooks/post-down + > chmod +x .dotfiles/hooks/pre-down .dotfiles/hooks/post-down + + $ echo 'echo "example" > /tmp/test' > .dotfiles/hooks/pre-down + > echo 'cat /tmp/test; rm /tmp/test' > .dotfiles/hooks/post-down + + $ rcdn + example + +Ensure that hooks run when output of lsrc is non-empty + $ touch .dotfiles/testrc + > rcup + > rcdn + example diff --git a/test/rcup-hooks.t b/test/rcup-hooks.t new file mode 100644 index 0000000..8890f7b --- /dev/null +++ b/test/rcup-hooks.t @@ -0,0 +1,18 @@ + $ . "$TESTDIR/helper.sh" + +Pre-up and post-up hooks should run by default + + $ mkdir -p .dotfiles/hooks + > touch .dotfiles/hooks/pre-up .dotfiles/hooks/post-up + > chmod +x .dotfiles/hooks/pre-up .dotfiles/hooks/post-up + + $ echo 'echo "example" > /tmp/test' > .dotfiles/hooks/pre-up + > echo 'cat /tmp/test; rm /tmp/test' > .dotfiles/hooks/post-up + + $ rcup + example + +Ensure that hooks run when output of lsrc is non-empty + $ touch .dotfiles/testrc + > rcup + example |