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