From a836261d02755e5cbdb28dcfd1ff0b89de27a0c3 Mon Sep 17 00:00:00 2001 From: Anish Athalye Date: Tue, 2 Aug 2016 10:15:27 -0700 Subject: [PATCH] Fix variable expansion in extended syntax --- plugins/link.py | 5 ++--- ...nt-variable-expansion-source-extended.bash | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 test/tests/link-environment-variable-expansion-source-extended.bash diff --git a/plugins/link.py b/plugins/link.py index d6bdf98..9e1dce0 100644 --- a/plugins/link.py +++ b/plugins/link.py @@ -19,7 +19,6 @@ class Link(dotbot.Plugin): success = True defaults = self._context.defaults().get('link', {}) for destination, source in links.items(): - source = os.path.expandvars(source) destination = os.path.expandvars(destination) relative = defaults.get('relative', False) force = defaults.get('force', False) @@ -31,9 +30,9 @@ class Link(dotbot.Plugin): force = source.get('force', force) relink = source.get('relink', relink) create = source.get('create', create) - path = source['path'] + path = os.path.expandvars(source['path']) else: - path = source + path = os.path.expandvars(source) if create: success &= self._create(destination) if force or relink: diff --git a/test/tests/link-environment-variable-expansion-source-extended.bash b/test/tests/link-environment-variable-expansion-source-extended.bash new file mode 100644 index 0000000..73f6b0c --- /dev/null +++ b/test/tests/link-environment-variable-expansion-source-extended.bash @@ -0,0 +1,20 @@ +test_description='link expands environment variables in extended config syntax' +. '../test-lib.bash' + +test_expect_success 'setup' ' +echo "grape" > ${DOTFILES}/h +' + +test_expect_success 'run' ' +export APPLE="h" && +run_dotbot <