mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 20:54:51 +00:00
refactoring
This commit is contained in:
@@ -126,7 +126,8 @@ class Cfg:
|
||||
def eval_dotfiles(self, profile, variables, debug=False):
|
||||
"""resolve dotfiles src/dst/actions templating for this profile"""
|
||||
t = Templategen(variables=variables)
|
||||
for d in self.get_dotfiles(profile):
|
||||
dotfiles = self._get_dotfiles(profile)
|
||||
for d in dotfiles:
|
||||
# src and dst path
|
||||
d.src = t.generate_string(d.src)
|
||||
d.dst = t.generate_string(d.dst)
|
||||
@@ -138,7 +139,7 @@ class Cfg:
|
||||
if self.key_actions_post in d.actions:
|
||||
for action in d.actions[self.key_actions_post]:
|
||||
action.action = t.generate_string(action.action)
|
||||
return self.get_dotfiles(profile)
|
||||
return dotfiles
|
||||
|
||||
def _load_file(self):
|
||||
"""load the yaml file"""
|
||||
@@ -611,7 +612,7 @@ class Cfg:
|
||||
|
||||
return True, dotfile
|
||||
|
||||
def get_dotfiles(self, profile):
|
||||
def _get_dotfiles(self, profile):
|
||||
"""return a list of dotfiles for a specific profile"""
|
||||
if profile not in self.prodots:
|
||||
return []
|
||||
|
||||
@@ -94,10 +94,10 @@ class TestConfig(unittest.TestCase):
|
||||
self.assertTrue(pf2key in profiles)
|
||||
|
||||
# test dotfiles
|
||||
dotfiles = conf.get_dotfiles(pf1key)
|
||||
dotfiles = conf._get_dotfiles(pf1key)
|
||||
self.assertTrue(df1key in [x.key for x in dotfiles])
|
||||
self.assertTrue(df2key in [x.key for x in dotfiles])
|
||||
dotfiles = conf.get_dotfiles(pf2key)
|
||||
dotfiles = conf._get_dotfiles(pf2key)
|
||||
self.assertTrue(df1key in [x.key for x in dotfiles])
|
||||
self.assertFalse(df2key in [x.key for x in dotfiles])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user