Preview of the Framework Skeletons Bolt Plugin
The other day I gave a preview of my Illudium Bolt Connector and today I want to look at another Bolt (apparently now ColdFusion Builder) plugin I released on RIAForge I call the "Skeleton Application Generator". This one is designed to allow you to quickly and easily place the skeleton application files for a variety of frameworks into a folder. The concept is simple, but its useful and since its extensible, you can support additional frameworks or your own custom skeleton application files. In addition, I want to highlight how simple creating these plugins can be, as I was able to create this plugin in about an hour.
First, let's look at how you can extend this plugin to support additional frameworks or your own custom code (as a sife note, I looked for a ColdBox skeleton to include by defaultbut didn't find one - feel free to point me in the right direction). When you install this plugin, it puts a folder called "Application Skeleton Generator" in your web server root. Inside that folder is a subfolder named skeletons with additional folders containing the different zip files of each of the default supported frameworks. In order to add a new framework or custom code support, simply zip up your skeleton application files and place it in a folder within this directory. The list of frameworks on the plugins dialog is simply a cfdirectory list of folders in this directory, so it should show up as soon as you add the folder.
Let's look at some of the code (I do plan to have a more extensive tutorial on creating plugins soon, so this will only cover some basics). The "selectSkeleton.cfm" file is he one that generates the dialog that pops up when you choose this plugin from the right-click file folder context menu. As you can see, It simply does a cfdirectory on the "skeletons" folder discussed above and creates a "list" input within the dialog containing the results.
<cflog file="bolt" text="Running selectSkeleton.cfm #timeFormat(now())#">
<cfparam name="ideeventinfo">
<cfset data = xmlParse(ideeventinfo)>
<!--- get a list of folders in this applications skeletons folder --->
<cfdirectory action="list" directory="#expandPath('../skeletons')#" type="dir" name="mySkeletons" />
<cfheader name="Content-Type" value="text/xml">
<cfoutput>
<response status="success" type="default">
<ide handlerfile="expandSkeleton.cfm">
<dialog width="300" height="200">
<input name="Select a Type" Lable="Select Type" type="list">
<cfloop query="mySkeletons">
<option value="#mySkeletons.name#" />
</cfloop>
</input>
</dialog>
</ide>
</response>
</cfoutput>
As you can see from the code above, when you submit that dialog it runs "expandSkeleton.cfm." All this file does, as you can see below, is to parse the event passed by the dialog to get the selected folder and selected framework option and then it unzips the zip file it finds within the selected directory. The toughest part about building these plugins, in my opinion, is figuring out where the data is in the event that is passed. Usually, while I am developing I will often dump values into an HTML file that I can browse. In this case, I only needed two values which you can see being set in the expandLocation (i.e. the folder you right clicked on) and the skeletonLocation (i.e. the framework skeleton you selected). Once I have this information, I simply unzip the file in the skeletonLocation into the expandLocation. Finally, I create a simple dialog to show you the results.
<cflog file="bolt" text="Running expandSkeleton.cfm #timeFormat(now())#">
<cfparam name="ideeventinfo">
<cfset data = xmlParse(ideeventinfo)>
<cfset message = "" />
<cfset expandLocation = data.event.ide.projectview.resource.xmlAttributes.path />
<cfset skeletonLocation = data.event.user.input.xmlAttributes.value />
<!--- get the zip file under the skeleton location directory. I ignore any but the first one --->
<cfdirectory action="list" directory="#expandPath('../skeletons/#skeletonLocation#')#" filter="*.zip" name="mySkeletonsZip" />
<cfif mySkeletonsZip.recordCount>
<cfzip action="unzip" destination="#expandLocation#" file="#mySkeletonsZip.directory#/#mySkeletonsZip.name#" storePath="false" />
<cfset message = mySkeletonsZip.name & " unzipped to " & expandLocation />
<cfelse>
<cfset message = "No zip file was found in that directory." />
</cfif>
<cfheader name="Content-Type" value="text/xml">
<response status="success" showresponse="true">
<ide>
<dialog width="550" height="350" />
<body>
<![CDATA[<p style="font-size:11px;">
<cfoutput>#message#</cfoutput>
</p>]]>
</body>
</ide>
</response>
As you can see, this is really very simple to build and you could easily whip up Bolt (ColdFusion Builder) plugins for a variety of small-but-useful tasks in very little time. To see the results of this plugin in action, click on the image below and I created a Jing movie showing how the plugin functions.
(e.g. The contents of all folders are placed in the root folder of my project. So now all my css, img, etc files are all jumbled up together.)
Do you have a way to fix that.
Thanks

