This extension demonstrates how you can hook into the "New Project" action of CFB. In this case I added support for generating a "skeleton" application for Framework One. FW/1 doesn't ship with a skeleton application in the zip. I've logged a request for it - but honestly, with FW/1 having such a small amount of absolutely necessary files, it may not make sense. However - there are some things that I think a typical FW/1 application will need - hence the need for the extension. So what does the code look like? First, here is the XML for my ide_config.xml:
2 <name>FW/1 Assistant</name>
3 <author>Raymond Camden</author>
4 <version>0</version>
5 <email>ray@camdenfamily.com</email>
6 <description>intro.html</description>
7 <license>license.html</license>
8
9 <menucontributions>
10
11 </menucontributions>
12
13
14 <events>
15 <event type="onprojectcreate" handlerid="projectcreate" />
16 </events>
17
18 <handlers>
19 <handler id="projectcreate" type="CFM" filename="projectcreate.cfm" />
20 </handlers>
21
22 </application>
As you can see it has one event defined - projectcreate - that then links to my handler. The handler is pretty simple as well:
2
3 <cfset xmldoc = XMLParse(ideeventinfo)>
4
5 <cfset project=xmldoc.event.ide.eventinfo.xmlattributes["projectname"]>
6 <cfset projectloc=xmldoc.event.ide.eventinfo.xmlattributes["projectlocation"]>
7
8 <!---
9 Create the following folders
10 /controllers
11 /layouts
12 /services
13 /views
14 /views/main
15
16 Create the following files:
17 /Application.cfc
18 /index.cfm
19 /views/main/default.cfm
20 --->
21
22 <cfdirectory action="create" directory="#projectloc#/controllers">
23 <cfdirectory action="create" directory="#projectloc#/layouts">
24 <cfdirectory action="create" directory="#projectloc#/services">
25 <cfdirectory action="create" directory="#projectloc#/views">
26 <cfdirectory action="create" directory="#projectloc#/views/main">
27
28 <!--- copy my _App.cfc (named so as to not be a real app.cfc) --->
29 <cffile action="copy" source="#expandPath('./files/_App.cfc')#" destination="#projectloc#/Application.cfc">
30
31 <!--- copy my index.cfm --->
32 <!--- FYI, yes, index.cfm is blank, so why bother using a file at _all_? Well, if in the future stuff goes in there, this will be a bit more future proof. That's my logic for now. --->
33 <cffile action="copy" source="#expandPath('./files/index.cfm')#" destination="#projectloc#/index.cfm">
34
35 <cffile action="copy" source="#expandPath('./files/default.cfm')#" destination="#projectloc#/views/main/default.cfm">
Basically the extension simply makes a few folders and copies three 'template' files over into the new project.
I'm not sure if I'll release this as a proper RIAForge project. I'd like to hear what other FW/1 users think and see if they have ideas on how to expand it. (And yes, I'm also supposed to be working on the Model-Glue CFB extension - sorry - I get distracted easily by shiny objects.) I've included a zip to this entry. Enjoy.



Comment 1 written by Jason Brookins on 9 February 2010, at 8:53 AM
Comment 2 written by Zarko on 9 February 2010, at 9:25 AM
Comment 3 written by Joe Brislin on 9 February 2010, at 10:52 AM
Comment 4 written by Dan Vega on 9 February 2010, at 12:05 PM
Comment 5 written by John Allen on 9 February 2010, at 1:16 PM
This post is ALSO cool cause it mentions FW/1, and FW/1 ROCKS!
Comment 6 written by Dan Fredericks on 9 February 2010, at 3:32 PM
I was wondering why you did not include the org/framework.cfc folder into your install?
Did you not do this because that folder should be created outside your framework and just extend to it?
thanks for this CFB extension.
Comment 7 written by Gary Funk on 9 February 2010, at 3:49 PM
Honestly Ray, this extension will help me use FW/1 more, which I view as good.
Comment 8 written by Raymond Camden on 9 February 2010, at 3:57 PM
[Add Comment] [Subscribe to Comments]