1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 20:19:46 +00:00

Support templating

This commit is contained in:
Marcel Robitaille
2019-01-20 13:34:56 -04:00
parent e119b8829e
commit 08addde1d9

View File

@@ -120,9 +120,27 @@ class Installer:
results = []
for i in range(len(children)):
result = self._link(srcs[i], dsts[i], actions)
src = srcs[i]
dst = dsts[i]
if Templategen.is_template(src):
if self.debug:
self.log.dbg('dotfile is a template')
self.log.dbg('install to {} and symlink'
.format(self.workdir))
tmp = self._pivot_path(dst, self.workdir, striphome=True)
i = self.install(templater, src, tmp, actions=actions)
if not i and not os.path.exists(tmp):
continue
src = tmp
result = self._link(src, dst, actions)
# Empty actions if dotfile installed
# This prevents from running actions multiple times
if len(result):
actions = []
results.append(result)
return utils.flatten(results)