From 8b119a7133d3a037aba8c589ec923bcb8a2fd131 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Thu, 11 Jul 2024 14:01:26 -0500 Subject: [PATCH] bug fixes (usability) --- bin/qcms | 13 +++++++++++-- cms/engine/basic.py | 29 ++++++++++++++--------------- cms/index.py | 7 ++++++- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/bin/qcms b/bin/qcms index 244a5e1..d6272be 100755 --- a/bin/qcms +++ b/bin/qcms @@ -315,6 +315,8 @@ def create(folder:Annotated[str,typer.Argument(help="path of the project folder" f.close() print (f'{PASSED} configuration being written to project folder') _args = {'title':title,'subtitle':subtitle,'version':version,'root':root,'index':index} + if footer : + _args['footer'] = footer _config = make(**_args) # # updating logo reference (default for now) @@ -331,11 +333,18 @@ def reload (path) : if os.path.exists (path): pass @cli.command(name="bootup") -def bootup (path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json'): +def bootup ( + path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json', + port:int=typer.Option(default=None, help="port number to serve on (will override configuration)") + ): """ This function will launch a site/project given the location of the manifest file """ - index.start(path) + index.start(path,port) + # if not port : + # index.start(path) + # else: + # index.start(path,port) def reset(): """ diff --git a/cms/engine/basic.py b/cms/engine/basic.py index 02e0454..3ec6fe9 100644 --- a/cms/engine/basic.py +++ b/cms/engine/basic.py @@ -6,7 +6,10 @@ from cms import disk, cloud from jinja2 import Environment, BaseLoader, FileSystemLoader import importlib import importlib.util - +""" +There are four classes at play here: +[ Initializer ] <|-- [ Module ] <|-- [ MicroService ] <--<>[ CMS ] +""" class Initializer : """ @@ -25,19 +28,12 @@ class Initializer : # print ([self._ISCLOUD,self._config['system'].keys()]) self._ISCLOUD = False self._caller = None if 'caller' not in _args else _args['caller'] - - # - # actual initialization of the CMS components - # self._iconfig(**_args) - # self._uconfig(**_args) - # self._isource() - # self._imenu() - # self._iplugins() - self._args = _args - self.reload() + + self.reload() #-- this is an initial load of various components def reload(self): + self._iconfig(**self._args) self._uconfig(**self._args) self._isource() @@ -292,9 +288,9 @@ class Initializer : # self.set('layout.root',os.sep.join([_path,_oroot])) pass -class Accessor (Initializer): +class Module (Initializer): """ - This is a basic structure for an application working in either portal or app mode + This is a basic structure for an application working in either portal or app mode, """ def __init__(self,**_args): super().__init__(**_args) @@ -362,9 +358,9 @@ class Accessor (Initializer): # return _found # -class MicroService (Accessor): +class MicroService (Module): """ - This is a CMS MicroService class that is capable of initializing a site and exposing accessor functions + This is a CMS MicroService class that is capable of initializing a site and exposing Module functions """ def __init__(self,**_args): super().__init__(**_args) @@ -389,6 +385,9 @@ class MicroService (Accessor): return _handler.read(uri=_uri,config=self._config) class CMS: + """ + This class aggregates microservices and allows the application of a given service (site/app) + """ def __init__(self,**_args) : # _app = Getter (path = path) diff --git a/cms/index.py b/cms/index.py index 94624c0..c090e79 100644 --- a/cms/index.py +++ b/cms/index.py @@ -285,7 +285,10 @@ def _open(id): @cli.command() def start ( - path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json') : + path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json', + port:int=typer.Option(default=None, help="port number to serve on (will override configuration)") + + ) : """ This function is designed to start the application with its associated manifest (configuration) location :path path to the the manifest @@ -307,6 +310,8 @@ def start ( # dir(_route) # _args = _route.get().get_app() _args = _route.get().app() + if port : + _args['port'] = port _app.secret_key = str(uuid.uuid4()) _app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(hours=24) _app.run(**_args)