27 lines
788 B
Python
27 lines
788 B
Python
import os
|
|
from config import Config
|
|
from entry import Entry
|
|
from action import *
|
|
from logger import Logger
|
|
|
|
|
|
class App:
|
|
|
|
def __init__(self):
|
|
Logger.set_log_file('testdata/log.txt')
|
|
self._config = Config()
|
|
|
|
def start(self):
|
|
self._config.read_config()
|
|
self._config.add_entry(Entry('myTest',
|
|
IsDirectoryEmptyCondition(path='emptydir', entry='myTest'),
|
|
LoggMessageAction('success', entry='myTest'),
|
|
LoggMessageAction('fail', entry='myTest')))
|
|
|
|
for entry in self._config:
|
|
result = entry.action.execute()
|
|
if result:
|
|
entry.success.execute()
|
|
else:
|
|
entry.fail.execute()
|