Fix variable expansion in extended syntax
This commit is contained in:
parent
0618bc70cc
commit
a836261d02
2 changed files with 22 additions and 3 deletions
|
@ -19,7 +19,6 @@ class Link(dotbot.Plugin):
|
||||||
success = True
|
success = True
|
||||||
defaults = self._context.defaults().get('link', {})
|
defaults = self._context.defaults().get('link', {})
|
||||||
for destination, source in links.items():
|
for destination, source in links.items():
|
||||||
source = os.path.expandvars(source)
|
|
||||||
destination = os.path.expandvars(destination)
|
destination = os.path.expandvars(destination)
|
||||||
relative = defaults.get('relative', False)
|
relative = defaults.get('relative', False)
|
||||||
force = defaults.get('force', False)
|
force = defaults.get('force', False)
|
||||||
|
@ -31,9 +30,9 @@ class Link(dotbot.Plugin):
|
||||||
force = source.get('force', force)
|
force = source.get('force', force)
|
||||||
relink = source.get('relink', relink)
|
relink = source.get('relink', relink)
|
||||||
create = source.get('create', create)
|
create = source.get('create', create)
|
||||||
path = source['path']
|
path = os.path.expandvars(source['path'])
|
||||||
else:
|
else:
|
||||||
path = source
|
path = os.path.expandvars(source)
|
||||||
if create:
|
if create:
|
||||||
success &= self._create(destination)
|
success &= self._create(destination)
|
||||||
if force or relink:
|
if force or relink:
|
||||||
|
|
|
@ -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 <<EOF
|
||||||
|
- link:
|
||||||
|
~/.i:
|
||||||
|
path: \$APPLE
|
||||||
|
relink: true
|
||||||
|
EOF
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'test' '
|
||||||
|
grep "grape" ~/.i
|
||||||
|
'
|
Loading…
Reference in a new issue