Layered filesystems make integration easier

Today's website are demanding in terms of graphic style and interactivity, achieved by means of CSS and JavaScript. Twitter Bootstrap and JQuery are just two examples that make it clear that we're dealing with mini-frameworks, each composed by a number of source files that must be integrated in the proper way: for instance, sets of JavaScript, CSS and HTML files mapped to the proper URLs. This task was one of the hardest to do with some CMS products I've used in the past, since each single file had to be added separately, usually uploading it by means of a web-based interface.

With NorthernWind things are easier, since the repository is made of a flat file system. In some cases, where HTML templates are not involved, it is enough to take a .zip distribution and extract it under the content/library folder; HTML templates, when present, must be stored under /content/document (by convention it makes sense to use some further folders, such as /content/document/Templates/Bootstrap/1.4.0). Still, when you have to upgrade a framework composed by multiple files, some annoying work is required (even though it can be easily automated by scripting).

A new feature named Layered FileSystem has been introduced in 1.0-ALPHA-15 and it makes integration easier. Now the filesystem where site resources are stored is logically composed by multiple, separate filesystems:

  • a primary one (which is usually a plain filesystem, but can be any other type)
  • one ore more secondary ones, that are .zip files stored under the /filesystems directory

A resource is first searched for in the primary filesystem, then in secondary ones. This makes it possible to keep external frameworks well separated by the site resources by packing their files into .zip files, as in the following example:

fritz% ls -al filesystems/
total 216
drwxrwx---   5 fritz  staff    170 Feb  4 17:50 .
drwxrwx---  13 fritz  staff    442 Feb  4 23:49 ..
-rw-rw----   1 fritz  staff  26231 Feb  4 12:48 google-code-prettify-1-jun-2011_1.zip
-rw-rw----   1 fritz  staff  36989 Feb  4 12:58 jquerytools-1.2.6_1.zip
-rw-rw----   1 fritz  staff  40954 Feb  4 17:50 twitter-bootstrap-1.4.0_1.zip

Each zip file contains resourced arranged in the NorthernWind way, as shown below:

fritz% unzip -v filesystems/twitter-bootstrap-1.4.0_1.zip 
Archive:  filesystems/twitter-bootstrap-1.4.0_1.zip
 Length   Method    Size  Ratio   Date   Time   CRC-32    Name
--------  ------  ------- -----   ----   ----   ------    ----
       0  Stored        0   0%  01-30-12 12:45  00000000  content/library/bootstrap/
       0  Stored        0   0%  01-30-12 12:45  00000000  content/library/bootstrap/1.4.0/
   56497  Defl:N     9642  83%  01-30-12 12:45  f5073e92  content/library/bootstrap/1.4.0/bootstrap.css
   47523  Defl:N     8535  82%  01-30-12 12:45  3291c628  content/library/bootstrap/1.4.0/bootstrap.min.css
       0  Stored        0   0%  01-30-12 12:45  00000000  content/library/bootstrap/1.4.0/js/
    3121  Defl:N     1188  62%  01-30-12 12:45  a17d6247  content/library/bootstrap/1.4.0/js/bootstrap-alerts.js
    1746  Defl:N      804  54%  01-30-12 12:45  ebf88267  content/library/bootstrap/1.4.0/js/bootstrap-buttons.js
    1690  Defl:N      788  53%  01-30-12 12:45  0cd08b81  content/library/bootstrap/1.4.0/js/bootstrap-dropdown.js
    6424  Defl:N     1973  69%  01-30-12 12:45  f915fe0f  content/library/bootstrap/1.4.0/js/bootstrap-modal.js
    2645  Defl:N     1058  60%  01-30-12 12:45  fb064874  content/library/bootstrap/1.4.0/js/bootstrap-popover.js
    3002  Defl:N     1153  62%  01-30-12 12:45  4a921bbb  content/library/bootstrap/1.4.0/js/bootstrap-scrollspy.js
    2166  Defl:N      961  56%  01-30-12 12:45  037ad469  content/library/bootstrap/1.4.0/js/bootstrap-tabs.js
    7981  Defl:N     2440  69%  01-30-12 12:45  835dc46b  content/library/bootstrap/1.4.0/js/bootstrap-twipsy.js
   10172  Defl:N     3559  65%  01-30-12 12:45  70d1c41b  content/library/bootstrap/1.4.0/LICENSE
    2656  Defl:N     1242  53%  01-30-12 12:45  39a2d246  content/library/bootstrap/1.4.0/README.md
       0  Stored        0   0%  01-30-12 23:08  00000000  content/document/Templates/Bootstrap/
       0  Stored        0   0%  01-31-12 18:43  00000000  content/document/Templates/Bootstrap/1.4.0/
       0  Stored        0   0%  01-30-12 12:45  00000000  content/document/Templates/Bootstrap/1.4.0/2columns/
     126  Defl:N      107  15%  01-30-12 12:45  e6186028  content/document/Templates/Bootstrap/1.4.0/2columns/template_en.xhtml
       0  Stored        0   0%  01-30-12 12:45  00000000  content/document/Templates/Bootstrap/1.4.0/3columns/
     135  Defl:N      116  14%  01-30-12 12:45  467d9e4d  content/document/Templates/Bootstrap/1.4.0/3columns/template_en.xhtml
       0  Stored        0   0%  01-30-12 12:45  00000000  content/document/Templates/Bootstrap/1.4.0/4columns/
     126  Defl:N      107  15%  01-30-12 12:45  54ed9be9  content/document/Templates/Bootstrap/1.4.0/4columns/template_en.xhtml
     863  Defl:N      459  47%  01-30-12 23:08  909dff8d  content/document/Templates/Bootstrap/1.4.0/template_en.xhtml
       0  Stored        0   0%  02-04-12 17:50  00000000  content/document/Templates/Bootstrap/1.4.0/topbar/
     314  Defl:N      178  43%  02-04-12 17:50  3968ff0f  content/document/Templates/Bootstrap/1.4.0/topbar/template_en.xhtml
       0  Stored        0   0%  02-04-12 17:49  00000000  content/
       0  Stored        0   0%  02-04-12 17:49  00000000  content/document/
       0  Stored        0   0%  02-04-12 17:49  00000000  content/document/Templates/
       0  Stored        0   0%  02-04-12 17:49  00000000  content/library/
--------          -------  ---                            -------
  147187            34310  77%                            30 files

Now it's easy to upgrade a framework, by just replacing the relevant zip file.

This feature must be enabled with the specific configuration:

nw.beans: LayeredFileSystem, ....