forked from anishathalye/dotbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functionality to create relative links
This commit adds an option to the extended configuration syntax for linking files and directories. Enabling the relative option makes it so that symbolic links are created with relative paths instead of absolute paths.
- Loading branch information
1 parent
c402396
commit daf8d82
Showing
3 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
test_description='relative linking works' | ||
. '../test-lib.bash' | ||
|
||
test_expect_success 'setup' ' | ||
echo "apple" > ${DOTFILES}/f && | ||
mkdir ${DOTFILES}/d && | ||
echo "grape" > ${DOTFILES}/d/e | ||
' | ||
|
||
test_expect_success 'run' ' | ||
run_dotbot <<EOF | ||
- link: | ||
~/.f: | ||
path: f | ||
~/.frel: | ||
path: f | ||
relative: true | ||
~/nested/.frel: | ||
path: f | ||
create: true | ||
relative: true | ||
~/.d: | ||
path: d | ||
relative: true | ||
EOF | ||
' | ||
|
||
test_expect_success 'test' ' | ||
grep "apple" ~/.f && | ||
grep "apple" ~/.frel && | ||
[[ "$(readlink ~/.f)" == "$(readlink -f dotfiles/f)" ]] && | ||
[[ "$(readlink ~/.frel)" == "dotfiles/f" ]] && | ||
[[ "$(readlink ~/nested/.frel)" == "../dotfiles/f" ]] && | ||
grep "grape" ~/.d/e && | ||
[[ "$(readlink ~/.d)" == "dotfiles/d" ]] | ||
' |