ColdFusion on Wheels Blog


Internal Documentation in CFWheels 2.0-beta

One of a developer’s biggest time sinks is coming up with and writing accurate and engaging documentation. Even if it’s an internal project with.. well, just you… it’s still incredibly valuable to have: coming back to projects a few months or even years later can often lead to a bit of head scratching and screams of “why?”, especially with your own code.

Whilst we’re not promising that CFWheels will write all your documentation for you, we have put some tools in place to hopefully make the process a little less painful. With a small amount of adjustment in how you document your core functions, documentation doesn’t necessarily have to be such a time consuming process.

Browse the Core API

The first thing to notice is the new ‘[View Docs]’ link in the debug section in the footer:

Following that link leads you to the internal documentation. This is a dynamically created set of documention created via javaDoc commenting in the main CFWheels Core.

The three column layout is designed to allow for quick filtering by section or function name. On the left are the main CFWheels core categories, such as Controller and Model functions, which are then broken down into sub categories, such as Flash and Pagination functions etc. Clicking on a link in the first column will filter the list in the second  and third columns with all the functions which match (including child functions of that category).

Filtering by function name is made simple by a “Filter as you type” search field in the second column, so getting to the right function should be very quick.

The third column contains the main function definition, including tags, parameters and code samples.

How is it generated?

Each function in the core is now appropriately marked up with javaDoc style comments. This, combined with getMetaData() allows us to parse the markup into something useful.

The [section] and [category] tags categorise the function as appropriate, and the @html part describes the function’s parameter. The additional parameter data, such as whether it’s required, type and any defaults are automatically parsed too. This results in a display like:

Documenting your own functions

Any function which is available to Controller.cfc or Model.cfc is automatically included; if there’s no javaDoc comment, then they’ll appear in uncategorized. But of course, there’s nothing stopping you creating your own [section] and [category] tags, which will then automatically appear on the left hand column for filtering: you’re not restricted to what we’ve used in the core.

As an example, if you wanted to document all your filters, you might want to have a [section: Application] tag, with [category: filters].  This way, your application documentation grows as you create it.

Something as simple as a sublime text snippet for a new function which includes the basic javaDoc skeleton can get you in the habit pretty quickly!

Plugins too!

We also introspect plugins for the same markup. We encourage plugin authors to adjust their plugin code to include [section: Plugins] at the very least. We do appreciate it will take a while for the plugin eco-system to catch up with this though. More on plugins later.

Exports & Re-use

You can export the docs via JSON just by changing the URL string:
i.e ?controller=wheels&action=wheels&view=docs&type=core&format=json

You could also include the functions used to create the docs and create your own version (perhaps useful for a CMS or other application where you have internal documentation for authenticated users). Whilst this isn’t officially supported (the main functions may be subject to change!) it is technically possible. The best example is the thing itself – see the main output if you’re interested. Please note that the user interface isn’t available in production mode (for obvious reasons we hope!), so if you wanted to expose this data to an end user, you would probably need to “roll your own” with this approach.

Updating

Note that the CFC introspection doesn’t automatically happen on every request, so you will need to ?reload=true to see changes to your code. Additionally, Adobe ColdFusion is more aggressive in caching CFC metadata, so depending on your settings, you may not see changes until a server restart.

Code samples

Whilst the core has additional code samples which can be loaded from text files, there’s no support for your application functions to take advantage of this yet.

Roadmap

