summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS.md.in4
-rw-r--r--share/rcm.sh.in2
-rw-r--r--test/rcrc-tilde.t8
3 files changed, 13 insertions, 1 deletions
diff --git a/NEWS.md.in b/NEWS.md.in
index d022a42..a288d5e 100644
--- a/NEWS.md.in
+++ b/NEWS.md.in
@@ -1,6 +1,8 @@
rcm (@PACKAGE_VERSION@) unstable; urgency=low
- -- Mike Burns <mburns@thoughtbot.com> Fri, 06 Jul 2018 11:00:00 -0500
+ * Feature: Expand ~ in DOTFILES_DIR hooks (Eric Collins).
+
+ -- Mike Burns <mburns@thoughtbot.com> Fri, 13 Jul 2018 14:12:00 -0500
rcm (1.3.2) unstable; urgency=low
diff --git a/share/rcm.sh.in b/share/rcm.sh.in
index a1c9f40..a2b4492 100644
--- a/share/rcm.sh.in
+++ b/share/rcm.sh.in
@@ -121,6 +121,8 @@ run_hooks() {
if [ $RUN_HOOKS -eq 1 ]; then
for dotfiles_dir in $DOTFILES_DIRS; do
+ dotfiles_dir=$(eval echo "$dotfiles_dir")
+
hook_file="$dotfiles_dir/hooks/$when-$direction"
if [ -e "$hook_file" ]; then
diff --git a/test/rcrc-tilde.t b/test/rcrc-tilde.t
index b3f98c1..55ab37e 100644
--- a/test/rcrc-tilde.t
+++ b/test/rcrc-tilde.t
@@ -8,3 +8,11 @@ rcrc should accept a DOTFILES_DIR with a ~ instead of $HOME
$ echo 'DOTFILES_DIRS="~/.other-dotfiles"' > alt-rcrc
$ RCRC=./alt-rcrc lsrc
/*/.o-example:/*/.other-dotfiles/o-example (glob)
+
+rcrc should run hooks with ~ instead of $HOME
+
+ $ mkdir ~/.other-dotfiles/hooks -p
+ > printf "#!/bin/sh\necho 'ran'\n" > ~/.other-dotfiles/hooks/post-up
+ > chmod +x ~/.other-dotfiles/hooks/post-up
+ > RCRC=./alt-rcrc rcup
+ ran