Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Large feature-set release

  • Loading branch information...
commit e38cf57d0ec77a7bdd8898c5bf1a28b7adf66b04 1 parent 1734073
Patrick Negri authored November 29, 2011

Showing 33 changed files with 1,714 additions and 358 deletions. Show diff stats Hide diff stats

  1. 9  Makefile
  2. 16  docs/_monkey-fs.html
  3. 48  docs/_monkey-patching.html
  4. 51  docs/arcabouco.html
  5. 7  docs/arcabouco_content.html
  6. 19  docs/arcabouco_controller.html
  7. 7  docs/arcabouco_object_pool.html
  8. 104  docs/arcabouco_request.html
  9. 7  docs/arcabouco_template.html
  10. 18  docs/common.html
  11. 186  docs/docco.css
  12. 329  docs/old_arcabouco.html
  13. 54  docs/template.html
  14. 1  examples/assemble-test/app.coffee
  15. 6  examples/assemble-test/pieces/welcome/welcome.coffee
  16. 10  examples/hello-world/app.coffee
  17. 1  examples/minimal-test/app.coffee
  18. 22  lib/_monkey-fs.coffee
  19. 63  lib/_monkey-patching.coffee
  20. 451  lib/arcabouco.coffee
  21. 47  lib/arcabouco_modules/content.coffee
  22. 17  lib/arcabouco_modules/controller.coffee
  23. 38  lib/arcabouco_modules/objectpool.coffee
  24. 336  lib/arcabouco_modules/old_arcabouco.coffee
  25. 0  lib/{template.coffee → arcabouco_modules/old_template.coffee}
  26. 101  lib/arcabouco_modules/request.coffee
  27. 52  lib/arcabouco_modules/template.coffee
  28. 13  lib/common.coffee
  29. 5  package.json
  30. 30  sample-screws/screw-compatible-web-app/screw-compatible-web-app.coffee
  31. 2  sample-screws/screw-html5shiv/screw-html5shiv.coffee
  32. 2  sample-screws/screw-mootools/screw-mootools.coffee
  33. 20  test/arcabouco.js
9  Makefile
... ...
@@ -0,0 +1,9 @@
  1
+SHELL := /bin/bash
  2
+
  3
+test:
  4
+	@node test/arcabouco.js
  5
+
  6
+doc:
  7
