Added first structure and tests

This commit is contained in:
2020-11-19 23:06:57 +01:00
parent b3b09d2462
commit adfef66621
20 changed files with 144 additions and 0 deletions

24
src/sh_edraft/__init__.py Normal file
View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
"""
sh_edraft python common lib
~~~~~~~~~~~~~~~~~~~
Common python functions and classes for sh-edraft.de ecosystem
:copyright: (c) 2020 edraft
:license: MIT, see LICENSE for more details.
"""
__title__ = 'sh_edraft.de'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright 2020 sh-edraft.de'
__version__ = '2020.12.0.1'
from collections import namedtuple
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major=2020, minor=12, micro=0.1)

View File

View File

@@ -0,0 +1,24 @@
from abc import ABC, abstractmethod
from typing import List
from sh_edraft.publish.model.template import Template
class IPublisher(ABC):
@abstractmethod
def __init__(self, local_path: str):
pass
@property
@abstractmethod
def local_path(self) -> str:
pass
@abstractmethod
def create(self, templates: List[Template]):
pass
@abstractmethod
def publish(self):
pass

View File

View File

View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,16 @@
from typing import Optional
class Template:
def __init__(self, name: Optional[str] = None, path: Optional[str] = None):
self._name: Optional[str] = name
self._path: Optional[str] = path
@property
def name(self):
return self._name
@property
def path(self):
return self._path

View File

@@ -0,0 +1,22 @@
from typing import List
from sh_edraft.common.interface.ipublisher import IPublisher
from sh_edraft.publish.model.template import Template
class Publisher(IPublisher):
def __init__(self, local_path: str):
super().__init__(local_path)
self._local_path = local_path
self._templates: List[Template] = []
@property
def local_path(self) -> str:
return self._local_path
def create(self, templates: List[Template]):
self._templates = templates
def publish(self):
print(self._local_path, [(t.name, t.path) for t in self._templates])

View File