Permalink
Browse files

Large feature-set release

  • Loading branch information...
pnegri committed Nov 29, 2011
1 parent 1734073 commit e38cf57d0ec77a7bdd8898c5bf1a28b7adf66b04
View
@@ -0,0 +1,9 @@
+SHELL := /bin/bash
+
+test:
+ @node test/arcabouco.js
+
+doc:
+ docco lib/*.coffee
+
+.PHONY: test
View
@@ -0,0 +1,16 @@
+<!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
+
+(c) 2011 Patrick Negri, Yellers Software
+Arcabouco.JS is freely distributable under the MIT license.
+For all details and documentation:
+http://github.com/pnegri/arcabouco-js
+</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>
+
+<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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <span class="nx">allFiles</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
Oops, something went wrong.

0 comments on commit e38cf57

Please sign in to comment.