Whilst this API/function explorer is a great first step, you’ll notice your controller and model specific functions aren’t included (only those shared amongst controllers, or in the /global/functions.cfm file. This is because we’re only looking at the main Model.cfc and Controller.cfc and what it can access.

In CFWheels 2.1, we’ll look at adding a full Controller and Model metadata explorer using the same techniques, and map functions like show() to their respective routes too.

 


Moving towards 2.x Beta

It’s been a while in the making (probably 9 months or more) but we’re finally rolling towards a 2.0 beta release, with just a few tickets in the queue left before we can set it free on the world.

In the meantime, you may have noticed a few changes in the CFWheels ecosystem, which we’ve needed to do to support CFWheels 2.x properly.

HTTPS baby!

Firstly, all CFWheels domains are now running over https://, which in this day and age, should be a given. No excuses for not doing this now.

guides.cfwheels.org

“docs.cfwheels.org” has been renamed guides.cfwheels.org and is where the main extended documentation and tutorials will live. This system is based on readme.io, and has been great in quickly creating some nice looking docs. We will continue to add to what’s there over the beta launch too.

However, it’s not perfect: the API reference on there is simply not designed to take something of the scope of the CFWheels API. The page can crash mobile browsers and is a little…unwieldy at best. Adding to the extremely odd SEO of the reference section (i.e, it’s not indexed at all), it’s time to move it off.

api.cfwheels.org (alpha)

So as docs.cfwheels.org has been deprecated, we’re going to split out the API reference to a new home, api.cfwheels.org. There’s lots of good reasons for this: With CFWheels 2.x, not only has the entire core (well, almost the entire core) been moved to cfscript, we’ve also commented every single public API function with javadoc style comments.

This means all the core functions you know and love now have been categorized and commented in the source code, so when pull requests come in, we can keep the documentation up to date at the same time.

The 2.x core has a new built in javadoc parser, so now we can just extract a JSON file where we can power api.cfwheels.org. This also has a huge advantage – we can offer offline/built in documentation browsers from within the debug section of your app. It will even read your own functions – so your local documentation reference will be increasingly valuable. More on this in detail soon.

More to come!

Over the next few weeks, we’ll try and get some blog posts out detailing some of the new 2.x beta features in detail. If there’s something in particular you’d like to know about, please ping a comment or find us in slack/mailing list/gitHub.


CFWheels 1.4.5 maintenance Release

Today sees another maintenance release for the 1.4.x series

Download 1.4.5 today to fix the following:

Bug Fixes

  • Display URL correctly in error email when on HTTPS – [Per Djurner]
  • Added the datetimeoffset data type to the Microsoft SQL Server adapter – [Danny Beard]
  • Fix for test link display in debug footer – #588 [Tom King]
  • Don’t include query string when looking for image on file through imageTag() – [Per Djurner]
  • Format numbers in paginationLinks() – [Per Djurner]
  • Correct plugin filename case on application startup – #586 [Chris Peters]
  • Clear out cached queries on reload – #585 [Andy Bellenie]

Also don’t forget to check the upgrade notes.


10 years of CFWheels / Welcome Adam / CFWheels 2.x

A bit of history:

It’s slightly hard to put an exact date on it, but this year (probably) celebrates 10 years of CFWheels!

Obviously, in the internet age, 10 years is an awfully long time. The first mention I can find if from Pete Freitag’s “Get Wheelin” blog post celebrating CFWheels 0.1 in November 2005. Rob Cameron, the original author moved over to Rails full time a few years later: you can catch up with him at http://ridingtheclutch.com/. Over the years there have been a lot of contributors – whilst our GitHub repo hasn’t quite got that (very) early history, since Jul 23, 2006, we’ve had:

  • 2825 commits (Per Djurner has the dubious claim to fame of the first commit, and at time of writing, the most recent too :))
  • 22 Branches
  • 43 Releases
  • 76 forks
  • 453 issues

Whilst there was a “bit of a break” around 2012/13, Wheels has been going from strength to strength. Contributors have changed and moved on, and so have core team members. Our thanks go out to all of them!

Welcome Adam!
We’re very pleased that Adam Chapman (@chapmandu) has agreed to join the CFWheels core team! He’s been a long-time supporter of wheels, we’re very glad to have him on board. We expect great things AC…. great things. 🙂 You can find Adam’s blog here.

CFWheels 2.x:

Lots of chat at the moment about the next major release of CFWheels – please do get involved on the Google group if you’ve got ideas. At the moment, amongst lots of micro improvements, we’re looking at:

  • integrating the ColdRoute plugin into the core:  ColdRoute allows you to define RESTful resources through new expressive routing helpers and controller conventions. It also allows you to organize controllers and views into subfolders via “namespaces” or “modules.”
  • improving wheels as a true RESTful service provider: you can already return JSON, XML and lots of other good stuff, but we’re looking to improve things like setting custom headers, and really controlling your APIs response
  • improving the plugin architecture, and generally looking a more “modular” way of doing things.
  • dropping CF8/9 support; dropping Railo (as you should all be on Lucee now!!)
  • better Commandbox support: we’ll be looking at CLI type stuff to make getting going with wheels even quicker.

Got an idea? Get on the Google Group and let us know!


CFWheels 1.4.4 maintenance Release

Today sees another maintenance release for the 1.4.x series

Download 1.4.4 today to fix the following:

