Skip to content
Browse files

0.1.0

  • Loading branch information...
1 parent 776b0f2 commit 384653bfb1e2d8d9a54c9f8f89300a4352d7bd80 @KrisJordan committed Jan 6, 2011
Showing with 18 additions and 6 deletions.
  1. +7 −3 docs/icing.html
  2. +6 −2 lib/icing.js
  3. +5 −1 src/icing.coffee
View
10 docs/icing.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html> <html> <head> <title>icing.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="dag.html"> dag.coffee </a> <a class="source" href="icing.html"> icing.coffee </a> <a class="source" href="rules.html"> rules.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> icing.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> <p><strong>icing</strong> adds dependency management to Cakefiles by extending and
+<!DOCTYPE html> <html> <head> <title>icing.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> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> icing.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> <p><strong>icing</strong> adds dependency management to Cakefiles by extending and
slightly modifying cake's "task" function. Add icing to your Cakefiles by adding
a single line:</p>
@@ -55,7 +55,11 @@
TODO: In watch mode run from modified source rather than beginning
TODO: Watch mode with globbed prereqs should watch for globbed changes and rebuild
graph.
-TODO: Test with non-existant inputs.</p> </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> <h3>Options</h3> </td> <td class="code"> <div class="highlight"><pre><span class="nx">option</span> <span class="s1">&#39;-v&#39;</span><span class="p">,</span> <span class="s1">&#39;--verbose&#39;</span><span class="p">,</span> <span class="s1">&#39;Display progress as tasks are executed&#39;</span>
+TODO: Test with non-existant inputs.</p> </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> <h3>Options</h3> </td> <td class="code"> <div class="highlight"><pre><span class="k">if</span> <span class="o">not</span> <span class="nx">option</span><span class="o">?</span>
+ <span class="nx">console</span><span class="p">.</span><span class="nx">error</span> <span class="s2">&quot;require(&#39;icing&#39;) can only be used in Cakefiles\n&quot;</span>
+ <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">1</span>
+
+<span class="nx">option</span> <span class="s1">&#39;-v&#39;</span><span class="p">,</span> <span class="s1">&#39;--verbose&#39;</span><span class="p">,</span> <span class="s1">&#39;Display progress as tasks are executed&#39;</span>
<span class="nx">option</span> <span class="s1">&#39;-w&#39;</span><span class="p">,</span> <span class="s1">&#39;--watch&#39;</span><span class="p">,</span> <span class="s1">&#39;Monitor files for changes and automatically rebuild&#39;</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <h3>Dependencies and Globals</h3> </td> <td class="code"> <div class="highlight"><pre><span class="p">{</span> <span class="nx">RuleGraph</span><span class="p">,</span> <span class="nx">Rule</span><span class="p">,</span> <span class="nx">RecipeNode</span> <span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;./rules&#39;</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="s1">&#39;child_process&#39;</span>
<span class="nv">fs = </span><span class="nx">require</span> <span class="s1">&#39;fs&#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>Preserve a reference to cake's task, we'll be using it.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">cakeTask = </span><span class="nx">global</span><span class="p">.</span><span class="nx">task</span>
@@ -103,9 +107,9 @@
<span class="nv">recipeNode = </span><span class="nx">recipeNodes</span><span class="p">.</span><span class="nx">shift</span><span class="p">()</span>
<span class="k">if</span> <span class="nx">recipeNode</span><span class="p">.</span><span class="nx">shouldRun</span> <span class="nx">graph</span>
+ <span class="nv">aRecipeRan = </span><span class="kc">true</span>
<span class="nv">context = </span><span class="nx">runRecipeContext</span> <span class="nx">graph</span><span class="p">,</span> <span class="nx">recipeNode</span><span class="p">,</span> <span class="nx">runNextRecipeCallback</span><span class="p">,</span> <span class="nx">options</span>
<span class="nx">recipeNode</span><span class="p">.</span><span class="nx">run</span> <span class="nx">context</span><span class="p">,</span> <span class="nx">options</span>
- <span class="nv">aRecipeRan = </span><span class="kc">true</span>
<span class="k">else</span>
<span class="nx">do</span> <span class="nx">runNextRecipeCallback</span>
<span class="k">else</span>
View
8 lib/icing.js
@@ -1,5 +1,9 @@
(function() {
var RecipeNode, Rule, RuleGraph, cakeTask, exec, fs, graph, runRecipeContext, stylize, _ref;
+ if (!(typeof option != "undefined" && option !== null)) {
+ console.error("require('icing') can only be used in Cakefiles\n");
+ process.exit(1);
+ }
option('-v', '--verbose', 'Display progress as tasks are executed');
option('-w', '--watch', 'Monitor files for changes and automatically rebuild');
_ref = require('./rules'), RuleGraph = _ref.RuleGraph, Rule = _ref.Rule, RecipeNode = _ref.RecipeNode;
@@ -71,9 +75,9 @@
}
recipeNode = recipeNodes.shift();
if (recipeNode.shouldRun(graph)) {
+ aRecipeRan = true;
context = runRecipeContext(graph, recipeNode, runNextRecipeCallback, options);
- recipeNode.run(context, options);
- return aRecipeRan = true;
+ return recipeNode.run(context, options);
} else {
return runNextRecipeCallback();
}
View
6 src/icing.coffee
@@ -52,6 +52,10 @@
# TODO: Test with non-existant inputs.
# ### Options
+if not option?
+ console.error "require('icing') can only be used in Cakefiles\n"
+ process.exit 1
+
option '-v', '--verbose', 'Display progress as tasks are executed'
option '-w', '--watch', 'Monitor files for changes and automatically rebuild'
@@ -114,9 +118,9 @@ global.task = (target, description, prereqs=undefined, recipe=undefined) ->
recipeNode = recipeNodes.shift()
if recipeNode.shouldRun graph
+ aRecipeRan = true
context = runRecipeContext graph, recipeNode, runNextRecipeCallback, options
recipeNode.run context, options
- aRecipeRan = true
else
do runNextRecipeCallback
else

0 comments on commit 384653b

Please sign in to comment.
Something went wrong with that request. Please try again.