[IMP] add support for directory templates in scaffold

closes #4767
This commit is contained in:
Stéphane Bidoul 2015-01-18 17:43:26 +01:00 committed by Xavier Morel
parent 5c59479577
commit 34fe1d211d
1 changed files with 10 additions and 7 deletions

View File

@ -83,18 +83,21 @@ env.filters['snake'] = snake
env.filters['pascal'] = pascal
class template(object):
def __init__(self, identifier):
# TODO: directories, archives (zipfile, tarfile)
# TODO: archives (zipfile, tarfile)
self.id = identifier
if not os.path.isdir(self.path):
die("{} is not a valid module template".format(identifier))
# is identifier a builtin?
self.path = builtins(identifier)
if os.path.isdir(self.path):
return
# is identifier a directory?
self.path = identifier
if os.path.isdir(self.path):
return
die("{} is not a valid module template".format(identifier))
def __str__(self):
return self.id
@property
def path(self):
return builtins(self.id)
def files(self):
""" Lists the (local) path and content of all files in the template
"""