Changeset 280

Show
Ignore:
Timestamp:
12/20/06 13:12:58 (2 years ago)
Author:
scorfield
Message:

Fixes #135 by adding a check in strict mode that (a) only one of *.xml / *.xml.cfm exists
(for fusebox and circuit files) and (b) the file extensions are consistent (i.e., you can't
have fusebox.xml and then circuit.xml.cfm). The last may prove controversial.

Location:
framework/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • framework/trunk/.settings/org.eclipse.core.resources.prefs

    r205 r280  
    1 #Sun May 07 21:19:08 PDT 2006 
     1#Wed Dec 20 12:07:13 PST 2006 
    22eclipse.preferences.version=1 
    3 encoding//skeleton/controller/circuit.xml.cfm=UTF-8 
    43encoding//skeleton/fusebox.xml.cfm=UTF-8 
    54encoding//skeleton/model/circuit.xml.cfm=UTF-8 
  • framework/trunk/fuseboxApplication.cfc

    r279 r280  
    9393                                        hint="I am the myFusebox data structure." /> 
    9494                 
    95                 <!--- fix ticket 138 ---> 
     95                <!--- fix ticket 135 ---> 
    9696                <cfset var myVersion = "5.0.1.#REReplace('$LastChangedRevision$','[^0-9]','','all')#" /> 
    9797 
     
    9999                <cfset variables.fuseboxLexicon = variables.factory.getBuiltinLexicon() /> 
    100100                <cfset variables.customAttributes = structNew() /> 
     101                 
     102                <cfset variables.fuseboxFileExtension = "" /> 
    101103 
    102104                <cfset variables.fuseboxVersion = myVersion /> 
     
    153155                 
    154156                <cfset var fbFile = "fusebox.xml.cfm" /> 
     157                <cfset var fbFileAlt = "fusebox.xml" /> 
    155158                <cfset var fbXML = "" /> 
    156159                <cfset var fbCode = "" /> 
     
    161164                <cfset var jFuseboxFile = "" /> 
    162165                <cfset var dtLastModified = "" /> 
     166                 
     167                <!--- 
     168                        since we need to check the file, regardless of whether we load it, 
     169                        we might as well do the test up front and perform the strict check 
     170                        that just one version exists (ticket 135) 
     171                ---> 
     172                <cfif fileExists(this.approotdirectory & fbFile)> 
     173                        <cfif this.strictMode and fileExists(this.approotdirectory & fbFileAlt)> 
     174                                <cfthrow type="fusebox.multipleFuseboxXML"  
     175                                                message="Both 'fusebox.xml' and 'fusebox.xml.cfm' exist"  
     176                                                detail="'fusebox.xml.cfm' will be used but 'fusebox.xml' also exists in '#this.approotdirectory#." /> 
     177                        </cfif> 
     178                <cfelse> 
     179                        <cfset fbFile = fbFileAlt /> 
     180                </cfif> 
    163181 
    164182                <cfif structKeyExists(this,"timestamp")> 
    165                         <cfif not fileExists(this.approotdirectory & fbFile)> 
    166                                 <cfset fbFile = "fusebox.xml" /> 
    167                         </cfif> 
    168183                        <!--- Java timestamp solution provided by Daniel Schmid ---> 
    169184                        <cfset myFuseboxFilePath = this.approotdirectory & fbFile /> 
     
    178193                        </cfif> 
    179194                        <!--- attempt to load fusebox.xml(.cfm): ---> 
    180                         <cfif not fileExists(this.approotdirectory & fbFile)> 
    181                                 <cfset fbFile = "fusebox.xml" /> 
    182                         </cfif> 
    183195                        <cftry> 
    184196                                 
     
    186198                                                variable="fbXML" 
    187199                                                charset="#this.characterEncoding#" /> 
     200                                                 
     201                                <cfset variables.fuseboxFileExtension = listLast(fbFile,".") /> 
    188202                                 
    189203                                <cfcatch type="any"> 
     
    605619        </cffunction> 
    606620         
     621        <cffunction name="getFuseboxFileExtension" returntype="string" access="public" output="false"  
     622                                hint="I return the fusebox.xml file extension: either xml or cfm."> 
     623                                         
     624                <cfreturn variables.fuseboxFileExtension /> 
     625                 
     626        </cffunction> 
     627         
    607628        <cffunction name="deleteParsedFiles" returntype="void" access="private" output="false"  
    608629                                hint="I delete all the script files in the parsed/ directory."> 
  • framework/trunk/fuseboxCircuit.cfc

    r278 r280  
    130130 
    131131                <cfset var circuitFile = "circuit.xml.cfm" /> 
     132                <cfset var circuitFileAlt = "circuit.xml" /> 
    132133                <cfset var circuitXML = "" /> 
    133134                <cfset var circuitCode = "" /> 
     
    138139                <cfset var dtLastModified = "" /> 
    139140 
     141                <!--- 
     142                        since we need to check the file, regardless of whether we load it, 
     143                        we might as well do the test up front and perform the strict check 
     144                        that just one version exists (ticket 135) 
     145                ---> 
     146                <cfif fileExists(variables.fullPath & circuitFile)> 
     147                        <cfif variables.fuseboxApplication.strictMode and fileExists(variables.fullPath & circuitFileAlt)> 
     148                                <cfthrow type="fusebox.multipleCircuitXML"  
     149                                                message="Both 'circuit.xml' and 'circuit.xml.cfm' exist"  
     150                                                detail="'circuit.xml.cfm' will be used but 'circuit.xml' also exists in '#variables.fullPath#." /> 
     151                        </cfif> 
     152                <cfelse> 
     153                        <cfset circuitFile = circuitFileAlt /> 
     154                </cfif> 
     155 
    140156                <cfif structKeyExists(this,"timestamp")> 
    141                         <cfif not fileExists(variables.fullPath & circuitFile)> 
    142                                 <cfset circuitFile = "circuit.xml" /> 
    143                         </cfif> 
    144157                        <!--- Java timestamp solution provided by Daniel Schmid ---> 
    145158                        <cfset myCircuitFilePath = variables.fullPath & circuitFile /> 
     
    153166                                <cfset arguments.myFusebox.trace("Compiler","Loading #getAlias()# circuit.xml file") /> 
    154167                        </cfif> 
     168 
    155169                        <!--- attempt to load circuit.xml(.cfm): ---> 
    156                         <cfif not fileExists(variables.fullPath & circuitFile)> 
    157                                 <cfset circuitFile = "circuit.xml" /> 
    158                         </cfif> 
    159170                        <cftry> 
    160171                                 
     
    176187                                 
    177188                        </cftry> 
     189                         
     190                        <cfif variables.fuseboxApplication.strictMode and 
     191                                        variables.fuseboxApplication.getFuseboxFileExtension() is not listLast(circuitFile,".")> 
     192                                <cfthrow type="fusebox.inconsistentFuseboxCircuit" 
     193                                                message="Inconsistent Fusebox / Circuit file extensions"  
     194                                                detail="The circuit xml file, #circuitFile#, in #variables.fullPath#, uses a different file extension to the application's fusebox xml file. Strict requires consistency." /> 
     195                        </cfif> 
    178196                         
    179197                        <cftry> 
  • framework/trunk/myFusebox.cfc

    r279 r280  
    5151<cfcomponent hint="I provide the per-request myFusebox data structure and some convenience methods."> 
    5252        <cfscript> 
    53         // fix ticket 138 
     53        // fix ticket 135 
    5454        this.version.runtime     = "5.0.1.#REReplace('$LastChangedRevision$','[^0-9]','','all')#"; 
    5555