Fixed source creation bug

This commit is contained in:
2021-05-19 08:01:02 +02:00
parent f611aa73db
commit b931ba6e17
14 changed files with 31 additions and 68 deletions

View File

@@ -1,7 +1,5 @@
import os.path
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class ApplicationTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'application.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
from cpl.application import ApplicationABC
from cpl.configuration import ConfigurationABC

View File

@@ -1,7 +1,5 @@
import os.path
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class MainInitTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = '__init__.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
# imports:
""")

View File

@@ -1,4 +1,3 @@
import os.path
import textwrap
from cpl.utils.string import String
@@ -12,11 +11,9 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._value = textwrap.dedent(f"""\
from cpl.application import ApplicationBuilder
@@ -55,11 +52,9 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._value = textwrap.dedent(f"""\
from cpl.application import ApplicationBuilder
@@ -96,11 +91,9 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._value = textwrap.dedent("""\
from cpl.console import Console
@@ -134,11 +127,9 @@ class MainWithDependencyInjection(TemplateFileABC):
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._value = textwrap.dedent("""\
from cpl.configuration import Configuration, ConfigurationABC

View File

@@ -1,7 +1,5 @@
import os.path
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class StartupTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'startup.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
from cpl.application import StartupABC
from cpl.configuration import ConfigurationABC

View File

@@ -1,7 +1,5 @@
import os
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class ApplicationTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'application.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
from cpl.application import ApplicationABC
from cpl.configuration import ConfigurationABC

View File

@@ -1,7 +1,5 @@
import os
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class NameInitTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = '__init__.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
# imports:
""")

View File

@@ -1,7 +1,5 @@
import os.path
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class MainWithApplicationHostAndStartupTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
@@ -53,9 +50,8 @@ class MainWithApplicationBaseTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'main.py'
self._path = os.path.join(path, name)
self._path = path
import_pkg = f'{name}.'
if name == '':
@@ -95,11 +91,7 @@ class MainWithoutApplicationBaseTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = os.path.join(path, name)
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._path = path
self._value = textwrap.dedent("""\
from cpl.console import Console
@@ -132,11 +124,7 @@ class MainWithDependencyInjection(TemplateFileABC):
TemplateFileABC.__init__(self)
self._name = 'main.py'
self._path = os.path.join(path, name)
import_pkg = f'{name}.'
if name == '':
import_pkg = ''
self._path = path
self._value = textwrap.dedent("""\
from cpl.configuration import Configuration, ConfigurationABC

View File

@@ -1,7 +1,5 @@
import os
import textwrap
from cpl.utils.string import String
from cpl_cli._templates.template_file_abc import TemplateFileABC
@@ -10,9 +8,8 @@ class StartupTemplate(TemplateFileABC):
def __init__(self, name: str, path: str):
TemplateFileABC.__init__(self)
name = String.convert_to_snake_case(name)
self._name = 'startup.py'
self._path = os.path.join(path, name)
self._path = path
self._value = textwrap.dedent("""\
from cpl.application import StartupABC
from cpl.configuration import ConfigurationABC