Compare commits
3 Commits
e9fbce0da7
...
2880076705
Author | SHA1 | Date |
---|---|---|
Ferdinand Thiessen | 2880076705 | |
Ferdinand Thiessen | fa503fe142 | |
Ferdinand Thiessen | f1d6b6a2f2 |
|
@ -1,4 +1,5 @@
|
||||||
import click
|
import click
|
||||||
|
from importlib_metadata import entry_points
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
@ -8,14 +9,21 @@ import click
|
||||||
@click.option("--no-core", help="Skip models / types from flaschengeist core", is_flag=True)
|
@click.option("--no-core", help="Skip models / types from flaschengeist core", is_flag=True)
|
||||||
def export(namespace, output, no_core, plugin):
|
def export(namespace, output, no_core, plugin):
|
||||||
from flaschengeist import logger, models
|
from flaschengeist import logger, models
|
||||||
from flaschengeist.app import get_plugins
|
|
||||||
from .InterfaceGenerator import InterfaceGenerator
|
from .InterfaceGenerator import InterfaceGenerator
|
||||||
|
|
||||||
gen = InterfaceGenerator(namespace, output, logger)
|
gen = InterfaceGenerator(namespace, output, logger)
|
||||||
if not no_core:
|
if not no_core:
|
||||||
gen.run(models)
|
gen.run(models)
|
||||||
if plugin:
|
if plugin:
|
||||||
for plugin_class in get_plugins():
|
for entry_point in entry_points(group="flaschengeist.plugins"):
|
||||||
if (len(plugin) == 0 or plugin_class.id in plugin) and plugin_class.models is not None:
|
if len(plugin) == 0 or entry_point.name in plugin:
|
||||||
gen.run(plugin_class.models)
|
try:
|
||||||
|
plugin = entry_point.load()
|
||||||
|
gen.run(plugin.models)
|
||||||
|
except:
|
||||||
|
logger.error(
|
||||||
|
f"Plugin {entry_point.name} could not be loaded due to an error.",
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
|
continue
|
||||||
gen.write()
|
gen.write()
|
||||||
|
|
|
@ -13,7 +13,6 @@ from flaschengeist.controller import sessionController, userController
|
||||||
|
|
||||||
|
|
||||||
class AuthRoutePlugin(Plugin):
|
class AuthRoutePlugin(Plugin):
|
||||||
id = "dev.flaschengeist.auth"
|
|
||||||
blueprint = Blueprint("auth", __name__)
|
blueprint = Blueprint("auth", __name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ from flaschengeist import logger
|
||||||
|
|
||||||
|
|
||||||
class AuthPlain(AuthPlugin):
|
class AuthPlain(AuthPlugin):
|
||||||
id = "auth_plain"
|
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
plugins_installed(self.post_install)
|
plugins_installed(self.post_install)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ from . import permissions
|
||||||
|
|
||||||
|
|
||||||
class RolesPlugin(Plugin):
|
class RolesPlugin(Plugin):
|
||||||
id = "roles"
|
|
||||||
blueprint = Blueprint("roles", __name__)
|
blueprint = Blueprint("roles", __name__)
|
||||||
permissions = permissions.permissions
|
permissions = permissions.permissions
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ def scheduled(id: str, replace=False, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
class SchedulerPlugin(Plugin):
|
class SchedulerPlugin(Plugin):
|
||||||
id = "scheduler"
|
|
||||||
|
|
||||||
def __init__(self, entry_point, config=None):
|
def __init__(self, entry_point, config=None):
|
||||||
super().__init__(entry_point, config)
|
super().__init__(entry_point, config)
|
||||||
self.blueprint = Blueprint(self.name, __name__)
|
self.blueprint = Blueprint(self.name, __name__)
|
||||||
|
|
|
@ -18,7 +18,6 @@ from flaschengeist.utils.datetime import from_iso_format
|
||||||
|
|
||||||
|
|
||||||
class UsersPlugin(Plugin):
|
class UsersPlugin(Plugin):
|
||||||
id = "users"
|
|
||||||
blueprint = Blueprint("users", __name__)
|
blueprint = Blueprint("users", __name__)
|
||||||
permissions = permissions.permissions
|
permissions = permissions.permissions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue