diff options
-rw-r--r-- | .mailmap | 1 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS.md.in | 11 | ||||
-rw-r--r-- | man/rcdn.1 | 10 | ||||
-rw-r--r-- | man/rcup.1 | 9 | ||||
-rw-r--r-- | share/rcm.sh.in | 6 | ||||
-rw-r--r-- | test/rcdn-hooks-run-in-order.t | 37 | ||||
-rw-r--r-- | test/rcup-hooks-run-in-order.t | 37 |
8 files changed, 110 insertions, 5 deletions
@@ -6,3 +6,4 @@ Mike Burns <mburns@thoughtbot.com> <mike@mike-burns.com> Pablo Olmos de Aguilera Corradini <pablo@glatelier.org> Patrick Brisbin <pat@thoughtbot.com> <pbrisbin@gmail.com> Martin Frost <frost@ceri.se> <martin@frost.ws> +David Alexander <davidpaulalexander@gmail.com> <opensource@thelonelyghost.com> diff --git a/Makefile.am b/Makefile.am index ed8ea2a..fd760ad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,8 +39,10 @@ TESTS = \ test/rcup-usage.t \ test/rcdn-hooks.t \ test/rcdn-hooks-run-in-situ.t \ + test/rcdn-hooks-run-in-order.t \ test/rcup-hooks.t \ - test/rcup-hooks-run-in-situ.t + test/rcup-hooks-run-in-situ.t \ + test/rcup-hooks-run-in-order.t dist_check_SCRIPTS = $(TESTS) dist_check_DATA = test/helper.sh @@ -1,5 +1,16 @@ rcm (@PACKAGE_VERSION@) unstable; urgency=low + * BUGFIX: Use $LOGNAME instead of $USER for compatibility (Mike Burns). + * BUGFIX: rcdn(1) stops at DEST_DIR (Kyle Cook, Mike Burns). + * BUGFIX: Symlink existing files, even when identical (Graham Bennett). + * BUGFIX: Sort hooks by filename before execution instead of arbitrary order + (David Alexander). + * Documentation improvements (Nick Novitski, Ben Stephens, Casey Rodarmor). + + -- Mike Burns <mburns@thoughtbot.com> Sat, 12 Nov 2016 16:16:00 -0500 + +rcm (1.3.0) unstable; urgency=low + * BUGFIX: Control whether hooks should run in rcdn(1) with the -K and -k flags (Ben Turrubiates, Christopher Koch, Mike Burns, Mikkel Fahnøe Jørgensen). @@ -47,7 +47,15 @@ and These hooks are run each time .Nm is run and therefore must be idempotent. -. +.Pp +Hooks will be executed one at a time, sorted alphabetically. For instance, +.Pa hooks/pre-down/animals +will run before +.Pa hooks/pre-down/aquariums , +and +.Pa hooks/pre-down/4-eyes +will run before +.Pa hooks/post-down/2-u-nothing-compares . .Bl -tag -width "-I EXCL_PAT" .It Fl B Ar HOSTNAME treat @@ -183,6 +183,15 @@ and These files must be executable. They are run every time .Nm is run, and therefore must be idempotent. +.Pp +Hooks will be executed one at a time, sorted alphabetically. For instance, +.Pa hooks/pre-up/animals +will run before +.Pa hooks/pre-up/aquariums , +and +.Pa hooks/pre-up/4-eyes +will run before +.Pa hooks/post-up/2-u-nothing-compares . .Sh ALGORITHM It is instructive to understand the process .Nm rcup diff --git a/share/rcm.sh.in b/share/rcm.sh.in index ed5d6f9..f0d3364 100644 --- a/share/rcm.sh.in +++ b/share/rcm.sh.in @@ -131,9 +131,9 @@ run_hooks() { # running these hooks imply some level of trust; surely one doesn't clone somebody # else's dotfiles repository without reviewing the hooks before doing an `rcup`? find "$hook_file" -type f \( \( -user $LOGNAME -perm -100 \) -o -perm -001 \) \ - -exec \ - sh -c 'cd "`dirname $1`" && ./"`basename $1`"' arg0 '{}' \ - \; + | sort | while read file; do + sh -c 'cd "`dirname $1`" && ./"`basename $1`"' arg0 "$file" + done else $DEBUG "no $when-$direction hook present for $dotfiles_dir, skipping" fi diff --git a/test/rcdn-hooks-run-in-order.t b/test/rcdn-hooks-run-in-order.t new file mode 100644 index 0000000..8dff253 --- /dev/null +++ b/test/rcdn-hooks-run-in-order.t @@ -0,0 +1,37 @@ + $ . "$TESTDIR/helper.sh" + +Pre-down and post-down hooks should run in order according to their name + + $ mkdir -p .dotfiles/hooks/pre-down .dotfiles/hooks/post-down + > printf "#!/bin/sh\necho '1'\n" > .dotfiles/hooks/pre-down/00-test.sh + > printf "#!/bin/sh\necho '2'\n" > .dotfiles/hooks/pre-down/01-test.sh + > printf "#!/bin/sh\necho '3'\n" > .dotfiles/hooks/pre-down/02-test.sh + > printf "#!/bin/sh\necho '4'\n" > .dotfiles/hooks/post-down/00-test.sh + > printf "#!/bin/sh\necho '5'\n" > .dotfiles/hooks/post-down/01-test.sh + > printf "#!/bin/sh\necho '6'\n" > .dotfiles/hooks/post-down/02-test.sh + + $ chmod +x .dotfiles/hooks/pre-down/00-test.sh + > chmod +x .dotfiles/hooks/pre-down/01-test.sh + > chmod +x .dotfiles/hooks/pre-down/02-test.sh + > chmod +x .dotfiles/hooks/post-down/00-test.sh + > chmod +x .dotfiles/hooks/post-down/01-test.sh + > chmod +x .dotfiles/hooks/post-down/02-test.sh + + $ rcdn + 1 + 2 + 3 + 4 + 5 + 6 + + +Ensure that hooks run when output of lsrc is non-empty + $ touch .dotfiles/testrc + > rcdn + 1 + 2 + 3 + 4 + 5 + 6 diff --git a/test/rcup-hooks-run-in-order.t b/test/rcup-hooks-run-in-order.t new file mode 100644 index 0000000..cc5b402 --- /dev/null +++ b/test/rcup-hooks-run-in-order.t @@ -0,0 +1,37 @@ + $ . "$TESTDIR/helper.sh" + +Pre-up hooks should run in order according to their name + + $ mkdir -p .dotfiles/hooks/pre-up .dotfiles/hooks/post-up + > printf "#!/bin/sh\necho '1'\n" > .dotfiles/hooks/pre-up/00-test.sh + > printf "#!/bin/sh\necho '2'\n" > .dotfiles/hooks/pre-up/01-test.sh + > printf "#!/bin/sh\necho '3'\n" > .dotfiles/hooks/pre-up/02-test.sh + > printf "#!/bin/sh\necho '4'\n" > .dotfiles/hooks/post-up/00-test.sh + > printf "#!/bin/sh\necho '5'\n" > .dotfiles/hooks/post-up/01-test.sh + > printf "#!/bin/sh\necho '6'\n" > .dotfiles/hooks/post-up/02-test.sh + + $ chmod +x .dotfiles/hooks/pre-up/00-test.sh + > chmod +x .dotfiles/hooks/pre-up/01-test.sh + > chmod +x .dotfiles/hooks/pre-up/02-test.sh + > chmod +x .dotfiles/hooks/post-up/00-test.sh + > chmod +x .dotfiles/hooks/post-up/01-test.sh + > chmod +x .dotfiles/hooks/post-up/02-test.sh + + $ rcup + 1 + 2 + 3 + 4 + 5 + 6 + + +Ensure that hooks run when output of lsrc is non-empty + $ touch .dotfiles/testrc + > rcup + 1 + 2 + 3 + 4 + 5 + 6 |