Bug Fixes

  • Check global “cacheActions” setting – #572 [Andy Bellenie, Per Djurner]
  • Fixed parsing for SQL IN parameters – #564 [Lee Bartelme, Per Djurner]
  • Pass through all arguments properly when using findOrCreateBy – #561 [Per Djurner]
  • Make it possible to disable session management on a per request basis – #493 [Andy Bellenie, Per Djurner]
  • Allow mailParams to be passed through to sendEmail() – #565 [Tom King]
  • Fixed inconsistency in form helpers for nested properties – [Marc Funaro, Per Djurner, Chris Peters]
  • Fixed issue with grouping on associated models – [Song Lin, Per Djurner]
  • Made the pagination() function available globally – #560 [Chris Peters, Per Djurner]

Also don’t forget to check the upgrade notes.


CFWheels 1.4.3 maintenance release

Today sees another maintenance release for the 1.4.x series

Download 1.4.3 today to fix the following:

Bug Fixes

  • Fix for using cfscript operators in condition and unless arguments.
  • Added try / catch on getting host name since CreateObject(“java”) can be unavailable for security reasons.
  • Fixed bug with cache keys always changing even though the input was the same.
  • Remove white space character in output.
  • Use correct path info in error email and debug area.
  • Fixed plugin injection issue on start-up.
  • Skip calculated properties that are aggregate SQL functions in the GROUP BY clause.
  • Fixed error when trying to validate uniqueness on blank numeric properties.

Also don’t forget to check the upgrade notes.


CFWheels 1.4.2 maintenance release

Today sees another maintenance release for the 1.4.x series

Download 1.4.2 today to fix the following:

Bug Fixes

  • Fix for selecting distinct with calculated property – [Edward Chanter, Per Djurner]
  • Fixed so default values are applied to non persistent properties – #519 [Andy Bellenie]
  • Fixed missing var scope causing error on Lucee – [Russ Michaels, Tom King]
  • Don’t show debug info on AJAX requests – #496 [Leroy Mah, Per Djurner]
  • Fixed permissions issue with imageTag() when running on shared hosting – [Per Djurner]
  • Removed use of ExpandPath() in debug file since it was causing file permission issues – [Peter Hopman, Per Djurner]
  • Skip setting object property when NULL is passed in – #507 [Andy Bellenie, Per Djurner]
  • Fixed edge case issue with calling dynamic association methods – #501 [Dominik Hofer, Per Djurner]
  • Fixed lock name in onSessionEnd event – #499 [Per Djurner]
  • Ignore white space in the “where” argument to finders – #503 [Per Djurner]
  • Ignore spaces in the “keys” argument to hasManyCheckBox() and hasManyRadioButton() – [Song Lin, Per Djurner]
  • Skip running callbacks when validating uniqueness and similar situations – #492 [Andy Bellenie, Per Djurner]
  • Avoid plugin directory exception during first application load – #541 [Adam Chapman, Per Djurner]
  • Fix for using cfscript operators in “condition” and “unless” argument on ACF 8 – #531 [Per Djurner]
  • Fix for rolling back nested properties – #539 [James Gibson, Chris Peters, Per Djurner]
  • afterSave and afterCreate callbacks are not firing on nested objects – #525 [Adam Chapman, Chris Peters, Per Djurner]
  • Ability to pass in list to “includeBlank” argument on dateSelect() and similar functions – #502 [Thorsten Eilers, Per Djurner]
  • Ability to set attributes on the input element created by buttonTo() – [Per Djurner]
  • Added missing “onlyPath” argument to imageTag() – #508 [Per Djurner]
  • Corrected output of property labels in error messages – #494 [Andy Bellenie]

Also don’t forget to check the upgrade notes.


CFWheels 1.4.1 maintenance release

Today sees a small maintenance release for the 1.4.x series

Download 1.4.1 today to fix the following:

Bug Fixes

  • Skip callbacks when running calculation methods  [Adam Chapman, Per Djurner]
  • Fixed rewrite rules so base URL is rewritten correctly on Apache  [Jeremy Keczan, Per Djurner]
  • Removed incorrect path info information set by Apache [David Belanger, Per Djurner]
  • Fixed routing bug when running from a sub folder on Adobe ColdFusion 10 – [Brant Nielsen, Per Djurner]
  • Made sure error emails never depend on application variables being set – [Per Djurner]

Miscellaneous

  • Removed tests folder – [Per Djurner]
  • Updates to framework utility pages – Update logo, Fix links on congrats page to point to new documentation site – [Chris Peters]

Also don’t forget to check the upgrade notes


CFWheels 1.4.0 released, New documentation too..

First, some new announcements

