Added first structure and tests
This commit is contained in:
24
src/sh_edraft/__init__.py
Normal file
24
src/sh_edraft/__init__.py
Normal 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)
|
0
src/sh_edraft/common/__init__.py
Normal file
0
src/sh_edraft/common/__init__.py
Normal file
0
src/sh_edraft/common/interface/__init__.py
Normal file
0
src/sh_edraft/common/interface/__init__.py
Normal file
24
src/sh_edraft/common/interface/ipublisher.py
Normal file
24
src/sh_edraft/common/interface/ipublisher.py
Normal 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
|
0
src/sh_edraft/common/model/__init__.py
Normal file
0
src/sh_edraft/common/model/__init__.py
Normal file
0
src/sh_edraft/configuration/__init__.py
Normal file
0
src/sh_edraft/configuration/__init__.py
Normal file
0
src/sh_edraft/discord/__init__.py
Normal file
0
src/sh_edraft/discord/__init__.py
Normal file
0
src/sh_edraft/logging/__init__.py
Normal file
0
src/sh_edraft/logging/__init__.py
Normal file
0
src/sh_edraft/mailing/__init__.py
Normal file
0
src/sh_edraft/mailing/__init__.py
Normal file
0
src/sh_edraft/messenger/__init__.py
Normal file
0
src/sh_edraft/messenger/__init__.py
Normal file
0
src/sh_edraft/publish/__init__.py
Normal file
0
src/sh_edraft/publish/__init__.py
Normal file
0
src/sh_edraft/publish/model/__init__.py
Normal file
0
src/sh_edraft/publish/model/__init__.py
Normal file
16
src/sh_edraft/publish/model/template.py
Normal file
16
src/sh_edraft/publish/model/template.py
Normal 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
|
22
src/sh_edraft/publish/publisher.py
Normal file
22
src/sh_edraft/publish/publisher.py
Normal 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])
|
0
src/sh_edraft/service/__init__.py
Normal file
0
src/sh_edraft/service/__init__.py
Normal file
Reference in New Issue
Block a user