FastOrganizer/basic_conf.py
2025-05-18 03:22:51 +03:00

64 lines
1.6 KiB
Python

import sys
from setup_project import BasicSetup
from apps import SubApp
#### -setup basic
### -setup modules
### -setup hard
###fastorg -setup basic -app account
###fastorg -app tiles
###fastorg -include account
class BasicConfig:
def __init__(self):
self.subappname = "account_manager"
self.mainfile = "main.py"
self.docker_file = "docker-compose.yml"
commands = {
'setup' : ['basic', 'modules', 'hard'],
'app' : ['account', 'tiles'],
'include' : ['account', 'docker'],
}
### fastorg setup basic app multiverse include docker
class CommandAST:
def __init__(self):
self.setuptype = None
self.subappname = None
self.includetype = None
self.subapps = []
def read_command(self, commands):
tokens = iter(commands)
for cmd in tokens:
if cmd == 'setup':
self.setuptype = next(tokens, None)
elif cmd == 'app':
self.subapps.append(SubApp(next(tokens, None)))
elif cmd == 'include':
self.includetype = next(tokens, None)
else:
print(f"Unknown command: {cmd}")
def __str__(self):
return (f"CommandAST(setuptype={self.setuptype}, "
f"subappname={self.subappname}, "
f"includetype={self.includetype})")
def basic_setup(self):
setup = BasicSetup(mainfile="main2.py", docker_file="docker-compose.yml",
db_name='db_name',
db_type='sqlite')
setup.subapps = self.subapps
setup.create()