Skip to content
Browse files

[doc] Updated docco docs

  • Loading branch information...
1 parent 3ecc03c commit 2229733051e7c347c52e9bef390cbef509e3f5ae @indexzero indexzero committed
View
5 docs/jitsu.html
@@ -73,6 +73,11 @@
<span class="k">if</span> <span class="p">(</span><span class="nx">err</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="sr">/403/</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">message</span><span class="p">))</span> <span class="p">{</span>
<span class="nx">winston</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;Error running command &#39;</span> <span class="o">+</span> <span class="nx">command</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
<span class="nx">winston</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">message</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">stack</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">err</span><span class="p">.</span><span class="nx">stack</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;\n&#39;</span><span class="p">).</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">trace</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="nx">trace</span><span class="p">);</span>
+ <span class="p">})</span>
+ <span class="p">}</span>
<span class="k">return</span>
<span class="p">}</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>TODO (indexzero): Something here</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">callback</span><span class="p">();</span>
View
12 docs/jitsu/api/apps.html
@@ -30,8 +30,8 @@
<h4>@callback {function} Continuation to pass control to when complete</h4>
<p>Creates an application with the specified package.json manifest in <code>app</code>. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;POST&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">name</span><span class="p">],</span> <span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
-
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;POST&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">username</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">name</span><span class="p">],</span> <span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span><span class="p">();</span>
<span class="p">});</span>
<span class="p">};</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h3>function update (name, attrs, callback)</h3>
@@ -42,7 +42,7 @@
<h4>@callback {function} Continuation to pass control to when complete</h4>
<p>Updates the application with <code>name</code> with the specified attributes in <code>attrs</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">update</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">attrs</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;PUT&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">attrs</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;PUT&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">attrs</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
<span class="p">});</span>
<span class="p">};</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>function destroy (name, callback)</h3>
@@ -51,9 +51,9 @@
<h4>@callback {function} Continuation to pass control to when complete</h4>
-<p>Destroys the application with <code>name</code> for the authenticated user. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">destory</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;DELETE&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
-
+<p>Destroys the application with <code>name</code> for the authenticated user. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Apps</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;DELETE&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">username</span><span class="p">,</span> <span class="nx">name</span><span class="p">],</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span><span class="p">();</span>
<span class="p">});</span>
<span class="p">};</span>
View
52 docs/jitsu/api/client.html
@@ -6,6 +6,7 @@
<span class="cm"> */</span>
<span class="kd">var</span> <span class="nx">eyes</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;eyes&#39;</span><span class="p">),</span>
+ <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">),</span>
<span class="nx">request</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;request&#39;</span><span class="p">),</span>
<span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</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> <h3>function Client (options)</h3>
@@ -67,6 +68,57 @@
<span class="nx">success</span><span class="p">(</span><span class="nx">response</span><span class="p">,</span> <span class="nx">result</span><span class="p">);</span>
<span class="p">});</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> <h3>function _upload (uri, contentType, file, callback, success)</h3>
+
+<h4>@uri {Array} Locator for the Remote Resource</h4>
+
+<h4>@contentType {string} Content-Type header to use for the upload.</h4>
+
+<h4>@file {string} Path of the local file to upload.</h4>
+
+<h4>@success {function} Continuation to call upon successful transactions</h4>
+
+<h4>@callback {function} Continuation to call if errors occur.</h4>
+
+<p>Makes a <code>POST</code> request to <code>this.remoteUri + uri</code> with the data in <code>file</code>
+as the request body. Short circuits to <code>callback</code> if the response
+code from Nodejitsu matches <code>jitsu.failCodes</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Client</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_upload</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">uri</span><span class="p">,</span> <span class="nx">contentType</span><span class="p">,</span> <span class="nx">file</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="nx">success</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">options</span><span class="p">,</span> <span class="nx">out</span><span class="p">,</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">,</span>
+ <span class="nx">encoded</span> <span class="o">=</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">utils</span><span class="p">.</span><span class="nx">base64</span><span class="p">.</span><span class="nx">encode</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">options</span><span class="p">.</span><span class="nx">auth</span><span class="p">);</span>
+
+ <span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span><span class="p">(</span><span class="nx">file</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="nx">method</span><span class="o">:</span> <span class="s1">&#39;POST&#39;</span><span class="p">,</span>
+ <span class="nx">uri</span><span class="o">:</span> <span class="nx">self</span><span class="p">.</span><span class="nx">options</span><span class="p">.</span><span class="nx">remoteUri</span> <span class="o">+</span> <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="nx">uri</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">),</span>
+ <span class="nx">headers</span><span class="o">:</span> <span class="p">{</span>
+ <span class="s1">&#39;Authorization&#39;</span><span class="o">:</span> <span class="s1">&#39;Basic &#39;</span> <span class="o">+</span> <span class="nx">encoded</span><span class="p">,</span>
+ <span class="s1">&#39;Content-Type&#39;</span><span class="o">:</span> <span class="nx">contentType</span><span class="p">,</span>
+ <span class="s1">&#39;Content-Length&#39;</span><span class="o">:</span> <span class="nx">data</span><span class="p">.</span><span class="nx">length</span>
+ <span class="p">}</span>
+ <span class="p">};</span>
+
+ <span class="nx">out</span> <span class="o">=</span> <span class="nx">request</span><span class="p">(</span><span class="nx">options</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">response</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="k">try</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">statusCode</span> <span class="o">=</span> <span class="nx">response</span><span class="p">.</span><span class="nx">statusCode</span><span class="p">.</span><span class="nx">toString</span><span class="p">(),</span>
+ <span class="nx">result</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">body</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="k">catch</span> <span class="p">(</span><span class="nx">ex</span><span class="p">)</span> <span class="p">{</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>Ignore Errors</p> </td> <td class="code"> <div class="highlight"><pre> <span class="p">}</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">failCodes</span><span class="p">).</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">statusCode</span><span class="p">)</span> <span class="o">!==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">error</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">&#39;Nodejitsu Error (&#39;</span> <span class="o">+</span> <span class="nx">statusCode</span> <span class="o">+</span> <span class="s1">&#39;): &#39;</span> <span class="o">+</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">failCodes</span><span class="p">[</span><span class="nx">statusCode</span><span class="p">]);</span>
+ <span class="nx">error</span><span class="p">.</span><span class="nx">result</span> <span class="o">=</span> <span class="nx">result</span><span class="p">;</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">error</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="nx">success</span><span class="p">(</span><span class="nx">response</span><span class="p">,</span> <span class="nx">result</span><span class="p">);</span>
+ <span class="p">});</span>
+
+ <span class="nx">fs</span><span class="p">.</span><span class="nx">createReadStream</span><span class="p">(</span><span class="nx">file</span><span class="p">).</span><span class="nx">pipe</span><span class="p">(</span><span class="nx">out</span><span class="p">);</span>
+ <span class="p">});</span>
<span class="p">};</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
4 docs/jitsu/api/snapshots.html
@@ -35,8 +35,8 @@
<p>Creates a snapshot for the application with <code>app.name = name</code> using
the <code>*.tgz</code> package data in <code>snapshot</code>. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">Snapshots</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">snapshot</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
- <span class="k">this</span><span class="p">.</span><span class="nx">_request</span><span class="p">(</span><span class="s1">&#39;POST&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">name</span><span class="p">,</span> <span class="s1">&#39;snapshots&#39;</span><span class="p">],</span> <span class="nx">app</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
-
+ <span class="k">this</span><span class="p">.</span><span class="nx">_upload</span><span class="p">([</span><span class="s1">&#39;apps&#39;</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">username</span><span class="p">,</span> <span class="nx">name</span><span class="p">,</span> <span class="s1">&#39;snapshots&#39;</span><span class="p">],</span> <span class="s1">&#39;application/octet-stream&#39;</span><span class="p">,</span> <span class="nx">snapshot</span><span class="p">,</span> <span class="nx">callback</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">res</span><span class="p">,</span> <span class="nx">body</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">};</span>
View
101 docs/jitsu/commands/apps.html
@@ -8,48 +8,117 @@
<span class="kd">var</span> <span class="nx">winston</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;winston&#39;</span><span class="p">),</span>
<span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">apps</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">;</span>
+<span class="kd">var</span> <span class="nx">apps</span> <span class="o">=</span> <span class="nx">exports</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> <h3>function list (callback)</h3>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Lists the applications for the authenticated user.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">jitsu</span><span class="p">.</span><span class="nx">apps</span><span class="p">.</span><span class="nx">list</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">apps</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
+ <span class="p">}</span>
+
<span class="kd">var</span> <span class="nx">rows</span> <span class="o">=</span> <span class="p">[[</span><span class="s1">&#39;name&#39;</span><span class="p">,</span> <span class="s1">&#39;state&#39;</span><span class="p">,</span> <span class="s1">&#39;subdomain&#39;</span><span class="p">,</span> <span class="s1">&#39;start&#39;</span><span class="p">,</span> <span class="s1">&#39;latest&#39;</span><span class="p">]],</span>
<span class="nx">colors</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;underline&#39;</span><span class="p">,</span> <span class="s1">&#39;yellow&#39;</span><span class="p">,</span> <span class="s1">&#39;green&#39;</span><span class="p">,</span> <span class="s1">&#39;grey&#39;</span><span class="p">,</span> <span class="s1">&#39;red&#39;</span><span class="p">];</span>
<span class="nx">apps</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">app</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">rows</span><span class="p">.</span><span class="nx">push</span><span class="p">([</span>
<span class="nx">app</span><span class="p">.</span><span class="nx">name</span><span class="p">,</span>
- <span class="nx">app</span><span class="p">.</span><span class="nx">state</span><span class="p">,</span>
+ <span class="nx">app</span><span class="p">.</span><span class="nx">state</span> <span class="o">||</span> <span class="s1">&#39;stopped&#39;</span><span class="p">,</span>
<span class="nx">app</span><span class="p">.</span><span class="nx">subdomain</span><span class="p">,</span>
- <span class="nx">app</span><span class="p">.</span><span class="nx">scripts</span><span class="p">.</span><span class="nx">start</span><span class="p">,</span>
- <span class="nx">app</span><span class="p">.</span><span class="nx">snapshots</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">filename</span>
+ <span class="nx">app</span><span class="p">.</span><span class="nx">scripts</span><span class="p">.</span><span class="nx">start</span> <span class="o">||</span> <span class="s1">&#39;---&#39;</span><span class="p">,</span>
+ <span class="nx">app</span><span class="p">.</span><span class="nx">snapshots</span> <span class="o">&amp;&amp;</span> <span class="nx">app</span><span class="p">.</span><span class="nx">snapshots</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">app</span><span class="p">.</span><span class="nx">snapshots</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">filename</span> <span class="o">:</span> <span class="s1">&#39;---&#39;</span>
<span class="p">]);</span>
<span class="p">});</span>
<span class="nx">jitsu</span><span class="p">.</span><span class="nx">log</span><span class="p">.</span><span class="nx">logRows</span><span class="p">(</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nx">rows</span><span class="p">,</span> <span class="nx">colors</span><span class="p">);</span>
+ <span class="nx">callback</span><span class="p">();</span>
<span class="p">});</span>
-<span class="p">};</span>
+<span class="p">};</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>function list (callback)</h3>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
-
-<span class="p">};</span>
+<h4>@name {string} <strong>optional</strong> Name of the application to create</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Creates an application for the package.json in the current directory
+using <code>name</code> if supplied and falling back to <code>package.name</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span><span class="p">(</span><span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">(),</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">pkg</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span>
+ <span class="nx">name</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
+ <span class="p">}</span>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">update</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span> <span class="o">||</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">apps</span><span class="p">.</span><span class="nx">list</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">apps</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">existing</span> <span class="o">=</span> <span class="nx">apps</span><span class="p">.</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">a</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">a</span><span class="p">.</span><span class="nx">name</span> <span class="o">===</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span> <span class="p">});</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">existing</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">winston</span><span class="p">.</span><span class="nx">warn</span><span class="p">(</span><span class="s1">&#39;Cannot create duplicate application &#39;</span> <span class="o">+</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="p">}</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>TODO (indexzero): Configure this default value in nodejitsu APIs</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">pkg</span><span class="p">.</span><span class="nx">state</span> <span class="o">=</span> <span class="s1">&#39;stopped&#39;</span><span class="p">;</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Validating package.json for &#39;</span> <span class="o">+</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">prompt</span><span class="p">.</span><span class="nx">addProperties</span><span class="p">(</span><span class="nx">pkg</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;subdomain&#39;</span><span class="p">],</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">updated</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Creating app &#39;</span> <span class="o">+</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">apps</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">updated</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">silly</span><span class="p">(</span><span class="s1">&#39;Done creating app &#39;</span> <span class="o">+</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">err</span> <span class="o">?</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">:</span> <span class="nx">callback</span><span class="p">();</span>
+ <span class="p">});</span>
+ <span class="p">});</span>
+ <span class="p">});</span>
+ <span class="p">});</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> <h3>function list (callback)</h3>
+
+<h4>@name {string} <strong>optional</strong> Name of the application to create</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Lists the applications for the authenticated user.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">update</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">callback</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span>
<span class="p">}</span>
-<span class="p">};</span>
+<span class="p">};</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h3>function destroy (callback)</h3>
+
+<h4>@name {string} <strong>optional</strong> Name of the application to destroy.</h4>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Destroys the application specified by <code>name</code>. If no name is supplied
+this will destroy the application in the current directory.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span>
+ <span class="k">return</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span><span class="p">(</span><span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">(),</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="kr">package</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">name</span> <span class="o">=</span> <span class="kr">package</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
+ <span class="nx">executeDestroy</span><span class="p">();</span>
+ <span class="p">});</span>
+ <span class="p">}</span>
-<span class="p">};</span>
+ <span class="kd">function</span> <span class="nx">executeDestroy</span> <span class="p">()</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Destroying app &#39;</span> <span class="o">+</span> <span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">apps</span><span class="p">.</span><span class="nx">destroy</span><span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">silly</span><span class="p">(</span><span class="s1">&#39;Done destroying app &#39;</span> <span class="o">+</span> <span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">err</span> <span class="o">?</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">:</span> <span class="nx">callback</span><span class="p">();</span>
+ <span class="p">});</span>
+ <span class="p">}</span>
+
+ <span class="nx">executeDestroy</span><span class="p">();</span>
+<span class="p">};</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>function start (callback)</h3>
+
+<h4>@name {string} <strong>optional</strong> Name of the application to start.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">start</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Starts the application specified by <code>name</code>. If no name is supplied
+this will start the application in the current directory.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">start</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
-<span class="p">};</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>function stop (callback)</h3>
+
+<h4>@name {string} <strong>optional</strong> Name of the application to stop.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
-<span class="nx">apps</span><span class="p">.</span><span class="nx">stop</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Stops the application specified by <code>name</code>. If no name is supplied
+this will stop the application in the current directory.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">apps</span><span class="p">.</span><span class="nx">stop</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="p">};</span>
View
38 docs/jitsu/commands/config.html
@@ -9,23 +9,37 @@
<span class="nx">winston</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;winston&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">,</span>
- <span class="nx">noDelete</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="s1">&#39;remoteUri&#39;</span><span class="p">,</span> <span class="s1">&#39;userconfig&#39;</span><span class="p">,</span> <span class="s1">&#39;auth&#39;</span><span class="p">];</span>
+ <span class="nx">noDelete</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="s1">&#39;remoteUri&#39;</span><span class="p">,</span> <span class="s1">&#39;userconfig&#39;</span><span class="p">,</span> <span class="s1">&#39;auth&#39;</span><span class="p">,</span> <span class="s1">&#39;tmproot&#39;</span><span class="p">,</span> <span class="s1">&#39;tar&#39;</span><span class="p">,</span> <span class="s1">&#39;gzipbin&#39;</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> <h3>function set (key, value, callback)</h3>
-<span class="nx">config</span><span class="p">.</span><span class="nx">set</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<h4>@key {string} Key to set in jitsu config.</h4>
+
+<h4>@value {string} Value to set the key to.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Sets the specified <code>key</code> in jitsu config to <code>value</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">config</span><span class="p">.</span><span class="nx">set</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">value</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">]</span> <span class="o">=</span> <span class="nx">value</span><span class="p">;</span>
<span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">callback</span><span class="p">);</span>
-<span class="p">};</span>
+<span class="p">};</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>function get (key, callback)</h3>
+
+<h4>@key {string} Key to get in jitsu config.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
-<span class="nx">config</span><span class="p">.</span><span class="nx">get</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Gets the specified <code>key</code> in jitsu config.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">config</span><span class="p">.</span><span class="nx">get</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">])</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">winston</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;No configuration value for &#39;</span> <span class="o">+</span> <span class="nx">key</span><span class="p">.</span><span class="nx">yellow</span><span class="p">);</span>
<span class="p">}</span>
- <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">([</span><span class="nx">key</span><span class="p">.</span><span class="nx">yellow</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">magenta</span><span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">));</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">data</span><span class="p">([</span><span class="nx">key</span><span class="p">.</span><span class="nx">yellow</span><span class="p">,</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">magenta</span><span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">));</span>
<span class="nx">callback</span><span class="p">();</span>
-<span class="p">};</span>
+<span class="p">};</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>function delete (key, callback)</h3>
+
+<h4>@key {string} Key to delete, in jitsu config.</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
-<span class="nx">config</span><span class="p">.</span><span class="k">delete</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Deletes the specified <code>key</code> in jitsu config.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">config</span><span class="p">.</span><span class="k">delete</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">])</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">winston</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s1">&#39;No configuration value for &#39;</span> <span class="o">+</span> <span class="nx">key</span><span class="p">.</span><span class="nx">yellow</span><span class="p">);</span>
<span class="p">}</span>
@@ -37,17 +51,19 @@
<span class="k">delete</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span>
<span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">save</span><span class="p">(</span><span class="nx">callback</span><span class="p">);</span>
-<span class="p">};</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> <h3>function list (callback)</h3>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
-<span class="nx">config</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Lists all the key-value pairs in jitsu config.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">config</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">function</span> <span class="nx">listObject</span> <span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">prefix</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">prefix</span> <span class="o">=</span> <span class="nx">prefix</span> <span class="o">||</span> <span class="s1">&#39;&#39;</span><span class="p">;</span>
<span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span><span class="nx">obj</span><span class="p">).</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">Array</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">]))</span> <span class="p">{</span>
- <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">((</span><span class="nx">prefix</span> <span class="o">+</span> <span class="nx">key</span><span class="p">).</span><span class="nx">yellow</span> <span class="o">+</span> <span class="s1">&#39; &#39;</span> <span class="o">+</span> <span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">).</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">data</span><span class="p">((</span><span class="nx">prefix</span> <span class="o">+</span> <span class="nx">key</span><span class="p">).</span><span class="nx">yellow</span> <span class="o">+</span> <span class="s1">&#39; &#39;</span> <span class="o">+</span> <span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">).</span><span class="nx">magenta</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
- <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">((</span><span class="nx">prefix</span> <span class="o">+</span> <span class="nx">key</span><span class="p">).</span><span class="nx">yellow</span> <span class="o">+</span> <span class="s1">&#39; &#39;</span> <span class="o">+</span> <span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">toString</span><span class="p">().</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">data</span><span class="p">((</span><span class="nx">prefix</span> <span class="o">+</span> <span class="nx">key</span><span class="p">).</span><span class="nx">yellow</span> <span class="o">+</span> <span class="s1">&#39; &#39;</span> <span class="o">+</span> <span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">toString</span><span class="p">().</span><span class="nx">magenta</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="p">}</span>
View
45 docs/jitsu/commands/snapshots.html
@@ -5,11 +5,17 @@
<span class="cm"> *</span>
<span class="cm"> */</span>
-<span class="kd">var</span> <span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</span><span class="p">);</span>
+<span class="kd">var</span> <span class="nx">winston</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;winston&#39;</span><span class="p">),</span>
+ <span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">snapshots</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">;</span>
+<span class="kd">var</span> <span class="nx">snapshots</span> <span class="o">=</span> <span class="nx">exports</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> <h3>function list (name, callback)</h3>
-<span class="nx">snapshots</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<h4>@name {string} <strong>optional</strong> Name of the application to create</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Lists the snapshots for the application belonging for the authenticated user.
+If <code>name</code> is not supplied the value for name in <code>package.name</code> will be used.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">snapshots</span><span class="p">.</span><span class="nx">list</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">callback</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span>
<span class="k">return</span> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span><span class="p">(</span><span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">(),</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="kr">package</span><span class="p">)</span> <span class="p">{</span>
@@ -37,13 +43,36 @@
<span class="p">}</span>
<span class="nx">executeList</span><span class="p">();</span>
-<span class="p">};</span>
+<span class="p">};</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>function create (name, callback)</h3>
-<span class="nx">snapshots</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
-
-<span class="p">};</span>
+<h4>@name {string} <strong>optional</strong> Name of the application to create</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Creates a snapshots for the application belonging for the authenticated user
+using the data in the current directory. If <code>name</code> is not supplied the
+value for name in <code>package.name</code> will be used.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">snapshots</span><span class="p">.</span><span class="nx">create</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</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>TODO (indexzero): Ensure <code>snapshot create ../../</code> works </p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">jitsu</span><span class="p">.</span><span class="nx">utils</span><span class="p">.</span><span class="nx">createPackage</span><span class="p">(</span><span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">(),</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">pkg</span><span class="p">,</span> <span class="nx">filename</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">callback</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span>
+ <span class="nx">name</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
+ <span class="p">}</span>
+
+ <span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span> <span class="o">||</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">;</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Creating snapshot for &#39;</span> <span class="o">+</span> <span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">silly</span><span class="p">(</span><span class="s1">&#39;Filename: &#39;</span> <span class="o">+</span> <span class="nx">filename</span><span class="p">);</span>
+ <span class="nx">jitsu</span><span class="p">.</span><span class="nx">snapshots</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">filename</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">snapshots</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">winston</span><span class="p">.</span><span class="nx">info</span><span class="p">(</span><span class="s1">&#39;Done creating snapshot &#39;</span> <span class="o">+</span> <span class="nx">name</span><span class="p">.</span><span class="nx">magenta</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">err</span> <span class="o">?</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">:</span> <span class="nx">callback</span><span class="p">();</span>
+ <span class="p">});</span>
+ <span class="p">});</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> <h3>function destroy (count, callback)</h3>
+
+<h4>@count {string} <strong>optional</strong> Number of snapshots to destroy</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
-<span class="nx">snapshots</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<p>Destroys the specified number of snapshots for the application in the current
+directory. If <code>count</code> is not supplied one snapshot will be destroyed. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">snapshots</span><span class="p">.</span><span class="nx">destroy</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">count</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="p">};</span>
View
5 docs/jitsu/config.html
@@ -12,7 +12,10 @@
<span class="kd">var</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">,</span> <span class="nx">settings</span> <span class="o">=</span> <span class="nx">config</span><span class="p">.</span><span class="nx">settings</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">root</span><span class="o">:</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">HOME</span><span class="p">,</span>
<span class="nx">remoteUri</span><span class="o">:</span> <span class="s1">&#39;http://localhost&#39;</span><span class="p">,</span>
- <span class="nx">userconfig</span><span class="o">:</span> <span class="s1">&#39;.jitsuconf&#39;</span>
+ <span class="nx">userconfig</span><span class="o">:</span> <span class="s1">&#39;.jitsuconf&#39;</span><span class="p">,</span>
+ <span class="nx">tmproot</span><span class="o">:</span> <span class="s1">&#39;/tmp&#39;</span><span class="p">,</span>
+ <span class="nx">tar</span><span class="o">:</span> <span class="s1">&#39;tar&#39;</span><span class="p">,</span>
+ <span class="nx">gzipbin</span><span class="o">:</span> <span class="s1">&#39;gzip&#39;</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> <h3>@log {Object}</h3>
<p>Log level configuration for jitsu.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">var</span> <span class="nx">log</span> <span class="o">=</span> <span class="nx">config</span><span class="p">.</span><span class="nx">log</span> <span class="o">=</span> <span class="p">{</span>
View
24 docs/jitsu/prompt.html
@@ -107,6 +107,30 @@
<span class="nx">linereader</span><span class="p">.</span><span class="nx">prompt</span><span class="p">();</span>
<span class="nx">prompt</span><span class="p">.</span><span class="nx">resume</span><span class="p">();</span>
<span class="k">return</span> <span class="nx">prompt</span><span class="p">;</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> <h3>function addProperties (obj, properties, callback)</h3>
+
+<h4>@obj {Object} Object to add properties to</h4>
+
+<h4>@properties {Array} List of properties to get values for</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete.</h4>
+
+<p>Prompts the user for values each of the <code>properties</code> if <code>obj</code> does not already
+have a value for the property. Responds with the modified object. </p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">prompt</span><span class="p">.</span><span class="nx">addProperties</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">properties</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">properties</span> <span class="o">=</span> <span class="nx">properties</span><span class="p">.</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">prop</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span><span class="p">[</span><span class="nx">prop</span><span class="p">]</span> <span class="o">===</span> <span class="s1">&#39;undefined&#39;</span><span class="p">;</span>
+ <span class="p">});</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="nx">properties</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">obj</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="nx">prompt</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">properties</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">results</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span><span class="nx">results</span><span class="p">).</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">obj</span><span class="p">[</span><span class="nx">key</span><span class="p">]</span> <span class="o">=</span> <span class="nx">results</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span>
+ <span class="nx">callback</span><span class="p">(</span><span class="nx">obj</span><span class="p">);</span>
+ <span class="p">});</span>
+ <span class="p">});</span>
<span class="p">};</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
View
62 docs/jitsu/utils/index.html
@@ -5,26 +5,39 @@
<span class="cm"> *</span>
<span class="cm"> */</span>
-<span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">),</span>
+<span class="kd">var</span> <span class="nx">jitsu</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;jitsu&#39;</span><span class="p">),</span>
+ <span class="nx">util</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;util&#39;</span><span class="p">),</span>
+ <span class="nx">spawn</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;child_process&#39;</span><span class="p">).</span><span class="nx">spawn</span><span class="p">,</span>
+ <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">),</span>
<span class="nx">path</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;path&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">utils</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">;</span>
-<span class="nx">utils</span><span class="p">.</span><span class="nx">base64</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./base64&#39;</span><span class="p">);</span>
+<span class="nx">utils</span><span class="p">.</span><span class="nx">base64</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./base64&#39;</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> <h3>function snapshotTime (name)</h3>
-<span class="nx">utils</span><span class="p">.</span><span class="nx">snapshotTime</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">)</span> <span class="p">{</span>
+<h4>@name {string} Filename for the snapshot</h4>
+
+<p>Returns a formatted date string for the unix time
+in the snapshot filename.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">utils</span><span class="p">.</span><span class="nx">snapshotTime</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">name</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">time</span> <span class="o">=</span> <span class="nx">name</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="sr">/[\w|\-]+-[\w|\-]+-(\d+)/</span><span class="p">)[</span><span class="mi">1</span><span class="p">];</span>
<span class="k">return</span> <span class="nx">utils</span><span class="p">.</span><span class="nx">formatTime</span><span class="p">(</span><span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nb">parseInt</span><span class="p">(</span><span class="nx">time</span><span class="p">)));</span>
-<span class="p">};</span>
+<span class="p">};</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>function formatTime (obj)</h3>
-<span class="nx">utils</span><span class="p">.</span><span class="nx">formatTime</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="p">{</span>
+<h4>@obj {Date} Date to format</h4>
+
+<p>Returns a formatted date string for <code>obj</code> in the format
+YYYY/MM/DD HH:MM:SS</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">utils</span><span class="p">.</span><span class="nx">formatTime</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">date</span> <span class="o">=</span> <span class="p">[</span><span class="nx">obj</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">(),</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">getMonth</span><span class="p">(),</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">getDate</span><span class="p">()].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">),</span>
<span class="nx">time</span> <span class="o">=</span> <span class="p">[</span><span class="nx">obj</span><span class="p">.</span><span class="nx">getHours</span><span class="p">(),</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">getMinutes</span><span class="p">(),</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">getSeconds</span><span class="p">()].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;:&#39;</span><span class="p">);</span>
<span class="k">return</span> <span class="p">[</span><span class="nx">date</span><span class="p">,</span> <span class="nx">time</span><span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">);</span>
-<span class="p">};</span>
+<span class="p">};</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>function readPackage (dir, callback)</h3>
-<span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+<h4>@dir {string} Directory to read the package.json from</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Attempts to read the package.json file out of the specified directory.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">file</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="s1">&#39;package.json&#39;</span><span class="p">);</span>
<span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span><span class="p">(</span><span class="nx">file</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span> <span class="p">{</span>
@@ -39,6 +52,41 @@
<span class="nx">callback</span><span class="p">(</span><span class="nx">ex</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">});</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> <h3>function createPackage (dir, callback)</h3>
+
+<h4>@dir {string} Directory to create the package *.tgz file from</h4>
+
+<h4>@callback {function} Continuation to pass control to when complete</h4>
+
+<p>Creates a *.tgz package file from the specified directory <code>dir</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">utils</span><span class="p">.</span><span class="nx">createPackage</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">utils</span><span class="p">.</span><span class="nx">readPackage</span><span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">pkg</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">err</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="nx">dir</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">===</span> <span class="s1">&#39;/&#39;</span><span class="p">)</span> <span class="nx">dir</span> <span class="o">=</span> <span class="nx">dir</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">dir</span><span class="p">),</span>
+ <span class="nx">base</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">basename</span><span class="p">(</span><span class="nx">dir</span><span class="p">),</span>
+ <span class="nx">tarball</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">.</span><span class="nx">tmproot</span><span class="p">,</span> <span class="p">[</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">username</span><span class="p">,</span> <span class="nx">pkg</span><span class="p">.</span><span class="nx">name</span><span class="p">,</span> <span class="nb">Date</span><span class="p">.</span><span class="nx">now</span><span class="p">()].</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;.tgz&#39;</span><span class="p">),</span>
+ <span class="nx">target</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">createWriteStream</span><span class="p">(</span><span class="nx">tarball</span><span class="p">),</span>
+ <span class="nx">tarargs</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;-cvf&#39;</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s1">&#39;--exclude&#39;</span><span class="p">,</span> <span class="s1">&#39;.git&#39;</span><span class="p">,</span> <span class="s1">&#39;-C&#39;</span><span class="p">,</span> <span class="nx">parent</span><span class="p">,</span> <span class="nx">base</span><span class="p">];</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>TODO (indexzero) Support for <code>.jitsuignore</code> files and support for package.json files</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">tar</span> <span class="o">=</span> <span class="nx">spawn</span><span class="p">(</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">.</span><span class="nx">tar</span><span class="p">,</span> <span class="nx">tarargs</span><span class="p">),</span>
+ <span class="nx">gzip</span> <span class="o">=</span> <span class="nx">spawn</span><span class="p">(</span><span class="nx">jitsu</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">settings</span><span class="p">.</span><span class="nx">gzipbin</span><span class="p">,</span> <span class="p">[</span><span class="s2">&quot;--stdout&quot;</span><span class="p">]),</span>
+ <span class="nx">errState</span><span class="p">;</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>TODO (indexzero) Make this piping more robust</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">util</span><span class="p">.</span><span class="nx">pump</span><span class="p">(</span><span class="nx">tar</span><span class="p">.</span><span class="nx">stdout</span><span class="p">,</span> <span class="nx">gzip</span><span class="p">.</span><span class="nx">stdin</span><span class="p">);</span>
+ <span class="nx">util</span><span class="p">.</span><span class="nx">pump</span><span class="p">(</span><span class="nx">gzip</span><span class="p">.</span><span class="nx">stdout</span><span class="p">,</span> <span class="nx">target</span><span class="p">);</span>
+
+ <span class="nx">target</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s2">&quot;close&quot;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">ok</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">errState</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span>
+ <span class="p">}</span>
+ <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">callback</span><span class="p">(</span><span class="nx">errState</span> <span class="o">=</span> <span class="nx">err</span><span class="p">)</span>
+ <span class="p">}</span>
+
+ <span class="nx">callback</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="nx">pkg</span><span class="p">,</span> <span class="nx">tarball</span><span class="p">);</span>
+ <span class="p">});</span>
+ <span class="p">});</span>
<span class="p">};</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>

0 comments on commit 2229733

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