+	docco lib/*.coffee
  8
+
  9
+.PHONY: test
16  docs/_monkey-fs.html
... ...
@@ -0,0 +1,16 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>_monkey-fs.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               _monkey-fs.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <pre><code>Arcabouco.JS
  2
+
  3
+(c) 2011 Patrick Negri, Yellers Software
  4
+Arcabouco.JS is freely distributable under the MIT license.
  5
+For all details and documentation:
  6
+http://github.com/pnegri/arcabouco-js
  7
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h2>Node.JS Monkey Patching for FS</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Include Commons</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/common&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <h3>readdirSyncR</h3>
  8
+
  9
+<p>Extend Fs with a method to read a directory sync</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common.Fs.readdirSyncR = </span><span class="nf">( directory ) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Normalize the input directory</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">directory = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">normalize</span> <span class="nx">directory</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Get all files in the directory</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">files = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Fs</span><span class="p">.</span><span class="nx">readdirSync</span> <span class="nx">directory</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Setup an array for valid files</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">allFiles = </span><span class="p">[]</span>
  10
+  <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Compute the full path of file</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">fileWithPath = </span><span class="nx">directory</span> <span class="o">+</span> <span class="s">&#39;/&#39;</span> <span class="o">+</span> <span class="nx">file</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Get information about the file</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">stat = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Fs</span><span class="p">.</span><span class="nx">statSync</span> <span class="nx">fileWithPath</span>
  11
+    <span class="k">if</span> <span class="nx">stat</span><span class="p">.</span><span class="nx">isFile</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>If it is a file put in all files array</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nx">allFiles</span><span class="p">.</span><span class="nx">push</span> <span class="nx">fileWithPath</span>
  12
+    <span class="k">if</span> <span class="nx">stat</span><span class="p">.</span><span class="nx">isDirectory</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>If it is a directory recursively call this method</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">dirFiles = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Fs</span><span class="p">.</span><span class="nx">readdirSyncR</span> <span class="nx">fileWithPath</span>
  13
+      <span class="k">if</span> <span class="nx">dirFiles</span><span class="p">.</span><span class="nx">length</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>Concatenate the results with files found previousily</p>             </td>             <td class="code">               <div class="highlight"><pre>        <span class="nv">allFiles = </span><span class="nx">allFiles</span><span class="p">.</span><span class="nx">concat</span> <span class="nx">dirFiles</span>
  14
+  <span class="nx">allFiles</span>
  15
+
  16
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
48  docs/_monkey-patching.html
... ...
@@ -0,0 +1,48 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>_monkey-patching.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               _monkey-patching.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <pre><code>Arcabouco.JS
  2
+
  3
+(c) 2011 Patrick Negri, Yellers Software
  4
+Arcabouco.JS is freely distributable under the MIT license.
  5
+For all details and documentation:
  6
+http://github.com/pnegri/arcabouco-js
  7
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h2>Node.JS Monkey Patching</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Include Commons</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/common&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <h3>replaceLast</h3>
  8
+
  9
+<p>Extend String with a replaceLast method</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nb">String</span><span class="p">.</span><span class="nv">prototype.replaceLast = </span><span class="nf">( search, replace ) -&gt;</span>
  10
+  <span class="nv">string = </span><span class="k">this</span>
  11
+  <span class="nv">n = </span><span class="nx">string</span><span class="p">.</span><span class="nx">lastIndexOf</span><span class="p">(</span> <span class="nx">search</span> <span class="p">)</span>
  12
+  <span class="k">if</span> <span class="nx">n</span> <span class="o">&gt;=</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="nx">n</span> <span class="o">+</span> <span class="nx">replace</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;=</span> <span class="nx">string</span><span class="p">.</span><span class="nx">length</span>
  13
+    <span class="nv">string = </span><span class="nx">string</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nx">n</span><span class="p">)</span> <span class="o">+</span> <span class="nx">replace</span>
  14
+  <span class="nx">string</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <h2>Extending and Patching HTTP</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <h3>Response Grouping</h3>
  15
+
  16
+<p>Include a 'group' in response</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common.Http.ServerResponse.prototype.group = </span><span class="s">&#39;default&#39;</span>
  17
+
  18
+<span class="nv">Common.Http.ServerResponse.prototype.getGroup = </span><span class="nf">() -&gt;</span>
  19
+  <span class="nx">@group</span>
  20
+
  21
+<span class="nv">Common.Http.ServerResponse.prototype.setGroup = </span><span class="nf">( groupName ) -&gt;</span>
  22
+  <span class="vi">@group = </span><span class="nx">groupName</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <h3>Response Redirection</h3>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common.Http.ServerResponse.prototype.redirectTo = </span><span class="nf">( url ) -&gt;</span>
  23
+  <span class="nx">@writeHead</span> <span class="mi">302</span><span class="p">,</span> <span class="p">{</span> <span class="s">&#39;Location&#39;</span><span class="o">:</span> <span class="nx">url</span> <span class="p">}</span>
  24
+  <span class="nx">@end</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <h3>respondWith</h3>
  25
+
  26
+<p>Extend Response with a cache-corrected responder</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common.Http.ServerResponse.prototype.respondWith = </span><span class="nf">( content, options = {} ) -&gt;</span>
  27
+ </pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Configure default response options</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">response_option = </span><span class="p">{}</span>
  28
+  <span class="nv">response_option.type = </span><span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">type</span> <span class="k">then</span> <span class="nx">options</span><span class="p">.</span><span class="nx">type</span> <span class="k">else</span> <span class="s">&#39;text/html&#39;</span>
  29
+  <span class="nv">response_option.expiration = </span><span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">expiration</span> <span class="k">then</span> <span class="nx">options</span><span class="p">.</span><span class="nx">expiration</span> <span class="k">else</span> <span class="mi">0</span>
  30
+  <span class="nv">response_option.status = </span><span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">status</span> <span class="k">then</span> <span class="nx">options</span><span class="p">.</span><span class="nx">status</span> <span class="k">else</span> <span class="mi">200</span>
  31
+  <span class="nv">response_option.charset = </span><span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">charset</span> <span class="k">then</span> <span class="nx">options</span><span class="p">.</span><span class="nx">charset</span> <span class="k">else</span> <span class="s">&#39;utf-8&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Calculate the expiration</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">expirationTime = </span><span class="k">new</span> <span class="nb">Date</span><span class="p">()</span>
  32
+  <span class="nv">headers =</span>
  33
+    <span class="s">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="nx">response_option</span><span class="p">.</span><span class="nx">type</span> <span class="o">+</span> <span class="s">&#39;; charset=&#39;</span> <span class="o">+</span> <span class="nx">response_option</span><span class="p">.</span><span class="nx">charset</span>
  34
+  <span class="k">if</span> <span class="nx">expiration</span> <span class="o">&gt;</span> <span class="mi">0</span>
  35
+    <span class="nx">expirationTime</span><span class="p">.</span><span class="nx">setTime</span> <span class="nx">expirationTime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span> <span class="o">+</span> <span class="nx">response_option</span><span class="p">.</span><span class="nx">expiration</span>
  36
+    <span class="nx">Common</span><span class="p">.</span><span class="nx">_</span><span class="p">.</span><span class="nx">extend</span> <span class="nx">headers</span><span class="p">,</span>
  37
+      <span class="s">&#39;Cache-Control&#39;</span> <span class="o">:</span> <span class="s">&#39;max-age=&#39;</span> <span class="o">+</span> <span class="nx">response_option</span><span class="p">.</span><span class="nx">expiration</span> <span class="o">+</span> <span class="s">&#39;, public, most-revalidate&#39;</span>
  38
+      <span class="s">&#39;Expires&#39;</span>       <span class="o">:</span> <span class="nx">expirationTime</span><span class="p">.</span><span class="nx">toGMTString</span><span class="p">()</span>
  39
+  <span class="k">else</span>
  40
+    <span class="nx">Common</span><span class="p">.</span><span class="nx">_</span><span class="p">.</span><span class="nx">extend</span> <span class="nx">headers</span><span class="p">,</span>
  41
+      <span class="s">&#39;Cache-Control&#39;</span> <span class="o">:</span> <span class="s">&#39;max-age=0, no-cache, no-store, must-revalidate&#39;</span>
  42
+      <span class="s">&#39;Pragma&#39;</span>        <span class="o">:</span> <span class="s">&#39;no-cache&#39;</span>
  43
+      <span class="s">&#39;Expires&#39;</span>       <span class="o">:</span> <span class="s">&#39;Thu, 01 Jan 1970 00:00:00 GMT&#39;</span>
  44
+  <span class="nx">@writeHead</span> <span class="nx">response</span><span class="p">.</span><span class="nx">status</span><span class="p">,</span> <span class="nx">headers</span>
  45
+  <span class="nx">@write</span> <span class="nx">content</span>
  46
+  <span class="nx">@end</span><span class="p">()</span>
  47
+
  48
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
51  docs/arcabouco.html
... ...
@@ -0,0 +1,51 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <pre><code>Arcabouco.JS
  2
+(c) 2011 Patrick Negri, Yellers Software
  3
+Arcabouco.JS is freely distributable under the MIT license.
  4
+For all details and documentation:
  5
+http://github.com/pnegri/arcabouco-js
  6
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h2>Helpers &amp; Setup</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Require our external dependencies, place all inside Common</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/common&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Patch node with some features</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/_monkey-patching&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Require default pieces of framework
  7
+TODO: Optmization Room - Only load these if no override is provided</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">ArcaboucoTemplate = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/arcabouco_template&#39;</span>
  8
+<span class="nv">ArcaboucoContent = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/arcabouco_content&#39;</span>
  9
+<span class="nv">ArcaboucoObjectPool = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/arcabouco_object_pool&#39;</span>
  10
+<span class="nv">ArcaboucoController = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/arcabouco_controller&#39;</span>
  11
+<span class="nv">ArcaboucoRequest = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/arcabouco_request&#39;</span>
  12
+
  13
+<span class="k">class</span> <span class="nx">Arcabouco</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Configuration</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">config               : </span><span class="p">{}</span>
  14
+
  15
+    <span class="nv">Template             : </span><span class="kc">null</span>
  16
+    <span class="nv">Content              : </span><span class="kc">null</span>
  17
+    <span class="nv">ObjectPool           : </span><span class="kc">null</span>
  18
+    <span class="nv">Controller           : </span><span class="kc">null</span>
  19
+    <span class="nv">Request              : </span><span class="kc">null</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>putContentFor       : null
  20
+getContentFor       : null</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>renderTemplate      : null
  21
+renderPartial       : null</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>respondWithError    : null
  22
+respondWithTimeout  : null
  23
+respondWithNotFound : null</p>             </td>             <td class="code">               <div class="highlight"><pre>    </pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>assemble            : null</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">work: </span><span class="nf">( object_piece ) -&gt;</span>
  24
+      <span class="nv">index = </span><span class="nx">@Controller</span><span class="p">.</span><span class="nx">register</span><span class="p">(</span> <span class="nx">object_piece</span><span class="p">,</span> <span class="k">this</span> <span class="p">)</span>
  25
+      <span class="nx">@Request</span><span class="p">.</span><span class="nx">parseRoutes</span><span class="p">(</span> <span class="nx">index</span><span class="p">,</span> <span class="k">this</span> <span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>build               : null</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>registerObject      : null
  26
+createObject        : null</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">dispatch             : </span><span class="nf">( request, response ) -&gt;</span>
  27
+      <span class="k">return</span> <span class="kc">null</span> <span class="nx">unless</span> <span class="nx">@Request</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Extend Request with Application</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">request.application = </span><span class="k">this</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Extend Response with Application</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">response.application = </span><span class="k">this</span>
  28
+
  29
+      <span class="nx">@Request</span><span class="p">.</span><span class="nx">dispatch</span><span class="p">(</span> <span class="nx">request</span><span class="p">,</span> <span class="nx">response</span> <span class="p">)</span>
  30
+    
  31
+    <span class="nv">createServer         : </span><span class="o">-&gt;</span>
  32
+      <span class="nx">Common</span><span class="p">.</span><span class="nx">Http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="nx">@dispatch</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span> <span class="k">this</span> <span class="p">)</span> <span class="p">)</span>
  33
+
  34
+    <span class="nv">createSecureServer   : </span><span class="nf">( privateKey, certificate ) -&gt;</span>
  35
+      <span class="nv">credentials = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Crypt</span><span class="p">.</span><span class="nx">createCredentials</span> <span class="p">{</span>
  36
+        <span class="nv">key  : </span><span class="nx">privateKey</span>
  37
+        <span class="nv">cert : </span><span class="nx">certificate</span>
  38
+      <span class="p">}</span>
  39
+      <span class="nv">secureServer = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="nx">@dispatch</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span> <span class="k">this</span> <span class="p">)</span> <span class="p">)</span>
  40
+      <span class="nx">secureServer</span><span class="p">.</span><span class="nx">setSecure</span><span class="p">(</span> <span class="nx">credentials</span> <span class="p">)</span>
  41
+      <span class="nx">secureServer</span>
  42
+
  43
+    <span class="nv">configurePackage    : </span><span class="nf">( name, packages ) -&gt;</span>
  44
+      <span class="k">this</span><span class="p">[</span> <span class="nx">name</span> <span class="p">]</span> <span class="o">=</span> <span class="k">if</span> <span class="nx">packages</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="k">then</span> <span class="k">new</span> <span class="nx">packages</span><span class="p">[</span> <span class="nx">name</span> <span class="p">]()</span> <span class="k">else</span> <span class="nb">eval</span><span class="p">(</span><span class="s">&#39;new Arcabouco&#39;</span> <span class="o">+</span> <span class="nx">name</span> <span class="o">+</span> <span class="s">&#39;()&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-15">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-15">&#182;</a>               </div>               <h2>The Application Fabric</h2>
  45
+
  46
+<p>A constructor must be called with a configuration options.
  47
+These configurations can change everything because all
  48
+our functions are just a proxy to internal components.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">constructor         : </span><span class="nf">( @config = {} ) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-16">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-16">&#182;</a>               </div>               <p>Try to use some user defined packages if they are sent</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">packages = </span><span class="k">if</span> <span class="nx">@config</span><span class="p">.</span><span class="nx">packages</span> <span class="k">then</span> <span class="nx">@config</span><span class="p">.</span><span class="nx">packages</span> <span class="k">else</span> <span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-17">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-17">&#182;</a>               </div>               <p>Load the packages checking for a user defined one, use a default if none is suplied</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="k">for</span> <span class="nx">packageName</span> <span class="k">in</span> <span class="p">[</span><span class="s">&#39;Template&#39;</span><span class="p">,</span><span class="s">&#39;Content&#39;</span><span class="p">,</span><span class="s">&#39;ObjectPool&#39;</span><span class="p">,</span><span class="s">&#39;Controller&#39;</span><span class="p">,</span><span class="s">&#39;Request&#39;</span><span class="p">]</span>
  49
+        <span class="nx">@configurePackage</span><span class="p">(</span> <span class="nx">packageName</span> <span class="o">+</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="nx">packages</span> <span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Configure delegated methods</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">module.exports = </span><span class="nx">Arcabouco</span>
  50
+
  51
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
7  docs/arcabouco_content.html
... ...
@@ -0,0 +1,7 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco_content.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco_content.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">ArcaboucoContent</span>
  2
+  <span class="nv">output: </span><span class="o">-&gt;</span>
  3
+    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s">&#39;Testing &#39;</span>
  4
+
  5
+<span class="nv">module.exports = </span><span class="nx">ArcaboucoContent</span>
  6
+
  7
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
19  docs/arcabouco_controller.html
... ...
@@ -0,0 +1,19 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco_controller.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco_controller.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">ArcaboucoController</span>
  2
+  <span class="nv">Instances : </span><span class="p">[]</span>
  3
+
  4
+  <span class="nv">register: </span><span class="nf">( ControllerObject, Application ) -&gt;</span>
  5
+    <span class="nv">instanceClass = </span><span class="k">new</span> <span class="nx">ControllerObject</span><span class="p">()</span>
  6
+    <span class="k">if</span> <span class="nx">instanceClass</span><span class="p">.</span><span class="nx">bootstrap</span> <span class="o">or</span> <span class="nx">instanceClass</span><span class="p">.</span><span class="nx">getRoutes</span>
  7
+      <span class="nv">ControllerObject = </span><span class="nx">instanceClass</span>
  8
+    <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span><span class="p">(</span> <span class="nx">Application</span> <span class="p">)</span> <span class="k">if</span> <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span>
  9
+    <span class="nx">@Instances</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span> <span class="nx">ControllerObject</span> <span class="p">)</span><span class="o">-</span><span class="mi">1</span>
  10
+
  11
+  <span class="nv">unregister: </span><span class="nf">( controllerIndex ) -&gt;</span>
  12
+    <span class="kc">false</span>
  13
+
  14
+  <span class="nv">get: </span><span class="nf">( controllerIndex ) -&gt;</span>
  15
+    <span class="k">if</span> <span class="nx">@Instances</span><span class="p">[</span> <span class="nx">controllerIndex</span> <span class="p">]</span> <span class="k">then</span> <span class="nx">@Instances</span><span class="p">[</span> <span class="nx">controllerIndex</span> <span class="p">]</span> <span class="k">else</span> <span class="kc">null</span>
  16
+
  17
+<span class="nv">module.exports = </span><span class="nx">ArcaboucoController</span>
  18
+
  19
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
7  docs/arcabouco_object_pool.html
... ...
@@ -0,0 +1,7 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco_object_pool.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco_object_pool.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">ArcaboucoObjectPool</span>
  2
+  <span class="nv">output: </span><span class="o">-&gt;</span>
  3
+    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s">&#39;Testing Object&#39;</span>
  4
+
  5
+<span class="nv">module.exports = </span><span class="nx">ArcaboucoObjectPool</span>
  6
+
  7
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
104  docs/arcabouco_request.html
... ...
@@ -0,0 +1,104 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco_request.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco_request.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/common&#39;</span>
  2
+
  3
+<span class="k">class</span> <span class="nx">ArcaboucoRequest</span>
  4
+  <span class="nv">routeToMethod: </span><span class="p">[]</span>
  5
+  <span class="nv">avaiableRoutes: </span><span class="p">[]</span>
  6
+  <span class="nv">newRoutingAvaiable: </span><span class="kc">false</span>
  7
+
  8
+  <span class="nv">addRoutingToMethod: </span><span class="nf">( path, method, indexOfController ) -&gt;</span>
  9
+    <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">path</span> <span class="p">]</span> <span class="o">=</span>
  10
+      <span class="s">&#39;method&#39;</span> <span class="o">:</span> <span class="nx">method</span>
  11
+      <span class="s">&#39;object&#39;</span> <span class="o">:</span> <span class="nx">indexOfController</span>
  12
+    <span class="vi">@newRoutingAvaiable = </span><span class="kc">true</span>
  13
+    <span class="nx">path</span>
  14
+
  15
+  <span class="nv">parseRoutes: </span><span class="nf">( index, Application ) -&gt;</span>
  16
+    <span class="nv">ControllerObject = </span><span class="nx">Application</span><span class="p">.</span><span class="nx">Controller</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span> <span class="nx">index</span> <span class="p">)</span>
  17
+    <span class="nx">unless</span> <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">getRoutes</span>
  18
+      <span class="k">return</span> <span class="kc">false</span>
  19
+
  20
+    <span class="nv">controllerRoutes = </span><span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">getRoutes</span><span class="p">()</span>
  21
+    <span class="k">for</span> <span class="nx">path</span> <span class="k">of</span> <span class="nx">controllerRoutes</span>
  22
+      <span class="nx">@addRoutingToMethod</span> <span class="nx">path</span><span class="p">,</span> <span class="nx">controllerRoutes</span><span class="p">[</span> <span class="nx">path</span> <span class="p">],</span> <span class="nx">index</span>
  23
+
  24
+  <span class="nv">constructRoutingForPattern : </span><span class="nf">( pattern ) -&gt;</span>
  25
+    <span class="nv">params = </span><span class="p">[]</span>
  26
+    <span class="nv">buildPattern = </span><span class="nx">pattern</span><span class="p">.</span><span class="nx">replace</span> <span class="sr">/\{(.*?)\}/g</span><span class="p">,</span>
  27
+      <span class="nf">( match, sub1 ) -&gt;</span>
  28
+        <span class="nx">params</span><span class="p">.</span><span class="nx">push</span> <span class="nx">sub1</span>
  29
+        <span class="k">return</span> <span class="s">&#39;([^\/]+)&#39;</span>
  30
+    <span class="nv">buildPattern = </span><span class="nx">buildPattern</span><span class="p">.</span><span class="nx">replaceLast</span><span class="p">(</span> <span class="s">&#39;([^\/]+)&#39;</span><span class="p">,</span> <span class="s">&#39;([^$]+)&#39;</span> <span class="p">)</span>
  31
+    <span class="nv">constructedRoute =</span>
  32
+      <span class="nv">regex : </span><span class="k">new</span> <span class="nb">RegExp</span> <span class="s">&#39;^&#39;</span> <span class="o">+</span> <span class="nx">buildPattern</span> <span class="o">+</span> <span class="s">&#39;$&#39;</span>
  33
+      <span class="nv">params: </span><span class="nx">params</span>
  34
+      <span class="nv">index : </span><span class="nx">pattern</span>
  35
+
  36
+  <span class="nv">rebuildRoutes: </span><span class="o">-&gt;</span>
  37
+    <span class="nv">orderedRouteNames = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">_</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span> <span class="nx">@routeToMethod</span> <span class="p">).</span><span class="nx">sort</span><span class="p">().</span><span class="nx">reverse</span><span class="p">()</span>
  38
+    <span class="vi">@avaiableRoutes = </span><span class="p">[]</span>
  39
+    <span class="k">for</span> <span class="nx">pattern</span> <span class="k">in</span> <span class="nx">orderedRouteNames</span>
  40
+      <span class="nx">@avaiableRoutes</span><span class="p">.</span><span class="nx">push</span> <span class="nx">@constructRoutingForPattern</span><span class="p">(</span> <span class="nx">pattern</span> <span class="p">)</span>
  41
+
  42
+  <span class="nv">callMethodForRoute : </span><span class="nf">( route, params, Controller ) -&gt;</span>
  43
+    <span class="k">if</span> <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">]</span>
  44
+      <span class="nv">ControllerIndex = </span><span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">].</span><span class="nx">object</span>
  45
+      <span class="nv">ControllerObject = </span><span class="nx">Controller</span><span class="p">.</span><span class="nx">get</span> <span class="nx">ControllerIndex</span>
  46
+      <span class="nx">ControllerObject</span><span class="p">[</span> <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">].</span><span class="nx">method</span> <span class="p">](</span> <span class="nx">params</span> <span class="p">)</span>
  47
+    <span class="k">else</span>
  48
+      <span class="kc">false</span>
  49
+
  50
+  <span class="nv">parseRequest : </span><span class="nf">( request ) -&gt;</span>
  51
+    <span class="nx">request</span><span class="p">.</span><span class="nx">setEncoding</span> <span class="s">&#39;utf-8&#39;</span>
  52
+    <span class="nv">url = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Url</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">request</span><span class="p">.</span><span class="nx">url</span><span class="p">,</span> <span class="kc">true</span>
  53
+    <span class="nv">request.documentRequested = </span><span class="nx">url</span><span class="p">.</span><span class="nx">pathname</span>
  54
+    <span class="nv">request.query = </span><span class="nx">url</span><span class="p">.</span><span class="nx">query</span>
  55
+
  56
+  <span class="nv">buildParamsForRequest: </span><span class="nf">( route, args, otherParams ) -&gt;</span>
  57
+    <span class="nv">params = </span><span class="p">{}</span>
  58
+    <span class="k">for</span> <span class="nx">index</span> <span class="k">of</span> <span class="nx">route</span><span class="p">.</span><span class="nx">params</span>
  59
+      <span class="nx">params</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">params</span><span class="p">[</span> <span class="nx">index</span> <span class="p">]</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">args</span><span class="p">[</span> <span class="nb">parseInt</span><span class="p">(</span><span class="nx">index</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span> <span class="p">]</span>
  60
+    <span class="nx">Common</span><span class="p">.</span><span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span> <span class="nx">params</span><span class="p">,</span> <span class="nx">otherParams</span> <span class="p">)</span>
  61
+    <span class="nx">params</span>
  62
+
  63
+
  64
+  <span class="nv">dispatch: </span><span class="nf">( request, response ) -&gt;</span>
  65
+    
  66
+    <span class="k">if</span> <span class="nx">@newRoutingAvaiable</span>
  67
+      <span class="nx">@rebuildRoutes</span><span class="p">()</span>
  68
+      <span class="vi">@newRoutingAvaiable = </span><span class="kc">false</span>
  69
+
  70
+    <span class="nv">data = </span><span class="s">&#39;&#39;</span>
  71
+    <span class="nx">request</span><span class="p">.</span><span class="nx">addListener</span> <span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="p">(</span> <span class="nx">data_chunk</span> <span class="p">)</span> <span class="o">=&gt;</span>
  72
+      <span class="nx">data</span> <span class="o">+=</span> <span class="nx">data_chunk</span>
  73
+
  74
+    <span class="nx">@parseRequest</span><span class="p">(</span> <span class="nx">request</span> <span class="p">)</span>
  75
+
  76
+    <span class="nx">request</span><span class="p">.</span><span class="nx">addListener</span> <span class="s">&#39;end&#39;</span><span class="p">,</span> <span class="o">=&gt;</span>
  77
+
  78
+      <span class="nv">hasRouted = </span><span class="kc">false</span>
  79
+
  80
+      <span class="k">for</span> <span class="nx">route</span> <span class="k">in</span> <span class="nx">@avaiableRoutes</span>
  81
+        <span class="nv">routeMatches = </span><span class="nx">route</span><span class="p">.</span><span class="nx">regex</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span> <span class="nx">request</span><span class="p">.</span><span class="nx">documentRequested</span> <span class="p">)</span>
  82
+        <span class="k">if</span> <span class="nx">routeMatches</span>
  83
+          <span class="nv">params = </span><span class="nx">@buildParamsForRequest</span><span class="p">(</span> <span class="nx">route</span><span class="p">,</span> <span class="nx">routeMatches</span><span class="p">,</span> <span class="p">{</span>
  84
+            <span class="nv">request  : </span><span class="nx">request</span>
  85
+            <span class="nv">response : </span><span class="nx">response</span>
  86
+            <span class="nv">route    : </span><span class="nx">route</span><span class="p">.</span><span class="nx">index</span>
  87
+            <span class="nv">app      : </span><span class="k">this</span>
  88
+          <span class="p">})</span>
  89
+          <span class="k">try</span>        <span class="c1"># Execute the method in a sandbox</span>
  90
+            <span class="nv">hasRouted = </span><span class="nx">@callMethodForRoute</span><span class="p">(</span> <span class="nx">route</span><span class="p">,</span> <span class="nx">params</span><span class="p">,</span> <span class="nx">request</span><span class="p">.</span><span class="nx">application</span><span class="p">.</span><span class="nx">Controller</span> <span class="p">)</span> <span class="nx">unless</span> <span class="nx">hasRouted</span>
  91
+          <span class="k">catch</span> <span class="nx">error</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>@respondWithError response</p>             </td>             <td class="code">               <div class="highlight"><pre>            <span class="nx">response</span><span class="p">.</span><span class="nx">writeHead</span> <span class="mi">500</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="s">&#39;text/plain&#39;</span><span class="p">}</span>
  92
+            <span class="nx">response</span><span class="p">.</span><span class="nx">end</span> <span class="s">&#39;Testing: 500&#39;</span>
  93
+            <span class="nv">hasRouted = </span><span class="kc">true</span>
  94
+        
  95
+        <span class="k">if</span> <span class="nx">hasRouted</span>
  96
+          <span class="k">break</span>
  97
+
  98
+      <span class="nx">unless</span> <span class="nx">hasRouted</span>
  99
+        <span class="nx">response</span><span class="p">.</span><span class="nx">writeHead</span> <span class="mi">200</span><span class="p">,</span> <span class="p">{</span><span class="s">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="s">&#39;text/plain&#39;</span><span class="p">}</span>
  100
+        <span class="nx">response</span><span class="p">.</span><span class="nx">end</span> <span class="s">&#39;Testing: Not Found Page&#39;</span>
  101
+
  102
+<span class="nv">module.exports = </span><span class="nx">ArcaboucoRequest</span>
  103
+
  104
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
7  docs/arcabouco_template.html
... ...
@@ -0,0 +1,7 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>arcabouco_template.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               arcabouco_template.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">ArcaboucoTemplate</span>
  2
+  <span class="nv">output: </span><span class="o">-&gt;</span>
  3
+    <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s">&#39;Testing Template&#39;</span>
  4
+
  5
+<span class="nv">module.exports = </span><span class="nx">ArcaboucoTemplate</span>
  6
+
  7
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
18  docs/common.html
... ...
@@ -0,0 +1,18 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>common.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               common.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <pre><code>Arcabouco.JS
  2
+
  3
+(c) 2011 Patrick Negri, Yellers Software
  4
+Underscore is freely distributable under the MIT license.
  5
+For all details and documentation:
  6
+http://github.com/pnegri/arcabouco-js
  7
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h2>Common Modules</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Include a list of common used modules, keeping it all in one place</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common =</span>
  8
+  <span class="nv">Os   : </span><span class="nx">require</span> <span class="s">&#39;os&#39;</span>
  9
+  <span class="nv">Http : </span><span class="nx">require</span> <span class="s">&#39;http&#39;</span>
  10
+  <span class="nv">Fs   : </span><span class="nx">require</span> <span class="s">&#39;fs&#39;</span>
  11
+  <span class="nv">Path : </span><span class="nx">require</span> <span class="s">&#39;path&#39;</span>
  12
+  <span class="nv">Url  : </span><span class="nx">require</span> <span class="s">&#39;url&#39;</span>
  13
+  <span class="nv">Crypt: </span><span class="nx">require</span> <span class="s">&#39;crypto&#39;</span>
  14
+  <span class="nv">_    : </span><span class="nx">require</span> <span class="s">&#39;underscore&#39;</span>     <span class="c1"># Enable Underscore Library using Common._</span>
  15
+
  16
+<span class="nv">module.exports = </span><span class="nx">Common</span>
  17
+
  18
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
186  docs/docco.css
... ...
@@ -0,0 +1,186 @@
  1
+/*--------------------- Layout and Typography ----------------------------*/
  2
