From ef430ee3dc288b1a1f9901378d122c41d9ecdead Mon Sep 17 00:00:00 2001
From: Steve Nyemba <nyemba@gmail.com>
Date: Wed, 29 Jan 2025 13:57:23 -0600
Subject: [PATCH] bug fix ....

---
 cms/engine/project/__init__.py | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/cms/engine/project/__init__.py b/cms/engine/project/__init__.py
index 7b1e6ef..f890f7e 100644
--- a/cms/engine/project/__init__.py
+++ b/cms/engine/project/__init__.py
@@ -49,6 +49,28 @@ def make_folder (projectFolder, webroot):
         _projectPath =  os.sep.join([_path,folder])
         if not os.path.exists(_projectPath) :
             os.makedirs(_projectPath)
+def _icode(_path,_root):
+    """
+    This function will generate some default plugins to show the users how plugins work and can be used/written
+    :path   location of the project
+    """
+    _code = """
+    import cms
+    #
+    # register this in config.plugins: {"demo":["info"]}
+
+
+    @cms.plugins(mimetype='application/json') :
+    def info (**_args):
+        _request= _args['request']
+        _config = _args['config']
+        return {"version":_config['system']['version'],'title':_config['layout']['header']['title']}
+        pass
+    """
+    loc = os.sep.join([_path,_root,'_plugins','demo.py'])
+    f = open(loc,'w')
+    f.write(_code)
+    f.close()
 def _ilogo (_path):
     """
     This function creates a default logo in a designated folder, after the project folder has been created
@@ -143,13 +165,14 @@ def make (**_args) :
     _config['plugins'] = {}
     _folder = _args['folder']
     _root = _config['layout']['root']    #-- web root folder
-    make_folder(_folder,_root)
-    f = open(os.sep.join([_folder,'qcms-manifest.json']),'w')
+    make_folder(_folder,_root)  #-- creating the project folder structure
+    f = open(os.sep.join([_folder,'qcms-manifest.json']),'w')   #-- adding the manifest file
     f.write( json.dumps(_config))
     f.close()
 
-    _ilogo(os.sep.join([_folder,_root]))
+    _ilogo(os.sep.join([_folder,_root]))    #-- adding logo
     print ([_folder,_root])
     _index(os.sep.join([_folder,_root]),_root)
-    _itheme(_folder,_root)
-    
\ No newline at end of file
+    _itheme(_folder,_root)  #-- adding theme folder
+    _icode(_folder,_root) #-- adding the plugins sample code
+