root / framework / trunk / scaffolder / README.txt

Revision 676, 11.7 kB (checked in by scorfield, 1 year ago)

Addresses #310 by moving the scaffolder.

Line 
1This is a new development by Kevin Roche to experiment with scaffolding for Fusebox 5.5. With help from Peter Bell.
2********** 23 Nov 2007 - NOTE ************
3Latest upload includes the GUI interface. At present the GUI interface only works with the index.cfm style of Fusebox. Sean and I are working on integrating it with the main fusebox framework.
4
5Please read the word document Fusebox_scaffolding_002.doc for more information on how to use the GUI interface.
6
7Fo the moment please ensure that the project and datasource names are the same as the project name was a recent improvement and all the required changes have not yet been completed.
8
9********** Quick Start ************
10
11To make use of the scaffolding copy the extensions/scaffolding/ directory to a directory called scaffolder under your coldFusion root. You can try running it elsewhere but there may be chnages reqired and it has not been tested in any other directory.
12
13Currently you will have to add the following line to the start your index.cfm file (later this will be part of fusebox 5.5):
14
15<cfinclude template="/scaffolder/manager.cfm">
16
17If you wish to use the reactor templates, the generated code will require you to have Doug Hughes' reactor and the reactor lexicon installed too.
18
19If you wish to use the coldspring templates the generated code will require ColdSpring and the coldspring lexicon installed.
20
21Run index.cfm?scaffolding.go=display
22
23The GUI interface will display and you can make all the required choices before generating your code. When complete you can click on generate and scaffolder will create the directories for model, view, controller, udfs and subdirectorys named using the name of the datasource. (should be the project but this is not working yet).
24
25EG. if the datasource is FuseForum:
26
27/myapplication/
28/myapplication/controller/
29/myapplication/controller/FuseForum/
30/myapplication/model/
31/myapplication/model/mFuseForum/
32/myapplication/view/
33/myapplication/view/vFuseForum/
34/myapplication/view/vLayout/
35/myapplication/udfs/
36
37The generated code will probably not quite work at the moment as I have made lots of changes lately and there are some unfixed bugs.
38
39Now comes the slow bit - debug.....
40
41*********** Options available during the scaffolding process *************
42
43The scaffolder extension does two things:
441/ Introspect the Database to create an XML Metadata description.
452/ Use the XML Metadata description to create code from a set of templates.
46
47You can simply use it as above to create an application based on the chosen templates, but there are some other possibilities. As a first choice you can modify the XML that is created and so change the generated code. There is a description of the XML in the document "Fusebox Scaffolding XML" which can be found in the same directgory as this file.
48
49The second choice is to change the templates. If you wish to do this it is suggested that you make a copy of an existing set to another subdirectory. The templates can be found in the subdirectories of the templates directory. Each set of templates has its own subdirectory.
50
51*** 13/Nov/2007 - Kevin Roche
52BUG:  Reactor Templates: When the Datasource and Project names are different some generated code is wrong.
53
54TODO: ColdSpring Templates: Update code template for the basic Gateway to support joins to child and iterator.
55TODO: ColdSpring Templates: Create code templates for JSON AJAX support.
56
57TODO: Transfer Templates: Create templates to support Transfer ORM - Volunteers needed.
58
59TODO: Fusebox 5.5: Integrate with core. Add ability to trigger Scaffolder with URL parameters.
60
61TODO: Metadata.cfc: Support for MYSQL DBMS - Volunteers needed.
62TODO: Metadata.cfc: Support for ORACLE DBMS - Volunteers needed.
63
64*** 13/Nov/2007 - Kevin Roche
65I finally got time to work on this again after a few weeks of hectic madness. Spent the whole evening generating code and finding bugs in the generated code, using the ColdSpring Templates.
66
67I am uploading what I have done so far as it makes my life easier to download it all from SVN onto the various machines I have to test it on. I have hopefully fixed the following bugs, but more testing will be done over the next few days:
68
69BUG:  Currently the code only works on Windows platform.
70        - Now should be OK on Unix or Linux but I haven't tested it yet.
71BUG:  Code has to be copied to a directory called \scaffolder\ under the ColdFusion Root.
72        - should now work anywhere in the web root, testing underway.
73
74I have also made a large number of changes to the very buggy ColdSpring templates but in the process I have broken the Reactor templates. I will fix them soon.
75
76*** 27/Sep/2007 - Kevin Roche
77We are going for a release of the Alpha on Monday. There are still a number of known issues with the generated code. My real goal is that the code should run when first generated but that eludes me at present with the ColdSpring Templates and I have not had time to restest the Reactor Templates since I made a bug fix for the problem caused when the Database name and Datasource name do not match. I have gone over to driving all the file paths from the Datasource name.
78
79I have a problem with the ColdSpring code which means that the code refuses to initialise when a boolean is encounted ion the code. I think this must be somthing to do with using 1 and 0 versus True and False. So it probably easy to fix will work on that today.
80
81*** 07/Sep/2007 - Kevin Roche
82Just made an improvement to cftempate so that the Quick Start will work better. I forgot to suggest the init paramaters in the quick start and realised that they were required in most cases. It only worked on my machine wuthout them beacuse of a mapping I had. Now it will work out for you what they should be so in almost every case you won't need them.
83
84One bug found is that when the Datasource and Database names are different the code in the fusebox.xml is wrong. For the time being you can edit it. I will fix that soon.
85
86*** 06/Sep/2007 - Kevin Roche
87OK, So I know you think I spent the summer enjoying myself and forgot all about Fusebox Scaffolding!
88
89Actually spent a lot of it in my Girlfriends Bathroom where I fitted a new Bathroom Suite with help from a plumber. On top of that the expected flow of work did not slow down.
90
91One customer who have been using CF5 for many years finally decided to upgrade to CF7 a week after CF8 was released. So we have been installing a bunch of CF7 instances and also getting out first CF8 customer going.
92
93Enough of the excuses....
94
95This week I finally got around to working out how to make the Scaffolding work with multiple sets of templates and moved the existing reactor templates to a subdirectory of the templates directory so that there can be any number of templates for different purposes or frameworks. <more/>
96
97The current reactor templates have some serious limitations. Firstly they assume that every table has an integer primary key which is auto incrementing (Identity in SQL Server).
98
99One of the problems in Reactor was that it requires that any generated (calculated) field use the name and data type of an exsiting field. So when I want to create a filed containing a record count for a table there has to be a suitable integer field to use as a dummy. I really wanted to have a way to deal with tables where the primary key was an arbitary field or a UUID but can see a way to do that 100% reliably with reactor. This was the bug mentioned in the entry below. Maybe Transfer will do it better, I will wait to find out.
100
101*** 18/Jun/2007 - Kevin Roche
102
103Finally got time to work on this and have fixed the bug that stopped it working without an existing scaffolding.xml file.
104
105The code will now generate an application that uses Reactor to drive the model. There is still a bug in the generated code that I have to track down and fix. The code that creates a record count method does not find a valid fieldname for the counter so falls over when executed, in reactor. Will try and track this down in the next few days.
106
107*** 10/Apr/2007 - Kevin Roche
108
109Now creates a fully working application with reactor as ORM.
110
111http://svn.fuseboxframework.org/framework/branches/dev/extensions/scaffolding/
112
113This particular version I have called Version 0.1 Alpha.
114
115It is supposed to allow you to point it at a SQL server database and will introspect it and create a maintenance application which allows you to list, display, add, edit and delete records from the each of the tables.
116
117This version makes use of reactor so you will need fusebox 5 and reactor.
118
119I have been using fusebox 5.0 and I am about to begin testing it with fusebox 5.1 so there may be issues there.
120
121It uses conventions to decide how to display the contents and the conventions could well be a cause of argument.
122
123There are some issues with it (or reactor not sure which) when a table has multiple links to another table.
124
125Most of the code is in two CFCs in the scaffolder subdirectory. metadata.cfc and cftemplate.cfc. The original cftemplate cfc has been modified to have a suitable init method and also to update individual funcions in CFCs and individual fuseactions in circuits.
126
127There is also a templates subdirectory with the templates which are used to generate the application in it.
128
129The process is essentially a two step process where the database introspection causes an XML file to be generated and that is then used to generate the code.
130
131Once the code is created you can remove the scaffolder and the generated program should work without it.
132
133My questions are:
134
1351/ Is there a better way to do the XML reading and writing?
136
1372/ Should I break the metadata.cfc into several smaller ones or merge the two CFCs into a single CFC?
138
1393/ What other improvements should I make?
140
1414/ Are either of you knowlegeable in another DBMS so that we can support MySQL or Oracle?
142
143My future intentions are:
144
1451/ Try this code with more databases to see what bugs there are. (So far there has only been one database tested).
146
1472/ Create another set of templates for Transfer.
148
149Kevin Roche
150
151
152*** 05/Mar/2007 - Kevin Roche
153
154New documentation in word format Fusebox Scaffolding XML 001.doc
155
156Now code will introspect a database and create the controller XML and view fuses.
157
158Next steps are the Reactor.xml and other reactor files.
159
160
161*** 20/Feb/2007 - Kevin Roche
162
163Proof of concept with the following files being generated from a sample XML file:
164
165dsp_list_xxx.cfm
166dsp_form_xxx.cfm
167dsp_view_xxx.cfm
168circuit.xml.cfm
169
170I decided to make a couple of changes to the XML compared with my blog posting.
171I have modified the type attribute and the format attribute. Will update the documents soon.
172
173I also made a couple of small changes to the CFTemplate, and I am considering some more.
174In particular I am passing a component to CFTemplate to hold the metadata and it has methods
175to get all the stuff I need. At the moment there are about 10 lines at the top of each template
176that creates some local variables because they are used several times in the template.
177
178The same lines are in most of the templates, so I am considering moving them into the CFC code
179instead, but that would make CFTemplate more dependant on my CFC but the templates less dependant
180on my CFC. So I am not sure yet the best way to do it.
181
182
183*** 20/Feb/2007 - To Do List **********************************************
184
1851/ Clean up the generator and update the documents on the XML.
1862/ Split the template for circuit.xml.cfm into one per fuseaction.
1873/ Allow the update of a fuseaction in an existing circuit.xml.cfm file.
1884/ Put each file in the correct place in the directory structure.
1895/ Update the code which creates the XML file using Reactor to the latest version of the XML.
1906/ Refactor all of the above and implement as a Plug-In.
1917/ Write an XML generator for Transfer.
192
193But not necessarily in that order!
194
195
Note: See TracBrowser for help on using the browser.