You may have noticed a few changes around here! With the release of 1.4, we’ve taken the opportunity to greatly simplify our web footprint.

  • All documentation now lives on http://docs.cfwheels.org/ (thanks to readme.io). We hope this will allow people to more easily contribute to the fantastic documentation already there; you need a (free) readme.io account, but you should be able to ‘suggest edits’ for any page – feel free to help us out! We’re in the process of adding redirects from the old documentation – please bear with us on this one.
  • You’ll notice the plugin listings are greatly simplified – this is a temporary measure whilst we look at the whole plugin ecosystem generally
  • Downloads now live on the readme.io site at http://docs.cfwheels.org/page/download, but don’t forget you can always get everything at the Git Repo
  • You’ll notice a small change in the cfWheels logo – don’t panic, you’re not going mad, we just thought it might be nice to have something new and shiny to look at.
  • Tom King and Tim Badolato are now part of the Wheels core team. “Per” still does all the actual real work 🙂

Onwards and upwards!

1.4 is released, which brings the usual host of fixes and improvements, most noticeably a few tweaks to get Wheels running with Lucee Server: CFWheels should now correctly identify itself as Lucee in the debug output, and various other (older) Railo specific tweaks should get applied. Note, if you’re ever testing for ‘railo’ in the server scope on Lucee, it will return as true.

A couple of other changes might catch you out too, noticeably removal of the h() function, and “development” now being the default environment mode.

Get 1.4 Now!

Upgrading from 1.3x

  • Replace the entire /wheels/ folder
  • Replace URL rewriting rule files – i.e, /.htaccess, /web.config, /IsapiRewrite4.ini

Release notes:

Model Enhancements

  • Allow spaces in list passed in to the “include” argument on finders – #150 [Per Djurner]
  • Added findOrCreateByProperty, findAllKeys(), findFirst() and findLast() finder methods – [Per Djurner]
  • Add support for “GROUP BY” in sum(), average() etc. – #464 [Per Djurner]
  • Made exists() check for any record when “key” and “where” is not passed in [Per Djurner]
  • Added clearChangeInformation() for clearing knowledge of object changes – #433 [Jeremy Keczan, Per Djurner]
  • Evaluate validation error messages at runtime – #470 [Per Djurner]

View Enhancements

  • Respect blank “text” argument in linkTo() – #365 [Adam Chapman, Tony Petruzzi, Per Djurner]
  • Allow styleSheetLinkTag() and JavaScriptIncludeTag() to reference files starting from the root – [Per Djurner]
  • Added “monthNames” and “monthAbbreviations” arguments to form helpers for easy localization – [Per Djurner]

Controller Enhancements

  • Ability to prepend functions to the filter chain instead of appending – #321 [Per Djurner]
  • Pass in “appendToKey” to caches() to cache content separately – #439 [Per Djurner]
  • Allow external attachments with sendEmail() – [Adam Chapman, Tony Petruzzi]
  • Ability to redirect to a specific URL – [Simon Allard]
  • Option to correct JSON output by passing in x=”string” or x=”integer” to renderWith() – [Per Djurner]

Bug Fixes

  • Fix for blank path_info in CGI scope – #447 [Tim Badolato, Tony Petruzzi, Per Djurner]
  • Fix for accessing request scope key that does not exist from session – #446 [Brent Alexander, Per Djurner]
  • Removed “validate” property that was incorrectly set when calling create() – [Per Djurner]
  • Pass through “parameterize” in exists() [Per Djurner]
  • Do not remove “AS” when it’s in the SQL for a calculated property – #453 [Jean Duteau, Per Djurner]
  • Obfuscate parameters in named route patterns when URL rewriting is off – #455 [Amber Cline, Per Djurner]
  • Pass through “includeSoftDeletes” argument correctly – #451 [Jon Brose]

Miscellaneous

  • Support for the Lucee server – [Tom King]
  • Made “development” the default environment mode – [Per Djurner]
  • Removed deprecation work-around for the “if” argument on validation helpers – [Per Djurner]
  • Removed deprecation work-around for the “class” argument on association initialization methods – [Per Djurner]
  • Removed the “lib” folder – [Per Djurner]
  • Removed the h() function, use XMLFormat() instead – [Per Djurner]

CFWheels 1.3.3 maintenance release

Today, we release the third maintenance release in the 1.3.x series.

Download version 1.3.3 to fix the following bugs:

  • Correct output of boolean HTML attributes using new global booleanAttributes setting
  • Make sure locks cannot be affected by other applications running on the same server
  • Fixed bug with updating an integer column from NULL to 0
  • Fixed potential permissions issue when running on shared hosting

More info in the 1.3.3 CHANGELOG.

If you’re upgrading from 1.3.0+, you just need to replace the wheels folder with the new one from the download. If you’re upgrading from an older version of CFWheels, see the instructions.