+body {
  3
+  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
  4
+  font-size: 15px;
  5
+  line-height: 22px;
  6
+  color: #252519;
  7
+  margin: 0; padding: 0;
  8
+}
  9
+a {
  10
+  color: #261a3b;
  11
+}
  12
+  a:visited {
  13
+    color: #261a3b;
  14
+  }
  15
+p {
  16
+  margin: 0 0 15px 0;
  17
+}
  18
+h1, h2, h3, h4, h5, h6 {
  19
+  margin: 0px 0 15px 0;
  20
+}
  21
+  h1 {
  22
+    margin-top: 40px;
  23
+  }
  24
+#container {
  25
+  position: relative;
  26
+}
  27
+#background {
  28
+  position: fixed;
  29
+  top: 0; left: 525px; right: 0; bottom: 0;
  30
+  background: #f5f5ff;
  31
+  border-left: 1px solid #e5e5ee;
  32
+  z-index: -1;
  33
+}
  34
+#jump_to, #jump_page {
  35
+  background: white;
  36
+  -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
  37
+  -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
  38
+  font: 10px Arial;
  39
+  text-transform: uppercase;
  40
+  cursor: pointer;
  41
+  text-align: right;
  42
+}
  43
+#jump_to, #jump_wrapper {
  44
+  position: fixed;
  45
