Added first structure and tests
This commit is contained in:
parent
b3b09d2462
commit
adfef66621
24
docs/init_template.txt
Normal file
24
docs/init_template.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
{} {}
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
{}
|
||||
|
||||
:copyright: (c) {} {}
|
||||
:license: {}
|
||||
|
||||
"""
|
||||
|
||||
__title__ = '{}'
|
||||
__author__ = '{}'
|
||||
__license__ = '{}'
|
||||
__copyright__ = '{}'
|
||||
__version__ = '{}'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
|
||||
version_info = VersionInfo(major={}, minor={}, micro={})
|
10
docs/structure.md
Normal file
10
docs/structure.md
Normal file
@ -0,0 +1,10 @@
|
||||
- sh_edraft
|
||||
- common # Contains Interfaces and models for the hole library
|
||||
- interface
|
||||
- model
|
||||
- configuration # Contains classes for app configuration by JSON, ENV vars and arguments
|
||||
- discord # Contains classes for better use of discord.py
|
||||
- logging # Contains classes for logging
|
||||
- mailing # Contains classes for mailing
|
||||
- messenger # Contains classes for sh_messenger_server client
|
||||
- service # Contains classes to provide and use the services defined in this library
|
2
docs/todo.md
Normal file
2
docs/todo.md
Normal file
@ -0,0 +1,2 @@
|
||||
- create logger
|
||||
- use logger in publisher
|
12
src/setup.py
Normal file
12
src/setup.py
Normal file
@ -0,0 +1,12 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
name='sh_edraft',
|
||||
version='2020.0.1',
|
||||
packages=setuptools.find_packages(),
|
||||
url='https://www.sh-edraft.de',
|
||||
license='MIT',
|
||||
author='Sven Heidemann',
|
||||
author_email='edraft.sh@gmail.com',
|
||||
description='sh-edraft python common lib'
|
||||
)
|
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
10
src/test.py
Normal file
10
src/test.py
Normal file
@ -0,0 +1,10 @@
|
||||
from sh_edraft.publish.model.template import Template
|
||||
from sh_edraft.publish.publisher import Publisher
|
||||
|
||||
if __name__ == '__main__':
|
||||
publisher = Publisher('./')
|
||||
templates = [
|
||||
Template('*', '../docs/init_template.txt')
|
||||
]
|
||||
publisher.create(templates)
|
||||
publisher.publish()
|
Loading…
Reference in New Issue
Block a user