Bugfixes
This commit is contained in:
24
src/cpl_cli/source_creator/template_builder.py
Normal file
24
src/cpl_cli/source_creator/template_builder.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
from cpl_cli.templates.template_file_abc import TemplateFileABC
|
||||
|
||||
|
||||
class TemplateBuilder:
|
||||
|
||||
@staticmethod
|
||||
def build(project_path: str, template: TemplateFileABC):
|
||||
"""
|
||||
Creates template
|
||||
:param project_path:
|
||||
:param template:
|
||||
:return:
|
||||
"""
|
||||
file_path = os.path.join(project_path, template.path, template.name)
|
||||
file_rel_path = os.path.join(project_path, template.path)
|
||||
|
||||
if not os.path.isdir(file_rel_path):
|
||||
os.makedirs(file_rel_path)
|
||||
|
||||
with open(file_path, 'w') as license_file:
|
||||
license_file.write(template.value)
|
||||
license_file.close()
|
Reference in New Issue
Block a user