+  right: 0; top: 0;
  46
+  padding: 5px 10px;
  47
+}
  48
+  #jump_wrapper {
  49
+    padding: 0;
  50
+    display: none;
  51
+  }
  52
+    #jump_to:hover #jump_wrapper {
  53
+      display: block;
  54
+    }
  55
+    #jump_page {
  56
+      padding: 5px 0 3px;
  57
+      margin: 0 0 25px 25px;
  58
+    }
  59
+      #jump_page .source {
  60
+        display: block;
  61
+        padding: 5px 10px;
  62
+        text-decoration: none;
  63
+        border-top: 1px solid #eee;
  64
+      }
  65
+        #jump_page .source:hover {
  66
+          background: #f5f5ff;
  67
+        }
  68
+        #jump_page .source:first-child {
  69
+        }
  70
+table td {
  71
+  border: 0;
  72
+  outline: 0;
  73
+}
  74
+  td.docs, th.docs {
  75
+    max-width: 450px;
  76
+    min-width: 450px;
  77
+    min-height: 5px;
  78
+    padding: 10px 25px 1px 50px;
  79
+    overflow-x: hidden;
  80
+    vertical-align: top;
  81
+    text-align: left;
  82
+  }
  83
+    .docs pre {
  84
+      margin: 15px 0 15px;
  85
+      padding-left: 15px;
  86
+    }
  87
+    .docs p tt, .docs p code {
  88
+      background: #f8f8ff;
  89
+      border: 1px solid #dedede;
  90
+      font-size: 12px;
  91
+      padding: 0 0.2em;
  92
+    }
  93
+    .pilwrap {
  94
+      position: relative;
  95
+    }
  96
+      .pilcrow {
  97
+        font: 12px Arial;
  98
+        text-decoration: none;
  99
+        color: #454545;
  100
+        position: absolute;
  101
+        top: 3px; left: -20px;
  102
+        padding: 1px 2px;
  103
+        opacity: 0;
  104
+        -webkit-transition: opacity 0.2s linear;
  105
+      }
  106
+        td.docs:hover .pilcrow {
  107
+          opacity: 1;
  108
+        }
  109
+  td.code, th.code {
  110
+    padding: 14px 15px 16px 25px;
  111
+    width: 100%;
  112
+    vertical-align: top;
  113
+    background: #f5f5ff;
  114
+    border-left: 1px solid #e5e5ee;
  115
+  }
  116
+    pre, tt, code {
  117
+      font-size: 12px; line-height: 18px;
  118
+      font-family: Monaco, Consolas, "Lucida Console", monospace;
  119
+      margin: 0; padding: 0;
  120
+    }
  121
+
  122
+
  123
+/*---------------------- Syntax Highlighting -----------------------------*/
  124
+td.linenos { background-color: #f0f0f0; padding-right: 10px; }
  125
+span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
  126
+body .hll { background-color: #ffffcc }
  127
+body .c { color: #408080; font-style: italic }  /* Comment */
  128
+body .err { border: 1px solid #FF0000 }         /* Error */
  129
+body .k { color: #954121 }                      /* Keyword */
  130
+body .o { color: #666666 }                      /* Operator */
  131
+body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
  132
+body .cp { color: #BC7A00 }                     /* Comment.Preproc */
  133
+body .c1 { color: #408080; font-style: italic } /* Comment.Single */
  134
+body .cs { color: #408080; font-style: italic } /* Comment.Special */
  135
+body .gd { color: #A00000 }                     /* Generic.Deleted */
  136
+body .ge { font-style: italic }                 /* Generic.Emph */
  137
+body .gr { color: #FF0000 }                     /* Generic.Error */
  138
+body .gh { color: #000080; font-weight: bold }  /* Generic.Heading */
  139
+body .gi { color: #00A000 }                     /* Generic.Inserted */
  140
+body .go { color: #808080 }                     /* Generic.Output */
  141
+body .gp { color: #000080; font-weight: bold }  /* Generic.Prompt */
  142
+body .gs { font-weight: bold }                  /* Generic.Strong */
  143
+body .gu { color: #800080; font-weight: bold }  /* Generic.Subheading */
  144
+body .gt { color: #0040D0 }                     /* Generic.Traceback */
  145
+body .kc { color: #954121 }                     /* Keyword.Constant */
  146
+body .kd { color: #954121; font-weight: bold }  /* Keyword.Declaration */
  147
+body .kn { color: #954121; font-weight: bold }  /* Keyword.Namespace */
  148
+body .kp { color: #954121 }                     /* Keyword.Pseudo */
  149
+body .kr { color: #954121; font-weight: bold }  /* Keyword.Reserved */
  150
+body .kt { color: #B00040 }                     /* Keyword.Type */
  151
+body .m { color: #666666 }                      /* Literal.Number */
  152
+body .s { color: #219161 }                      /* Literal.String */
  153
+body .na { color: #7D9029 }                     /* Name.Attribute */
  154
+body .nb { color: #954121 }                     /* Name.Builtin */
  155
+body .nc { color: #0000FF; font-weight: bold }  /* Name.Class */
  156
+body .no { color: #880000 }                     /* Name.Constant */
  157
+body .nd { color: #AA22FF }                     /* Name.Decorator */
  158
+body .ni { color: #999999; font-weight: bold }  /* Name.Entity */
  159
+body .ne { color: #D2413A; font-weight: bold }  /* Name.Exception */
  160
+body .nf { color: #0000FF }                     /* Name.Function */
  161
+body .nl { color: #A0A000 }                     /* Name.Label */
  162
+body .nn { color: #0000FF; font-weight: bold }  /* Name.Namespace */
  163
+body .nt { color: #954121; font-weight: bold }  /* Name.Tag */
  164
+body .nv { color: #19469D }                     /* Name.Variable */
  165
+body .ow { color: #AA22FF; font-weight: bold }  /* Operator.Word */
  166
+body .w { color: #bbbbbb }                      /* Text.Whitespace */
  167
+body .mf { color: #666666 }                     /* Literal.Number.Float */
  168
+body .mh { color: #666666 }                     /* Literal.Number.Hex */
  169
+body .mi { color: #666666 }                     /* Literal.Number.Integer */
  170
+body .mo { color: #666666 }                     /* Literal.Number.Oct */
  171
+body .sb { color: #219161 }                     /* Literal.String.Backtick */
  172
+body .sc { color: #219161 }                     /* Literal.String.Char */
  173
+body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
  174
+body .s2 { color: #219161 }                     /* Literal.String.Double */
  175
+body .se { color: #BB6622; font-weight: bold }  /* Literal.String.Escape */
  176
+body .sh { color: #219161 }                     /* Literal.String.Heredoc */
  177
+body .si { color: #BB6688; font-weight: bold }  /* Literal.String.Interpol */
  178
+body .sx { color: #954121 }                     /* Literal.String.Other */
  179
+body .sr { color: #BB6688 }                     /* Literal.String.Regex */
  180
+body .s1 { color: #219161 }                     /* Literal.String.Single */
  181
+body .ss { color: #19469D }                     /* Literal.String.Symbol */
  182
+body .bp { color: #954121 }                     /* Name.Builtin.Pseudo */
  183
+body .vc { color: #19469D }                     /* Name.Variable.Class */
  184
+body .vg { color: #19469D }                     /* Name.Variable.Global */
  185
+body .vi { color: #19469D }                     /* Name.Variable.Instance */
  186
+body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
329  docs/old_arcabouco.html
... ...
@@ -0,0 +1,329 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>old_arcabouco.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               old_arcabouco.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/common&#39;</span>
  2
+<span class="nv">Underscore = </span><span class="nx">require</span> <span class="s">&#39;underscore&#39;</span>
  3
+<span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/_monkey-patching&#39;</span>
  4
+<span class="p">{</span><span class="nx">spawn</span><span class="p">,</span> <span class="nx">exec</span><span class="p">}</span>  <span class="o">=</span> <span class="nx">require</span> <span class="s">&#39;child_process&#39;</span>
  5
+
  6
+<span class="nv">Template = </span><span class="nx">require</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/template&#39;</span>
  7
+
  8
+<span class="k">class</span> <span class="nx">PublicExposer</span>
  9
+  <span class="nv">piecesArray         : </span><span class="p">[]</span>
  10
+
  11
+  <span class="nv">addPiece: </span><span class="nf">( pieceFilename, options ) -&gt;</span>
  12
+    <span class="nv">priority = </span><span class="mi">0</span>
  13
+    <span class="nv">priority = </span><span class="nx">options</span><span class="p">.</span><span class="nx">priority</span> <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">priority</span>
  14
+
  15
+    <span class="nx">@piecesArray</span><span class="p">.</span><span class="nx">push</span>
  16
+      <span class="nv">filename: </span><span class="nx">pieceFilename</span>
  17
+      <span class="nv">priority: </span><span class="nx">priority</span>
  18
+
  19
+  <span class="nv">build: </span><span class="nf">(application, development=false) -&gt;</span>
  20
+
  21
+    <span class="nv">piecesByPriority = </span><span class="nx">Underscore</span><span class="p">.</span><span class="nx">sortBy</span> <span class="nx">@piecesArray</span><span class="p">,</span>
  22
+      <span class="nf">( obj ) -&gt;</span>
  23
+        <span class="k">return</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">priority</span>
  24
+
  25
+    <span class="nv">outputDir = </span><span class="nx">application</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">baseDirectory</span> <span class="o">+</span> <span class="s">&#39;/cdn/js&#39;</span>
  26
+
  27
+    <span class="nv">c = </span><span class="mi">0</span>
  28
+    <span class="k">for</span> <span class="nx">pieceDetails</span> <span class="k">in</span> <span class="nx">piecesByPriority</span>
  29
+      <span class="nv">pieceFilename = </span><span class="nx">pieceDetails</span><span class="p">.</span><span class="nx">filename</span>
  30
+      
  31
+      <span class="nv">baseFilename = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">basename</span><span class="p">(</span> <span class="nx">pieceFilename</span><span class="p">,</span> <span class="s">&#39;.coffee&#39;</span> <span class="p">)</span> <span class="o">+</span> <span class="s">&#39;-&#39;</span> <span class="o">+</span> <span class="nx">c</span>
  32
+
  33
+      <span class="nx">exec</span> <span class="s">&quot;coffee --compile -p </span><span class="si">#{</span><span class="nx">pieceFilename</span><span class="si">}</span><span class="s"> &gt; </span><span class="si">#{</span><span class="nx">outputDir</span><span class="si">}</span><span class="s">/</span><span class="si">#{</span><span class="nx">baseFilename</span><span class="si">}</span><span class="s">.js&quot;</span>
  34
+
  35
+      <span class="nx">application</span><span class="p">.</span><span class="nx">ContentGenerator</span><span class="p">.</span><span class="nx">addContentFor</span> <span class="s">&#39;head&#39;</span><span class="p">,</span>
  36
+        <span class="s">&quot;&lt;script src=\&quot;/cdn/js/</span><span class="si">#{</span><span class="nx">baseFilename</span><span class="si">}</span><span class="s">.js\&quot;&gt;&lt;/script&gt;&quot;</span><span class="p">,</span> <span class="p">{</span> <span class="nv">priority: </span><span class="nx">pieceDetails</span><span class="p">.</span><span class="nx">priority</span> <span class="p">}</span>
  37
+
  38
+      <span class="nv">c = </span><span class="nx">c</span><span class="o">+</span><span class="mi">1</span>
  39
+
  40
+
  41
+<span class="k">class</span> <span class="nx">ContentGenerator</span>
  42
+  <span class="nv">contentArray        : </span><span class="p">[]</span>
  43
+
  44
+  <span class="nv">ensureArray: </span><span class="nf">( where, group ) -&gt;</span>
  45
+    <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> <span class="nx">unless</span> <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">]</span>
  46
+    <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">][</span> <span class="nx">where</span> <span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> <span class="nx">unless</span> <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">][</span> <span class="nx">where</span> <span class="p">]</span>
  47
+    <span class="kc">true</span>
  48
+
  49
+  <span class="nv">addContentFor: </span><span class="nf">( where, data, options = { group: &#39;default&#39; } ) -&gt;</span>
  50
+    <span class="nv">priority = </span><span class="mi">0</span>
  51
+    <span class="nv">priority = </span><span class="nx">options</span><span class="p">.</span><span class="nx">priority</span> <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">priority</span>
  52
+
  53
+    <span class="nv">group = </span><span class="s">&#39;default&#39;</span>
  54
+    <span class="nv">group = </span><span class="nx">options</span><span class="p">.</span><span class="nx">group</span> <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">group</span>
  55
+
  56
+    <span class="nx">@ensureArray</span><span class="p">(</span> <span class="nx">where</span><span class="p">,</span> <span class="nx">group</span> <span class="p">)</span>
  57
+
  58
+    <span class="nv">type = </span><span class="s">&#39;plain&#39;</span>
  59
+    <span class="nv">type = </span><span class="s">&#39;function&#39;</span> <span class="k">if</span> <span class="k">typeof</span> <span class="nx">data</span> <span class="o">==</span> <span class="s">&#39;function&#39;</span>
  60
+
  61
+    <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">][</span> <span class="nx">where</span> <span class="p">].</span><span class="nx">push</span>
  62
+      <span class="s">&#39;type&#39;</span><span class="o">:</span> <span class="nx">type</span>
  63
+      <span class="nv">data: </span><span class="nx">data</span>
  64
+      <span class="nv">priority: </span><span class="nx">priority</span>
  65
+
  66
+  <span class="nv">getContentFor: </span><span class="nf">( where, options = { group: &#39;default&#39; } ) -&gt;</span>
  67
+    <span class="nv">group = </span><span class="nx">options</span><span class="p">.</span><span class="nx">group</span>
  68
+
  69
+    <span class="nx">@ensureArray</span><span class="p">(</span> <span class="nx">where</span><span class="p">,</span> <span class="nx">group</span> <span class="p">)</span>
  70
+
  71
+    <span class="nv">content = </span><span class="s">&#39;&#39;</span>
  72
+    <span class="nv">priorityArray = </span><span class="nx">Underscore</span><span class="p">.</span><span class="nx">sortBy</span> <span class="nx">@contentArray</span><span class="p">[</span> <span class="nx">group</span> <span class="p">][</span> <span class="nx">where</span> <span class="p">],</span>
  73
+      <span class="nf">( obj ) -&gt;</span>
  74
+        <span class="k">return</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">priority</span>
  75
+
  76
+    <span class="k">for</span> <span class="nx">aContent</span> <span class="k">in</span> <span class="nx">priorityArray</span>
  77
+      <span class="nv">output = </span><span class="s">&#39;&#39;</span>
  78
+      <span class="k">if</span> <span class="nx">aContent</span><span class="p">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s">&#39;plain&#39;</span>
  79
+        <span class="nv">output = </span><span class="nx">aContent</span><span class="p">.</span><span class="nx">data</span>
  80
+      <span class="k">else</span>
  81
+        <span class="nv">output = </span><span class="nx">aContent</span><span class="p">.</span><span class="nx">data</span><span class="p">()</span>
  82
+      <span class="nx">content</span> <span class="o">+=</span> <span class="nx">output</span>
  83
+    <span class="nx">content</span>
  84
+
  85
+<span class="k">class</span> <span class="nx">Arcabouco</span>
  86
+  <span class="nv">config              : </span><span class="p">{}</span>
  87
+
  88
+  <span class="nv">Template            : </span><span class="kc">false</span>
  89
+  <span class="nv">ContentGenerator    : </span><span class="kc">false</span>
  90
+  <span class="nv">PublicExposer       : </span><span class="kc">false</span>
  91
+
  92
+  <span class="nv">newRoutingAvaiable  : </span><span class="kc">false</span>
  93
+  <span class="nv">controllerInstances : </span><span class="p">[]</span>
  94
+  <span class="nv">routeToMethod       : </span><span class="p">[]</span>
  95
+  <span class="nv">avaiableRoutes      : </span><span class="p">[]</span>
  96
+
  97
+  <span class="nv">_requestsCounter    : </span><span class="mi">0</span>
  98
+  <span class="nv">_requestsPolling    : </span><span class="mi">0</span>
  99
+  <span class="nv">requestsPerSecond   : </span><span class="mi">0</span>
  100
+  <span class="nv">_lastCPU            : </span><span class="p">{</span>
  101
+    <span class="nv">user: </span><span class="mi">0</span>
  102
+    <span class="nv">idle: </span><span class="mi">0</span>
  103
+    <span class="nv">sys: </span><span class="mi">0</span>
  104
+    <span class="nv">irq: </span><span class="mi">0</span>
  105
+    <span class="nv">nice: </span><span class="mi">0</span>
  106
+  <span class="p">}</span>
  107
+
  108
+  <span class="nv">constructor         : </span><span class="nf">( @config ) -&gt;</span>
  109
+    <span class="nx">unless</span> <span class="nx">@config</span><span class="p">.</span><span class="nx">baseDirectory</span>
  110
+      <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s">&#39;Configuration doesnt have baseDirectory directive&#39;</span>
  111
+      <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  112
+
  113
+    <span class="nv">global.objects = </span><span class="p">[]</span>
  114
+    <span class="nv">global.public_exports = </span><span class="p">[]</span>
  115
+
  116
+    <span class="vi">@Template = </span><span class="k">new</span> <span class="nx">Template</span><span class="p">()</span>
  117
+    <span class="vi">@ContentGenerator = </span><span class="k">new</span> <span class="nx">ContentGenerator</span><span class="p">()</span>
  118
+    <span class="vi">@PublicExposer = </span><span class="k">new</span> <span class="nx">PublicExposer</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>@content_for = @ContentGenerator.getContentFor</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">@Template</span><span class="p">.</span><span class="nx">loadTemplate</span> <span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">normalize</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/../templates/404.haml&#39;</span><span class="p">),</span> <span class="s">&#39;404&#39;</span>
  119
+    <span class="nx">@Template</span><span class="p">.</span><span class="nx">loadTemplate</span> <span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">normalize</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/../templates/500.haml&#39;</span><span class="p">),</span> <span class="s">&#39;500&#39;</span>
  120
+
  121
+    <span class="nx">setInterval</span> <span class="o">=&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>TODO: SEPARATE THIS INTO A CLASS</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="vi">@requestsPerSecond = </span><span class="nx">@_requestsCounter</span>
  122
+      <span class="vi">@_requestsCounter = </span><span class="mi">0</span>
  123
+      <span class="nv">totalMemory = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Os</span><span class="p">.</span><span class="nx">totalmem</span><span class="p">()</span>
  124
+      <span class="nv">freeMemory = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Os</span><span class="p">.</span><span class="nx">freemem</span><span class="p">()</span>
  125
+      <span class="nv">loadAverage = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Os</span><span class="p">.</span><span class="nx">loadavg</span><span class="p">()</span>
  126
+
  127
+      <span class="nv">cpus = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Os</span><span class="p">.</span><span class="nx">cpus</span><span class="p">()</span>
  128
+      <span class="nv">user = </span><span class="mi">0</span>
  129
+      <span class="nv">nice = </span><span class="mi">0</span>
  130
+      <span class="nv">sys = </span><span class="mi">0</span>
  131
+      <span class="nv">idle = </span><span class="mi">0</span>
  132
+      <span class="nv">irq = </span><span class="mi">0</span>
  133
+      <span class="k">for</span> <span class="nx">cpu</span> <span class="k">in</span> <span class="nx">cpus</span>
  134
+        <span class="nx">user</span> <span class="o">+=</span> <span class="nx">cpu</span><span class="p">.</span><span class="nx">times</span><span class="p">.</span><span class="nx">user</span>
  135
+        <span class="nx">nice</span> <span class="o">+=</span> <span class="nx">cpu</span><span class="p">.</span><span class="nx">times</span><span class="p">.</span><span class="nx">nice</span>
  136
+        <span class="nx">sys</span> <span class="o">+=</span> <span class="nx">cpu</span><span class="p">.</span><span class="nx">times</span><span class="p">.</span><span class="nx">sys</span>
  137
+        <span class="nx">idle</span> <span class="o">+=</span> <span class="nx">cpu</span><span class="p">.</span><span class="nx">times</span><span class="p">.</span><span class="nx">idle</span>
  138
+        <span class="nx">irq</span> <span class="o">+=</span> <span class="nx">cpu</span><span class="p">.</span><span class="nx">times</span><span class="p">.</span><span class="nx">irq</span>
  139
+      <span class="nv">total = </span><span class="nx">user</span><span class="o">+</span><span class="nx">nice</span><span class="o">+</span><span class="nx">sys</span><span class="o">+</span><span class="nx">idle</span><span class="o">+</span><span class="nx">irq</span>
  140
+
  141
+      <span class="nv">current_user = </span><span class="nx">user</span><span class="o">-</span><span class="nx">@_lastCPU</span><span class="p">.</span><span class="nx">user</span>
  142
+      <span class="nv">current_nice = </span><span class="nx">nice</span><span class="o">-</span><span class="nx">@_lastCPU</span><span class="p">.</span><span class="nx">nice</span>
  143
+      <span class="nv">current_sys = </span><span class="nx">sys</span><span class="o">-</span><span class="nx">@_lastCPU</span><span class="p">.</span><span class="nx">sys</span>
  144
+      <span class="nv">current_idle = </span><span class="nx">idle</span><span class="o">-</span><span class="nx">@_lastCPU</span><span class="p">.</span><span class="nx">idle</span>
  145
+      <span class="nv">current_irq = </span><span class="nx">irq</span><span class="o">-</span><span class="nx">@_lastCPU</span><span class="p">.</span><span class="nx">irq</span>
  146
+      <span class="nv">current_total = </span><span class="nx">current_user</span><span class="o">+</span><span class="nx">current_nice</span><span class="o">+</span><span class="nx">current_sys</span><span class="o">+</span><span class="nx">current_idle</span><span class="o">+</span><span class="nx">current_irq</span>
  147
+
  148
+      <span class="vi">@_lastCPU.user = </span><span class="nx">user</span>
  149
+      <span class="vi">@_lastCPU.nice = </span><span class="nx">nice</span>
  150
+      <span class="vi">@_lastCPU.sys = </span><span class="nx">sys</span>
  151
+      <span class="vi">@_lastCPU.idle = </span><span class="nx">idle</span>
  152
+      <span class="vi">@_lastCPU.irq = </span><span class="nx">irq</span>
  153
+      <span class="vi">@_lastCPU.total = </span><span class="nx">user</span><span class="o">+</span><span class="nx">nice</span><span class="o">+</span><span class="nx">sys</span><span class="o">+</span><span class="nx">idle</span><span class="o">+</span><span class="nx">irq</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <pre><code> console.log (current_user+current_nice+current_sys+current_irq) / current_total
  154
+ console.log current_idle / current_total
  155
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="p">,</span> <span class="mi">1000</span>
  156
+
  157
+  <span class="nv">addRoutingToMethod : </span><span class="nf">( path, method, indexOfController ) -&gt;</span>
  158
+    <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">path</span> <span class="p">]</span> <span class="o">=</span>
  159
+      <span class="s">&#39;method&#39;</span> <span class="o">:</span> <span class="nx">method</span>
  160
+      <span class="s">&#39;object&#39;</span> <span class="o">:</span> <span class="nx">indexOfController</span>
  161
+    <span class="vi">@newRoutingAvaiable = </span><span class="kc">true</span>
  162
+    <span class="nx">path</span>
  163
+
  164
+  <span class="nv">parseControllerRoutes : </span><span class="nf">( indexOfController ) -&gt;</span>
  165
+    <span class="nv">ControllerObject = </span><span class="nx">@controllerInstances</span><span class="p">[</span> <span class="nx">indexOfController</span> <span class="p">]</span>
  166
+    <span class="nx">unless</span> <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">getRoutes</span>
  167
+      <span class="k">return</span> <span class="kc">false</span>
  168
+
  169
+    <span class="nv">controllerRoutes = </span><span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">getRoutes</span><span class="p">()</span>
  170
+    <span class="k">for</span> <span class="nx">path</span> <span class="k">of</span> <span class="nx">controllerRoutes</span>
  171
+      <span class="nx">@addRoutingToMethod</span> <span class="nx">path</span><span class="p">,</span> <span class="nx">controllerRoutes</span><span class="p">[</span> <span class="nx">path</span> <span class="p">],</span> <span class="nx">indexOfController</span>
  172
+  
  173
+  <span class="nv">loadController      : </span><span class="nf">( controllerFilename ) -&gt;</span>
  174
+    <span class="nx">unless</span> <span class="nx">controllerFilename</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="sr">/\.js$/gi</span><span class="p">)</span>
  175
+      <span class="kc">false</span>
  176
+
  177
+    <span class="k">if</span> <span class="nx">controllerFilename</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span>
  178
+      <span class="nv">controllerFilename = </span><span class="nx">@config</span><span class="p">.</span><span class="nx">baseDirectory</span> <span class="o">+</span> <span class="nx">controllerFilename</span><span class="p">.</span><span class="nx">substring</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
  179
+
  180
+    <span class="nv">ControllerObject = </span><span class="k">new</span> <span class="p">(</span><span class="nx">require</span> <span class="nx">controllerFilename</span><span class="p">)()</span>
  181
+    <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span><span class="p">(</span> <span class="k">this</span> <span class="p">)</span> <span class="k">if</span> <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span>
  182
+    <span class="nx">@parseControllerRoutes</span> <span class="nx">@controllerInstances</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">ControllerObject</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
  183
+
  184
+  <span class="nv">work: </span><span class="nf">( ControllerObject ) -&gt;</span>
  185
+
  186
+    <span class="nv">instanceClass = </span><span class="k">new</span> <span class="nx">ControllerObject</span><span class="p">()</span>
  187
+    <span class="k">if</span> <span class="nx">instanceClass</span><span class="p">.</span><span class="nx">bootstrap</span> <span class="o">or</span> <span class="nx">instanceClass</span><span class="p">.</span><span class="nx">getRoutes</span>
  188
+      <span class="nv">ControllerObject = </span><span class="nx">instanceClass</span>
  189
+   
  190
+    <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span><span class="p">(</span> <span class="k">this</span> <span class="p">)</span> <span class="k">if</span> <span class="nx">ControllerObject</span><span class="p">.</span><span class="nx">bootstrap</span>
  191
+    <span class="nx">@parseControllerRoutes</span> <span class="nx">@controllerInstances</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">ControllerObject</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
  192
+
  193
+  <span class="nv">assemble: </span><span class="nf">( directory ) -&gt;</span>
  194
+    <span class="nv">fullPath = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">normalize</span><span class="p">(</span> <span class="nx">directory</span> <span class="p">)</span>
  195
+    <span class="k">if</span> <span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">existsSync</span><span class="p">(</span> <span class="nx">fullPath</span> <span class="p">)</span>
  196
+      <span class="nv">files = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Fs</span><span class="p">.</span><span class="nx">readdirSyncR</span><span class="p">(</span> <span class="nx">fullPath</span> <span class="p">)</span>
  197
+      <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span>
  198
+        <span class="nv">valid = </span><span class="kc">false</span>
  199
+        <span class="k">if</span> <span class="nx">file</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/\.js/gi</span>
  200
+          <span class="nv">valid = </span><span class="kc">true</span>
  201
+        <span class="k">if</span> <span class="nx">file</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/\.coffee/gi</span>
  202
+          <span class="nv">valid = </span><span class="kc">true</span>
  203
+        <span class="k">if</span> <span class="nx">file</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/src\//gi</span>
  204
+          <span class="nv">valid = </span><span class="kc">false</span>
  205
+        <span class="k">if</span> <span class="nx">file</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/\.swp/gi</span>
  206
+          <span class="nv">valid = </span><span class="kc">false</span>
  207
+        <span class="k">if</span> <span class="nx">valid</span>
  208
+          <span class="nx">@work</span> <span class="nx">require</span> <span class="nx">file</span>
  209
+
  210
+  <span class="nv">registerObject : </span><span class="nf">( objectName, object ) -&gt;</span>
  211
+    <span class="nx">global</span><span class="p">.</span><span class="nx">objects</span><span class="p">[</span> <span class="nx">objectName</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">object</span>
  212
+    <span class="kc">true</span>
  213
+
  214
+  <span class="nv">buildObject: </span><span class="nf">(objectName) -&gt;</span>
  215
+    <span class="k">new</span> <span class="p">(</span><span class="nx">global</span><span class="p">.</span><span class="nx">objects</span><span class="p">[</span> <span class="nx">objectName</span> <span class="p">])</span>
  216
+
  217
+  <span class="nv">getRawObjects: </span><span class="nf">() -&gt;</span>
  218
+    <span class="nx">global</span><span class="p">.</span><span class="nx">objects</span>
  219
+
  220
+  <span class="nv">contructRoutingForPattern : </span><span class="nf">( pattern ) -&gt;</span>
  221
+    <span class="nv">params = </span><span class="p">[]</span>
  222
+    <span class="nv">buildPattern = </span><span class="nx">pattern</span><span class="p">.</span><span class="nx">replace</span> <span class="sr">/\{(.*?)\}/g</span><span class="p">,</span>
  223
+      <span class="nf">( match, sub1 ) -&gt;</span>
  224
+        <span class="nx">params</span><span class="p">.</span><span class="nx">push</span> <span class="nx">sub1</span>
  225
+        <span class="k">return</span> <span class="s">&#39;([^\/]+)&#39;</span>
  226
+    <span class="nv">buildPattern = </span><span class="nx">buildPattern</span><span class="p">.</span><span class="nx">replaceLast</span><span class="p">(</span> <span class="s">&#39;([^\/]+)&#39;</span><span class="p">,</span> <span class="s">&#39;([^$]+)&#39;</span> <span class="p">)</span>
  227
+    <span class="nv">constructedRoute =</span>
  228
+      <span class="nv">regex : </span><span class="k">new</span> <span class="nb">RegExp</span> <span class="s">&#39;^&#39;</span> <span class="o">+</span> <span class="nx">buildPattern</span> <span class="o">+</span> <span class="s">&#39;$&#39;</span>
  229
+      <span class="nv">params: </span><span class="nx">params</span>
  230
+      <span class="nv">index : </span><span class="nx">pattern</span>
  231
+
  232
+  <span class="nv">buildRouting : </span><span class="o">-&gt;</span>
  233
+    <span class="nv">orderedRouteNames = </span><span class="nx">Underscore</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span> <span class="nx">@routeToMethod</span> <span class="p">).</span><span class="nx">sort</span><span class="p">().</span><span class="nx">reverse</span><span class="p">()</span>
  234
+    <span class="vi">@avaiableRoutes = </span><span class="p">[]</span>
  235
+    <span class="k">for</span> <span class="nx">pattern</span> <span class="k">in</span> <span class="nx">orderedRouteNames</span>
  236
+      <span class="nx">@avaiableRoutes</span><span class="p">.</span><span class="nx">push</span> <span class="nx">@contructRoutingForPattern</span><span class="p">(</span> <span class="nx">pattern</span> <span class="p">)</span>
  237
+
  238
+  <span class="nv">build: </span><span class="o">-&gt;</span>
  239
+    <span class="nx">@buildRouting</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>TODO => development = true???</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">@PublicExposer</span><span class="p">.</span><span class="nx">build</span><span class="p">(</span> <span class="k">this</span><span class="p">,</span> <span class="kc">true</span> <span class="p">)</span>
  240
+
  241
+  <span class="nv">parseRequest : </span><span class="nf">( request ) -&gt;</span>
  242
+    <span class="nx">request</span><span class="p">.</span><span class="nx">setEncoding</span> <span class="s">&#39;utf-8&#39;</span>
  243
+    <span class="nv">url = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Url</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">request</span><span class="p">.</span><span class="nx">url</span><span class="p">,</span> <span class="kc">true</span>
  244
+    <span class="nv">request.documentRequested = </span><span class="nx">url</span><span class="p">.</span><span class="nx">pathname</span>
  245
+    <span class="nv">request.query = </span><span class="nx">url</span><span class="p">.</span><span class="nx">query</span>
  246
+
  247
+  <span class="nv">parseLocaleFromRequest : </span><span class="nf">( request ) -&gt;</span>
  248
+    <span class="nv">language = </span><span class="s">&#39;en&#39;</span>
  249
+    <span class="k">if</span> <span class="nx">@config</span><span class="p">.</span><span class="nx">defaultLocale</span>
  250
+      <span class="nv">language = </span><span class="nx">@config</span><span class="p">.</span><span class="nx">defaultLocale</span>
  251
+    <span class="k">if</span> <span class="nx">request</span><span class="p">.</span><span class="nx">documentRequested</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/^\/(([a-z]{1,2})(\-[a-z]{1,2})?)($|\/)/ig</span>
  252
+      <span class="nv">requestedLocale = </span><span class="nb">RegExp</span><span class="p">.</span><span class="nx">$1</span>
  253
+      <span class="nv">request.documentRequested = </span><span class="nx">request</span><span class="p">.</span><span class="nx">documentRequested</span><span class="p">.</span><span class="nx">replace</span> <span class="s">&#39;/&#39;</span> <span class="o">+</span> <span class="nx">requestedLocale</span><span class="p">,</span> <span class="s">&#39;&#39;</span>
  254
+    <span class="nv">request.documentRequested = </span><span class="s">&#39;/&#39;</span> <span class="k">if</span> <span class="nx">request</span><span class="p">.</span><span class="nx">documentRequested</span> <span class="o">==</span> <span class="s">&#39;&#39;</span>
  255
+    <span class="nv">request.documentLocale = </span><span class="nx">language</span>
  256
+
  257
+  <span class="nv">buildParamsForRequest: </span><span class="nf">( route, args, otherParams ) -&gt;</span>
  258
+    <span class="nv">params = </span><span class="p">{}</span>
  259
+    <span class="k">for</span> <span class="nx">index</span> <span class="k">of</span> <span class="nx">route</span><span class="p">.</span><span class="nx">params</span>
  260
+      <span class="nx">params</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">params</span><span class="p">[</span> <span class="nx">index</span> <span class="p">]</span> <span class="p">]</span> <span class="o">=</span> <span class="nx">args</span><span class="p">[</span> <span class="nb">parseInt</span><span class="p">(</span><span class="nx">index</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span> <span class="p">]</span>
  261
+    <span class="nx">Underscore</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span> <span class="nx">params</span><span class="p">,</span> <span class="nx">otherParams</span> <span class="p">)</span>
  262
+    <span class="nx">params</span>
  263
+
  264
+  <span class="nv">callMethodForRoute : </span><span class="nf">( route, params ) -&gt;</span>
  265
+    <span class="k">if</span> <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">]</span>
  266
+      <span class="nv">ControllerIndex = </span><span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">].</span><span class="nx">object</span>
  267
+      <span class="nv">ControllerObject = </span><span class="nx">@controllerInstances</span><span class="p">[</span> <span class="nx">ControllerIndex</span> <span class="p">]</span>
  268
+      <span class="nx">ControllerObject</span><span class="p">[</span> <span class="nx">@routeToMethod</span><span class="p">[</span> <span class="nx">route</span><span class="p">.</span><span class="nx">index</span> <span class="p">].</span><span class="nx">method</span> <span class="p">](</span> <span class="nx">params</span> <span class="p">)</span>
  269
+    <span class="k">else</span>
  270
+      <span class="kc">false</span>
  271
+
  272
+  <span class="nv">respondWithError : </span><span class="nf">( respond ) -&gt;</span>
  273
+    <span class="nx">respond</span><span class="p">.</span><span class="nx">respondWith</span> <span class="nx">@Template</span><span class="p">.</span><span class="nx">doRender</span><span class="p">(</span> <span class="s">&#39;500&#39;</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="p">{},</span> <span class="kc">false</span> <span class="p">),</span> <span class="mi">500</span>
  274
+
  275
+  <span class="nv">respondWithTimeout: </span><span class="nf">( respond ) -&gt;</span>
  276
+    <span class="nx">respond</span><span class="p">.</span><span class="nx">respondWith</span> <span class="nx">@Template</span><span class="p">.</span><span class="nx">doRender</span><span class="p">(</span> <span class="s">&#39;500&#39;</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="p">{},</span> <span class="kc">false</span><span class="p">),</span> <span class="mi">504</span>
  277
+
  278
+  <span class="nv">respondWithNotFound: </span><span class="nf">( respond ) -&gt;</span>
  279
+    <span class="nx">respond</span><span class="p">.</span><span class="nx">respondWith</span> <span class="nx">@Template</span><span class="p">.</span><span class="nx">doRender</span><span class="p">(</span> <span class="s">&#39;404&#39;</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span> <span class="p">{},</span> <span class="kc">false</span> <span class="p">),</span> <span class="mi">404</span><span class="p">,</span> <span class="mi">300</span>
  280
+
  281
+  <span class="nv">dispatchRequest : </span><span class="nf">( request, response ) -&gt;</span>
  282
+    <span class="nx">@parseRequest</span><span class="p">(</span> <span class="nx">request</span> <span class="p">)</span>
  283
+    <span class="nx">@parseLocaleFromRequest</span><span class="p">(</span> <span class="nx">request</span> <span class="p">)</span>
  284
+
  285
+    <span class="nv">data = </span><span class="s">&#39;&#39;</span>
  286
+    <span class="nx">request</span><span class="p">.</span><span class="nx">addListener</span> <span class="s">&#39;data&#39;</span><span class="p">,</span> <span class="p">(</span> <span class="nx">data_chunk</span> <span class="p">)</span> <span class="o">=&gt;</span>
  287
+      <span class="nx">data</span> <span class="o">+=</span> <span class="nx">data_chunk</span>
  288
+
  289
+    <span class="nx">request</span><span class="p">.</span><span class="nx">addListener</span> <span class="s">&#39;end&#39;</span><span class="p">,</span> <span class="o">=&gt;</span>
  290
+      <span class="vi">@_requestsCounter = </span><span class="nx">@_requestsCounter</span><span class="o">+</span><span class="mi">1</span>
  291
+      <span class="nv">hasRouted = </span><span class="kc">false</span>
  292
+
  293
+      <span class="k">for</span> <span class="nx">route</span> <span class="k">in</span> <span class="nx">@avaiableRoutes</span>
  294
+        <span class="nv">routeMatches = </span><span class="nx">route</span><span class="p">.</span><span class="nx">regex</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span> <span class="nx">request</span><span class="p">.</span><span class="nx">documentRequested</span> <span class="p">)</span>
  295
+        <span class="k">if</span> <span class="nx">routeMatches</span>
  296
+          <span class="nv">params = </span><span class="nx">@buildParamsForRequest</span><span class="p">(</span> <span class="nx">route</span><span class="p">,</span> <span class="nx">routeMatches</span><span class="p">,</span> <span class="p">{</span>
  297
+            <span class="nv">request  : </span><span class="nx">request</span>
  298
+            <span class="nv">response : </span><span class="nx">response</span>
  299
+            <span class="nv">route    : </span><span class="nx">route</span><span class="p">.</span><span class="nx">index</span>
  300
+            <span class="nv">app      : </span><span class="k">this</span>
  301
+          <span class="p">})</span>
  302
+          <span class="k">try</span>        <span class="c1"># Execute the method in a sandbox</span>
  303
+            <span class="nv">hasRouted = </span><span class="nx">@callMethodForRoute</span><span class="p">(</span> <span class="nx">route</span><span class="p">,</span> <span class="nx">params</span> <span class="p">)</span> <span class="nx">unless</span> <span class="nx">hasRouted</span>
  304
+          <span class="k">catch</span> <span class="nx">error</span>
  305
+            <span class="nx">@respondWithError</span> <span class="nx">response</span>
  306
+            <span class="nv">hasRouted = </span><span class="kc">true</span>
  307
+        
  308
+        <span class="k">if</span> <span class="nx">hasRouted</span>
  309
+          <span class="k">break</span>
  310
+
  311
+      <span class="nx">unless</span> <span class="nx">hasRouted</span>
  312
+        <span class="nx">@respondWithNotFound</span> <span class="nx">response</span>
  313
+
  314
+  <span class="nv">createServer : </span><span class="o">-&gt;</span>
  315
+    <span class="nx">Common</span><span class="p">.</span><span class="nx">Http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="nx">@dispatchRequest</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span> <span class="k">this</span> <span class="p">)</span> <span class="p">)</span>
  316
+
  317
+  <span class="nv">createSecureServer: </span><span class="nf">( privateKey, certificate ) -&gt;</span>
  318
+    <span class="nv">crypto = </span><span class="nx">require</span> <span class="s">&#39;crypto&#39;</span>
  319
+    <span class="nv">credentials = </span><span class="nx">crypto</span><span class="p">.</span><span class="nx">createCredentials</span> <span class="p">{</span>
  320
+      <span class="nv">key: </span><span class="nx">privateKey</span>
  321
+      <span class="nv">cert: </span><span class="nx">certificate</span>
  322
+    <span class="p">}</span>
  323
+    <span class="nv">secureServer = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Http</span><span class="p">.</span><span class="nx">createServer</span><span class="p">(</span> <span class="nx">@dispatchRequest</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="k">this</span><span class="p">)</span> <span class="p">)</span>
  324
+    <span class="nx">secureServer</span><span class="p">.</span><span class="nx">setSecure</span><span class="p">(</span> <span class="nx">credentials</span> <span class="p">)</span>
  325
+    <span class="nx">secureServer</span>
  326
+
  327
+<span class="nv">module.exports = </span><span class="nx">Arcabouco</span>
  328
+
  329
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
54  docs/template.html
... ...
@@ -0,0 +1,54 @@
  1
+<!DOCTYPE html>  <html> <head>   <title>template.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="_monkey-fs.html">                 _monkey-fs.coffee               </a>                                           <a class="source" href="_monkey-patching.html">                 _monkey-patching.coffee               </a>                                           <a class="source" href="arcabouco.html">                 arcabouco.coffee               </a>                                           <a class="source" href="arcabouco_content.html">                 arcabouco_content.coffee               </a>                                           <a class="source" href="arcabouco_controller.html">                 arcabouco_controller.coffee               </a>                                           <a class="source" href="arcabouco_object_pool.html">                 arcabouco_object_pool.coffee               </a>                                           <a class="source" href="arcabouco_request.html">                 arcabouco_request.coffee               </a>                                           <a class="source" href="arcabouco_template.html">                 arcabouco_template.coffee               </a>                                           <a class="source" href="common.html">                 common.coffee               </a>                                           <a class="source" href="old_arcabouco.html">                 old_arcabouco.coffee               </a>                                           <a class="source" href="template.html">                 template.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               template.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="nv">Common = </span><span class="nx">require</span> <span class="s">&#39;./common&#39;</span>
  2
+<span class="nv">Haml = </span><span class="nx">require</span> <span class="s">&#39;haml&#39;</span>
  3
+
  4
+<span class="k">class</span> <span class="nx">Template</span>
  5
+  <span class="nv">loadedTemplates : </span><span class="p">[]</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h1>TODO: Search for Template</h1>
  6
+
  7
+<h1>TODO: Modulize template for support multiple files</h1>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">getTemplate: </span><span class="nf">( templateFile ) -&gt;</span>
  8
+    <span class="nv">templateFile = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">basename</span> <span class="nx">templateFile</span>
  9
+    <span class="nx">unless</span> <span class="nx">@loadedTemplates</span><span class="p">[</span> <span class="nx">templateFile</span> <span class="p">]</span>
  10
+      <span class="k">return</span> <span class="kc">false</span>
  11
+    <span class="nx">@loadedTemplates</span><span class="p">[</span> <span class="nx">templateFile</span> <span class="p">]</span>
  12
+
  13
+  <span class="nv">loadTemplate: </span><span class="nf">( templateFile, asTemplateName=&quot;&quot; ) -&gt;</span>
  14
+    <span class="nx">unless</span> <span class="nx">templateFile</span>
  15
+      <span class="k">return</span> <span class="kc">false</span>
  16
+    <span class="nx">unless</span> <span class="nx">templateFile</span><span class="p">.</span><span class="nx">match</span> <span class="sr">/\.haml$/gi</span>
  17
+      <span class="k">return</span> <span class="kc">false</span>
  18
+    <span class="nv">baseTemplateFile = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Path</span><span class="p">.</span><span class="nx">basename</span> <span class="nx">templateFile</span>
  19
+    <span class="k">if</span> <span class="nx">asTemplateName</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span>
  20
+      <span class="nv">baseTemplateFile = </span><span class="nx">asTemplateName</span>
  21
+    <span class="nv">template = </span><span class="nx">Common</span><span class="p">.</span><span class="nx">Fs</span><span class="p">.</span><span class="nx">readFileSync</span> <span class="nx">templateFile</span><span class="p">,</span> <span class="s">&#39;utf-8&#39;</span>
  22
+    <span class="nv">compiledTemplate = </span><span class="nx">Haml</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">template</span>
  23
+    <span class="nv">optimizedTemplate = </span><span class="nx">Haml</span><span class="p">.</span><span class="nx">optimize</span> <span class="nx">compiledTemplate</span>
  24
+    <span class="nx">@loadedTemplates</span><span class="p">[</span> <span class="nx">baseTemplateFile</span> <span class="p">]</span> <span class="o">=</span>
  25
+      <span class="nv">type: </span><span class="s">&#39;haml&#39;</span>
  26
+      <span class="nv">data: </span><span class="nx">optimizedTemplate</span>
  27
+
  28
+  <span class="nv">loadTemplateString: </span><span class="nf">( templateString, templateName ) -&gt;</span>
  29
+    <span class="nx">@loadedTemplates</span><span class="p">[</span> <span class="nx">templateName</span> <span class="p">]</span> <span class="o">=</span>
  30
+      <span class="nv">type: </span><span class="s">&#39;plain&#39;</span>
  31
+      <span class="nv">data: </span><span class="nx">templateString</span>
  32
+
  33
+  <span class="nv">doRender: </span><span class="nf">( templateFile, context = this, params = {}, layout = &#39;layout.haml&#39; ) -&gt;</span>
  34
+    <span class="nv">template = </span><span class="nx">@getTemplate</span> <span class="nx">templateFile</span>
  35
+    <span class="nx">unless</span> <span class="nx">template</span>
  36
+      <span class="k">return</span> <span class="s">&#39;Template Missing: &#39;</span> <span class="o">+</span> <span class="nx">templateFile</span>
  37
+
  38
+    <span class="k">if</span> <span class="nx">template</span><span class="p">.</span><span class="nx">type</span> <span class="o">==</span> <span class="s">&#39;haml&#39;</span>
  39
+      <span class="nv">content = </span><span class="nx">Haml</span><span class="p">.</span><span class="nx">execute</span> <span class="nx">template</span><span class="p">.</span><span class="nx">data</span><span class="p">,</span> <span class="nx">context</span><span class="p">,</span> <span class="nx">params</span>
  40
+    <span class="k">else</span>
  41
+      <span class="nv">content = </span><span class="nx">template</span><span class="p">.</span><span class="nx">data</span>
  42
+
  43
+    <span class="k">if</span> <span class="nx">layout</span>
  44
+      <span class="nv">compiled_layout = </span><span class="nx">@getTemplate</span> <span class="nx">layout</span>
  45
+      <span class="nv">params.content = </span><span class="nx">content</span>
  46
+      <span class="k">return</span> <span class="nx">Haml</span><span class="p">.</span><span class="nx">execute</span> <span class="nx">layout</span><span class="p">,</span> <span class="nx">context</span><span class="p">,</span> <span class="nx">params</span>
  47
+    <span class="k">return</span> <span class="nx">content</span>
  48
+
  49
+  <span class="nv">doRenderPartial: </span><span class="nf">( templateFile, context = this, params = {}) -&gt;</span>
  50
+    <span class="nx">@doRender</span> <span class="nx">templateFile</span><span class="p">,</span> <span class="nx">context</span><span class="p">,</span> <span class="nx">params</span><span class="p">,</span> <span class="kc">false</span>
  51
+
  52
+<span class="nv">module.exports = </span><span class="nx">Template</span>
  53
+
  54
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
1  examples/assemble-test/app.coffee
@@ -6,7 +6,6 @@ config =
6 6
 app = new arcabouco config
7 7
 
8 8
 app.assemble __dirname + '/pieces'
9  
-app.build()
10 9
 
11 10
 server = app.createServer()
12 11
 server.listen 8888
6  examples/assemble-test/pieces/welcome/welcome.coffee
... ...
@@ -1,12 +1,10 @@
1 1
 class WelcomeController
2 2
   index: ( params ) ->
3  
-    responder = params.response
4  
-    template = params.app.Template
5  
-    responder.respondWith template.doRender( 'welcome.index', this, {}, false )
  3
+    params.response.respondWith params.app.render( 'welcome.index', this, {}, false )
6 4
 
7 5
   bootstrap: ( application ) ->
8 6
     return unless application
9  
-    application.Template.loadTemplate __dirname + '/views/index.haml', 'welcome.index'
  7
+    application.loadTemplate __dirname + '/views/index.haml', 'welcome.index'
10 8
 
11 9
   getRoutes: ->
12 10
     '/test' : 'index'
10  examples/hello-world/app.coffee
... ...
@@ -0,0 +1,10 @@
  1
+arcabouco = require '../../main.js'
  2
+
  3
+config =
  4
+    baseDirectory: __dirname
  5
+
  6
+app = new arcabouco config
  7
+
  8
+server = app.createServer()
  9
+server.listen 8888
  10
+
1  examples/minimal-test/app.coffee
@@ -12,7 +12,6 @@ config =
12 12
 app = new arcabouco config
13 13
 
14 14
 app.work require 'screw-node-static'
15  
-app.build()
16 15
 
17 16
 server = app.createServer()
18 17
 server.listen 8888
22  lib/_monkey-fs.coffee
... ...
@@ -1,16 +1,38 @@
  1
+#     Arcabouco.JS
  2
+#
  3
+#     (c) 2011 Patrick Negri, Yellers Software
  4
+#     Arcabouco.JS is freely distributable under the MIT license.
  5
+#     For all details and documentation:
  6
+#     http://github.com/pnegri/arcabouco-js
  7
+
  8
+# Node.JS Monkey Patching for FS
  9
+# ------------------------------
  10
+
  11
+# Include Commons
1 12
 Common = require __dirname + '/common'
2 13
 
  14
+# ### readdirSyncR
  15
+#
  16
+# Extend Fs with a method to read a directory sync
3 17
 Common.Fs.readdirSyncR = ( directory ) ->
  18
+  # Normalize the input directory
4 19
   directory = Common.Path.normalize directory
  20
+  # Get all files in the directory
5 21
   files = Common.Fs.readdirSync directory
  22
+  # Setup an array for valid files
6 23
   allFiles = []
7 24
   for file in files
  25
+    # Compute the full path of file
8 26
     fileWithPath = directory + '/' + file
  27
+    # Get information about the file
9 28
     stat = Common.Fs.statSync fileWithPath
10 29
     if stat.isFile()
  30
+      # If it is a file put in all files array
11 31
       allFiles.push fileWithPath
12 32
     if stat.isDirectory()
  33
+      # If it is a directory recursively call this method
13 34
       dirFiles = Common.Fs.readdirSyncR fileWithPath
14 35
       if dirFiles.length
  36
+        # Concatenate the results with files found previousily
15 37
         allFiles = allFiles.concat dirFiles
16 38
   allFiles
63  lib/_monkey-patching.coffee
... ...
@@ -1,8 +1,21 @@