Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move files that shouldn't be directly required into subfolders.

I decided to split the files into 'tasks', which contain definitions of
behaviour to run using Capistrano, and 'support', which are classes and tools
used by recap internally. I moved the template from `deploy` into `support`,
which seemed right.

I've also regenerated the documentation. The specs now pass, but I can't test
the features locally.
  • Loading branch information...
commit 99ed96ead027d922b1c0dcc51fb532ec5c5a7f8d 1 parent 5e7181f
@lazyatom lazyatom authored
Showing with 620 additions and 627 deletions.
  1. +2 −2 bin/recap
  2. +17 −17 doc/index.html
  3. +11 −11 doc/lib/recap.html
  4. +0 −213 doc/lib/recap/capistrano_extensions.html
  5. +11 −11 doc/lib/recap/rails.html
  6. +11 −11 doc/lib/recap/ruby.html
  7. +11 −11 doc/lib/recap/static.html
  8. +211 −0 doc/lib/recap/support/capistrano_extensions.html
  9. +12 −12 doc/lib/recap/{ → support}/cli.html
  10. +14 −14 doc/lib/recap/{ → support}/compatibility.html
  11. +12 −12 doc/lib/recap/{ → support}/environment.html
  12. +12 −12 doc/lib/recap/{ → support}/namespace.html
  13. +11 −11 doc/lib/recap/{ → tasks}/bootstrap.html
  14. +13 −13 doc/lib/recap/{ → tasks}/bundler.html
  15. +17 −17 doc/lib/recap/{ → tasks}/deploy.html
  16. +16 −26 doc/lib/recap/{ → tasks}/env.html
  17. +13 −13 doc/lib/recap/{ → tasks}/foreman.html
  18. +13 −13 doc/lib/recap/{ → tasks}/preflight.html
  19. +11 −11 doc/lib/recap/version.html
  20. +13 −8 lib/recap.rb
  21. +0 −76 lib/recap/capistrano_extensions.rb
  22. +0 −54 lib/recap/environment.rb
  23. +2 −2 lib/recap/rails.rb
  24. +3 −3 lib/recap/ruby.rb
  25. +1 −1  lib/recap/static.rb
  26. +74 −0 lib/recap/support/capistrano_extensions.rb
  27. +3 −3 lib/recap/{ → support}/cli.rb
  28. +2 −2 lib/recap/{ → support}/compatibility.rb
  29. +56 −0 lib/recap/support/environment.rb
  30. +3 −3 lib/recap/{ → support}/namespace.rb
  31. 0  lib/recap/{deploy → support}/templates/Capfile.erb
  32. +2 −2 lib/recap/{ → tasks}/bootstrap.rb
  33. +3 −3 lib/recap/{ → tasks}/bundler.rb
  34. +7 −7 lib/recap/{ → tasks}/deploy.rb
  35. +2 −2 lib/recap/{ → tasks}/env.rb
  36. +3 −3 lib/recap/{ → tasks}/foreman.rb
  37. +2 −2 lib/recap/{ → tasks}/preflight.rb
  38. +14 −14 spec/models/environment_spec.rb
  39. +1 −1  spec/spec_helper.rb
  40. +3 −3 spec/tasks/bootstrap_spec.rb
  41. +2 −2 spec/tasks/bundler_spec.rb
  42. +2 −2 spec/tasks/deploy_spec.rb
  43. +2 −2 spec/tasks/env_spec.rb
  44. +2 −2 spec/tasks/foreman_spec.rb
View
4 bin/recap
@@ -1,3 +1,3 @@
-require 'recap/cli'
-Recap::CLI.start
+require 'recap/support/cli'
+Recap::Support::CLI.start
View
34 doc/index.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="index.html">index.rb</a>
<a class="source" href="lib/recap.html">recap.rb</a>
- <a class="source" href="lib/recap/bootstrap.html">bootstrap.rb</a>
- <a class="source" href="lib/recap/bundler.html">bundler.rb</a>
- <a class="source" href="lib/recap/capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="lib/recap/cli.html">cli.rb</a>
- <a class="source" href="lib/recap/compatibility.html">compatibility.rb</a>
- <a class="source" href="lib/recap/deploy.html">deploy.rb</a>
- <a class="source" href="lib/recap/env.html">env.rb</a>
- <a class="source" href="lib/recap/environment.html">environment.rb</a>
- <a class="source" href="lib/recap/foreman.html">foreman.rb</a>
- <a class="source" href="lib/recap/namespace.html">namespace.rb</a>
- <a class="source" href="lib/recap/preflight.html">preflight.rb</a>
<a class="source" href="lib/recap/rails.html">rails.rb</a>
<a class="source" href="lib/recap/ruby.html">ruby.rb</a>
<a class="source" href="lib/recap/static.html">static.rb</a>
+ <a class="source" href="lib/recap/support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="lib/recap/support/cli.html">cli.rb</a>
+ <a class="source" href="lib/recap/support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="lib/recap/support/environment.html">environment.rb</a>
+ <a class="source" href="lib/recap/support/namespace.html">namespace.rb</a>
+ <a class="source" href="lib/recap/tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="lib/recap/tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="lib/recap/tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="lib/recap/tasks/env.html">env.rb</a>
+ <a class="source" href="lib/recap/tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="lib/recap/tasks/preflight.html">preflight.rb</a>
<a class="source" href="lib/recap/version.html">version.rb</a>
</div>
</div>
@@ -132,11 +132,11 @@
(change <code>application</code> to the name of your app).</p>
</td>
<td class=code>
- <div class='highlight'><pre><span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span><span class="sr"> /sbin/s</span><span class="n">tart</span> <span class="n">application</span><span class="o">*</span>
-<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span><span class="sr"> /sbin/s</span><span class="n">top</span> <span class="n">application</span><span class="o">*</span>
-<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span><span class="sr"> /sbin/</span><span class="n">restart</span> <span class="n">application</span><span class="o">*</span>
-<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span><span class="sr"> /bin/su</span> <span class="o">-</span> <span class="n">application</span><span class="o">*</span>
-<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span><span class="sr"> /bin/su</span> <span class="n">application</span><span class="o">*</span></pre></div>
+ <div class='highlight'><pre><span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span> <span class="sr">/sbin/s</span><span class="n">tart</span> <span class="n">application</span><span class="o">*</span>
+<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span> <span class="sr">/sbin/s</span><span class="n">top</span> <span class="n">application</span><span class="o">*</span>
+<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span> <span class="sr">/sbin/</span><span class="n">restart</span> <span class="n">application</span><span class="o">*</span>
+<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span> <span class="sr">/bin/su</span> <span class="o">-</span> <span class="n">application</span><span class="o">*</span>
+<span class="o">%</span><span class="n">application</span> <span class="no">ALL</span><span class="o">=</span><span class="no">NOPASSWD</span><span class="p">:</span> <span class="sr">/bin/su</span> <span class="n">application</span><span class="o">*</span></pre></div>
</td>
</tr>
<tr id='section-Getting_started'>
@@ -170,7 +170,7 @@
<p>Recap currently supports three types of deployment. These are for static sites (as described
in <a href="lib/recap/static.html">recap/static.rb</a>), ruby apps (<a href="lib/recap/ruby.html">recap/ruby.rb</a>),
and rails apps (<a href="lib/recap/rails.html">recap/rails.rb</a>). Using all three is similar. Add this
-<code>Capfile</code> to your project, changing the first line to reflect the project you have.</p>
+<code>Capfile</code> to your project, changing the first line to reflect the type of deployment you want.</p>
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/ruby&#39;</span>
View
22 doc/lib/recap.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="../index.html">index.rb</a>
<a class="source" href="recap.html">recap.rb</a>
- <a class="source" href="recap/bootstrap.html">bootstrap.rb</a>
- <a class="source" href="recap/bundler.html">bundler.rb</a>
- <a class="source" href="recap/capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="recap/cli.html">cli.rb</a>
- <a class="source" href="recap/compatibility.html">compatibility.rb</a>
- <a class="source" href="recap/deploy.html">deploy.rb</a>
- <a class="source" href="recap/env.html">env.rb</a>
- <a class="source" href="recap/environment.html">environment.rb</a>
- <a class="source" href="recap/foreman.html">foreman.rb</a>
- <a class="source" href="recap/namespace.html">namespace.rb</a>
- <a class="source" href="recap/preflight.html">preflight.rb</a>
<a class="source" href="recap/rails.html">rails.rb</a>
<a class="source" href="recap/ruby.html">ruby.rb</a>
<a class="source" href="recap/static.html">static.rb</a>
+ <a class="source" href="recap/support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="recap/support/cli.html">cli.rb</a>
+ <a class="source" href="recap/support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="recap/support/environment.html">environment.rb</a>
+ <a class="source" href="recap/support/namespace.html">namespace.rb</a>
+ <a class="source" href="recap/tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="recap/tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="recap/tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="recap/tasks/env.html">env.rb</a>
+ <a class="source" href="recap/tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="recap/tasks/preflight.html">preflight.rb</a>
<a class="source" href="recap/version.html">version.rb</a>
</div>
</div>
View
213 doc/lib/recap/capistrano_extensions.html
@@ -1,213 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>capistrano_extensions.rb</title>
- <link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/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="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
- </div>
- </div>
- </div>
- <table cellspacing=0 cellpadding=0>
- <thead>
- <tr>
- <th class=docs><h1>capistrano_extensions.rb</h1></th>
- <th class=code></th>
- </tr>
- </thead>
- <tbody>
- <tr id='section-1'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-1">&#182;</a>
- </div>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;tempfile&#39;</span>
-
-<span class="k">module</span> <span class="nn">Recap</span>
- <span class="k">module</span> <span class="nn">CapistranoExtensions</span></pre></div>
- </td>
- </tr>
- <tr id='section-2'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>Run a command as the given user</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_user</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
- <span class="n">sudo</span> <span class="s2">&quot;su - </span><span class="si">#{</span><span class="n">user</span><span class="si">}</span><span class="s2"> -c &#39;cd </span><span class="si">#{</span><span class="n">pwd</span><span class="si">}</span><span class="s2"> &amp;&amp; </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
- <span class="k">end</span></pre></div>
- </td>
- </tr>
- <tr id='section-3'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-3">&#182;</a>
- </div>
- <p>Run a command as root</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_root</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
- <span class="n">as_user</span> <span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span>
- <span class="k">end</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>Run a command as the application user</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_app</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
- <span class="n">as_user</span> <span class="n">application_user</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span>
- <span class="k">end</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>Put a string into a file as the application user</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">put_as_app</span><span class="p">(</span><span class="n">string</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
- <span class="n">put</span> <span class="n">string</span><span class="p">,</span> <span class="s2">&quot;/tmp/recap-put-as-app&quot;</span>
- <span class="n">as_app</span> <span class="s2">&quot;cp /tmp/recap-put-as-app </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> &amp;&amp; chmod g+rw </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot;/&quot;</span>
- <span class="k">ensure</span>
- <span class="n">run</span> <span class="s2">&quot;rm /tmp/recap-put-as-app&quot;</span>
- <span class="k">end</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>Edit a file on the remote server, using a local editor</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">edit_file</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
- <span class="k">if</span> <span class="n">editor</span> <span class="o">=</span> <span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;DEPLOY_EDITOR&#39;</span><span class="o">]</span> <span class="o">||</span> <span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;EDITOR&#39;</span><span class="o">]</span>
- <span class="n">as_app</span> <span class="s2">&quot;touch </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> &amp;&amp; chmod g+rw </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span>
- <span class="n">local_path</span> <span class="o">=</span> <span class="no">Tempfile</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;deploy-edit&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path</span>
- <span class="n">get</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">local_path</span><span class="p">)</span>
- <span class="sb">`</span><span class="si">#{</span><span class="n">editor</span><span class="si">}</span><span class="sb"> </span><span class="si">#{</span><span class="n">local_path</span><span class="si">}</span><span class="sb">`</span>
- <span class="no">File</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">local_path</span><span class="p">)</span>
- <span class="k">else</span>
- <span class="nb">abort</span> <span class="s2">&quot;To edit a remote file, either the EDITOR or DEPLOY_EDITOR environment variables must be set&quot;</span>
- <span class="k">end</span>
- <span class="k">end</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>Run a git command in the <code>deploy_to</code> directory</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">git</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
- <span class="n">run</span> <span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; umask 002 &amp;&amp; sg </span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> -c </span><span class="se">\&quot;</span><span class="s2">git </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="se">\&quot;</span><span class="s2">&quot;</span>
- <span class="k">end</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>Capture the result of a git command run within the <code>deploy_to</code> directory</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">capture_git</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
- <span class="n">capture</span> <span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; umask 002 &amp;&amp; sg </span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> -c &#39;git </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">exit_code</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
- <span class="n">capture</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2"> &gt; /dev/null 2&gt;&amp;1; echo $?&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
- <span class="k">end</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>Find the latest tag from the repository. As <code>git tag</code> returns tags in order, and our release
-tags are timestamps, the latest tag will always be the last in the list.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">latest_tag_from_repository</span>
- <span class="n">result</span> <span class="o">=</span> <span class="n">capture_git</span><span class="p">(</span><span class="s2">&quot;tag | tail -n1&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
- <span class="n">result</span><span class="o">.</span><span class="n">empty?</span> <span class="p">?</span> <span class="kp">nil</span> <span class="p">:</span> <span class="n">result</span>
- <span class="k">end</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>Does the given file exist within the deployment directory?</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">deployed_file_exists?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
- <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; [ -f </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> ]&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;0&quot;</span>
- <span class="k">end</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>Has the given path been created or changed since the previous deployment? During the first
-successful deployment this will always return true.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">def</span> <span class="nf">deployed_file_changed?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
- <span class="k">return</span> <span class="kp">true</span> <span class="k">unless</span> <span class="n">latest_tag</span>
- <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; git diff --exit-code </span><span class="si">#{</span><span class="n">latest_tag</span><span class="si">}</span><span class="s2"> origin/</span><span class="si">#{</span><span class="n">branch</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;1&quot;</span>
- <span class="k">end</span>
-
- <span class="no">Capistrano</span><span class="o">::</span><span class="no">Configuration</span><span class="o">.</span><span class="n">send</span> <span class="ss">:include</span><span class="p">,</span> <span class="nb">self</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
22 doc/lib/recap/rails.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="../../index.html">index.rb</a>
<a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
<a class="source" href="rails.html">rails.rb</a>
<a class="source" href="ruby.html">ruby.rb</a>
<a class="source" href="static.html">static.rb</a>
+ <a class="source" href="support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="support/cli.html">cli.rb</a>
+ <a class="source" href="support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="support/environment.html">environment.rb</a>
+ <a class="source" href="support/namespace.html">namespace.rb</a>
+ <a class="source" href="tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="tasks/env.html">env.rb</a>
+ <a class="source" href="tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="tasks/preflight.html">preflight.rb</a>
<a class="source" href="version.html">version.rb</a>
</div>
</div>
View
22 doc/lib/recap/ruby.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="../../index.html">index.rb</a>
<a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
<a class="source" href="rails.html">rails.rb</a>
<a class="source" href="ruby.html">ruby.rb</a>
<a class="source" href="static.html">static.rb</a>
+ <a class="source" href="support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="support/cli.html">cli.rb</a>
+ <a class="source" href="support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="support/environment.html">environment.rb</a>
+ <a class="source" href="support/namespace.html">namespace.rb</a>
+ <a class="source" href="tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="tasks/env.html">env.rb</a>
+ <a class="source" href="tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="tasks/preflight.html">preflight.rb</a>
<a class="source" href="version.html">version.rb</a>
</div>
</div>
View
22 doc/lib/recap/static.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="../../index.html">index.rb</a>
<a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
<a class="source" href="rails.html">rails.rb</a>
<a class="source" href="ruby.html">ruby.rb</a>
<a class="source" href="static.html">static.rb</a>
+ <a class="source" href="support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="support/cli.html">cli.rb</a>
+ <a class="source" href="support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="support/environment.html">environment.rb</a>
+ <a class="source" href="support/namespace.html">namespace.rb</a>
+ <a class="source" href="tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="tasks/env.html">env.rb</a>
+ <a class="source" href="tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="tasks/preflight.html">preflight.rb</a>
<a class="source" href="version.html">version.rb</a>
</div>
</div>
View
211 doc/lib/recap/support/capistrano_extensions.html
@@ -0,0 +1,211 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>capistrano_extensions.rb</title>
+ <link rel="stylesheet" href="http://jashkenas.github.com/docco/resources/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="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="cli.html">cli.rb</a>
+ <a class="source" href="compatibility.html">compatibility.rb</a>
+ <a class="source" href="environment.html">environment.rb</a>
+ <a class="source" href="namespace.html">namespace.rb</a>
+ <a class="source" href="../tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="../tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="../tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="../tasks/env.html">env.rb</a>
+ <a class="source" href="../tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="../tasks/preflight.html">preflight.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
+ </div>
+ </div>
+ </div>
+ <table cellspacing=0 cellpadding=0>
+ <thead>
+ <tr>
+ <th class=docs><h1>capistrano_extensions.rb</h1></th>
+ <th class=code></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr id='section-1'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-1">&#182;</a>
+ </div>
+
+ </td>
+ <td class=code>
+ <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;tempfile&#39;</span>
+
+<span class="k">module</span> <span class="nn">Recap::Support::CapistranoExtensions</span></pre></div>
+ </td>
+ </tr>
+ <tr id='section-2'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-2">&#182;</a>
+ </div>
+ <p>Run a command as the given user</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_user</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
+ <span class="n">sudo</span> <span class="s2">&quot;su - </span><span class="si">#{</span><span class="n">user</span><span class="si">}</span><span class="s2"> -c &#39;cd </span><span class="si">#{</span><span class="n">pwd</span><span class="si">}</span><span class="s2"> &amp;&amp; </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
+ <span class="k">end</span></pre></div>
+ </td>
+ </tr>
+ <tr id='section-3'>
+ <td class=docs>
+ <div class="pilwrap">
+ <a class="pilcrow" href="#section-3">&#182;</a>
+ </div>
+ <p>Run a command as root</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_root</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
+ <span class="n">as_user</span> <span class="s1">&#39;root&#39;</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span>
+ <span class="k">end</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>Run a command as the application user</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">as_app</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">pwd</span> <span class="o">=</span> <span class="n">deploy_to</span><span class="p">)</span>
+ <span class="n">as_user</span> <span class="n">application_user</span><span class="p">,</span> <span class="n">command</span><span class="p">,</span> <span class="n">pwd</span>
+ <span class="k">end</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>Put a string into a file as the application user</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">put_as_app</span><span class="p">(</span><span class="n">string</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
+ <span class="n">put</span> <span class="n">string</span><span class="p">,</span> <span class="s2">&quot;/tmp/recap-put-as-app&quot;</span>
+ <span class="n">as_app</span> <span class="s2">&quot;cp /tmp/recap-put-as-app </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> &amp;&amp; chmod g+rw </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot;/&quot;</span>
+ <span class="k">ensure</span>
+ <span class="n">run</span> <span class="s2">&quot;rm /tmp/recap-put-as-app&quot;</span>
+ <span class="k">end</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>Edit a file on the remote server, using a local editor</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">edit_file</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">editor</span> <span class="o">=</span> <span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;DEPLOY_EDITOR&#39;</span><span class="o">]</span> <span class="o">||</span> <span class="no">ENV</span><span class="o">[</span><span class="s1">&#39;EDITOR&#39;</span><span class="o">]</span>
+ <span class="n">as_app</span> <span class="s2">&quot;touch </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> &amp;&amp; chmod g+rw </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span>
+ <span class="n">local_path</span> <span class="o">=</span> <span class="no">Tempfile</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;deploy-edit&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path</span>
+ <span class="n">get</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">local_path</span><span class="p">)</span>
+ <span class="sb">`</span><span class="si">#{</span><span class="n">editor</span><span class="si">}</span><span class="sb"> </span><span class="si">#{</span><span class="n">local_path</span><span class="si">}</span><span class="sb">`</span>
+ <span class="no">File</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">local_path</span><span class="p">)</span>
+ <span class="k">else</span>
+ <span class="nb">abort</span> <span class="s2">&quot;To edit a remote file, either the EDITOR or DEPLOY_EDITOR environment variables must be set&quot;</span>
+ <span class="k">end</span>
+ <span class="k">end</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>Run a git command in the <code>deploy_to</code> directory</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">git</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
+ <span class="n">run</span> <span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; umask 002 &amp;&amp; sg </span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> -c </span><span class="se">\&quot;</span><span class="s2">git </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="se">\&quot;</span><span class="s2">&quot;</span>
+ <span class="k">end</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>Capture the result of a git command run within the <code>deploy_to</code> directory</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">capture_git</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
+ <span class="n">capture</span> <span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; umask 002 &amp;&amp; sg </span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> -c &#39;git </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
+ <span class="k">end</span>
+
+ <span class="k">def</span> <span class="nf">exit_code</span><span class="p">(</span><span class="n">command</span><span class="p">)</span>
+ <span class="n">capture</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="s2"> &gt; /dev/null 2&gt;&amp;1; echo $?&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
+ <span class="k">end</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>Find the latest tag from the repository. As <code>git tag</code> returns tags in order, and our release
+tags are timestamps, the latest tag will always be the last in the list.</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">latest_tag_from_repository</span>
+ <span class="n">result</span> <span class="o">=</span> <span class="n">capture_git</span><span class="p">(</span><span class="s2">&quot;tag | tail -n1&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
+ <span class="n">result</span><span class="o">.</span><span class="n">empty?</span> <span class="p">?</span> <span class="kp">nil</span> <span class="p">:</span> <span class="n">result</span>
+ <span class="k">end</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>Does the given file exist within the deployment directory?</p>
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">deployed_file_exists?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+ <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; [ -f </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2"> ]&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;0&quot;</span>
+ <span class="k">end</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>Has the given path been created or changed since the previous deployment? During the first
+successful deployment this will always return true.</p>
+
+ </td>
+ <td class=code>
+ <div class='highlight'><pre> <span class="k">def</span> <span class="nf">deployed_file_changed?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+ <span class="k">return</span> <span class="kp">true</span> <span class="k">unless</span> <span class="n">latest_tag</span>
+ <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;cd </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2"> &amp;&amp; git diff --exit-code </span><span class="si">#{</span><span class="n">latest_tag</span><span class="si">}</span><span class="s2"> origin/</span><span class="si">#{</span><span class="n">branch</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;1&quot;</span>
+ <span class="k">end</span>
+
+ <span class="no">Capistrano</span><span class="o">::</span><span class="no">Configuration</span><span class="o">.</span><span class="n">send</span> <span class="ss">:include</span><span class="p">,</span> <span class="nb">self</span>
+<span class="k">end</span></pre></div>
+ </td>
+ </tr>
+ </table>
+</div>
+</body>
View
24 doc/lib/recap/cli.html → doc/lib/recap/support/cli.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
<a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
<a class="source" href="cli.html">cli.rb</a>
<a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
<a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
<a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="../tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="../tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="../tasks/env.html">env.rb</a>
+ <a class="source" href="../tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="../tasks/preflight.html">preflight.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
View
28 doc/lib/recap/compatibility.html → doc/lib/recap/support/compatibility.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
<a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
<a class="source" href="cli.html">cli.rb</a>
<a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
<a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
<a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="../tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="../tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="../tasks/env.html">env.rb</a>
+ <a class="source" href="../tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="../tasks/preflight.html">preflight.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -53,8 +53,8 @@
will work. Many are based on assumptions about the deployment layout that no longer hold true.</p>
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Compatibility</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span></pre></div>
+ <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Support::Compatibility</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span></pre></div>
</td>
</tr>
<tr id='section-2'>
View
24 doc/lib/recap/environment.html → doc/lib/recap/support/environment.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
<a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
<a class="source" href="cli.html">cli.rb</a>
<a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
<a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
<a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="../tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="../tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="../tasks/env.html">env.rb</a>
+ <a class="source" href="../tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="../tasks/preflight.html">preflight.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
View
24 doc/lib/recap/namespace.html → doc/lib/recap/support/namespace.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
<a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
<a class="source" href="cli.html">cli.rb</a>
<a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
<a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
<a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="../tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="../tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="../tasks/env.html">env.rb</a>
+ <a class="source" href="../tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="../tasks/preflight.html">preflight.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
View
22 doc/lib/recap/bootstrap.html → doc/lib/recap/tasks/bootstrap.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
View
26 doc/lib/recap/bundler.html → doc/lib/recap/tasks/bundler.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -48,8 +48,8 @@
<p>The bundler recipe ensures that the application bundle is installed whenever the code is updated.</p>
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Bundler</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span>
+ <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Tasks::Bundler</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span>
<span class="n">namespace</span> <span class="ss">:bundle</span> <span class="k">do</span></pre></div>
</td>
View
34 doc/lib/recap/deploy.html → doc/lib/recap/tasks/deploy.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -49,14 +49,14 @@
</td>
<td class=code>
<div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/capistrano_extensions&#39;</span>
+<span class="nb">require</span> <span class="s1">&#39;recap/support/capistrano_extensions&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/preflight&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/bootstrap&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/env&#39;</span>
+<span class="nb">require</span> <span class="s1">&#39;recap/tasks/preflight&#39;</span>
+<span class="nb">require</span> <span class="s1">&#39;recap/tasks/bootstrap&#39;</span>
+<span class="nb">require</span> <span class="s1">&#39;recap/tasks/env&#39;</span>
-<span class="k">module</span> <span class="nn">Recap::Deploy</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span>
+<span class="k">module</span> <span class="nn">Recap::Tasks::Deploy</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span>
<span class="n">namespace</span> <span class="ss">:deploy</span> <span class="k">do</span></pre></div>
</td>
View
42 doc/lib/recap/env.html → doc/lib/recap/tasks/env.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -54,10 +54,11 @@
</code></pre>
<p>The <code>.recap</code> script is automatically generated in the bootstrap process.</p>
+
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Env</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span>
+ <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Tasks::Env</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span>
<span class="k">def</span> <span class="nf">set_default_env</span><span class="p">(</span><span class="nb">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="n">default_env</span><span class="o">[</span><span class="nb">name</span><span class="o">]</span> <span class="o">=</span> <span class="n">value</span>
@@ -67,19 +68,8 @@
<span class="vi">@default_env</span> <span class="o">||=</span> <span class="p">{}</span>
<span class="k">end</span>
- <span class="n">namespace</span> <span class="ss">:env</span> <span class="k">do</span></pre></div>
- </td>
- </tr>
- <tr id='section-2'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>Environment</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:environment_file</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;/home/</span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2">/.env&quot;</span> <span class="p">}</span>
+ <span class="n">namespace</span> <span class="ss">:env</span> <span class="k">do</span>
+ <span class="n">set</span><span class="p">(</span><span class="ss">:environment_file</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;/home/</span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2">/.env&quot;</span> <span class="p">}</span>
<span class="k">def</span> <span class="nf">current_environment</span>
<span class="vi">@current_environment</span> <span class="o">||=</span> <span class="k">begin</span>
View
26 doc/lib/recap/foreman.html → doc/lib/recap/tasks/foreman.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -48,8 +48,8 @@
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Foreman</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span>
+ <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Tasks::Foreman</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span>
<span class="n">namespace</span> <span class="ss">:foreman</span> <span class="k">do</span></pre></div>
</td>
View
26 doc/lib/recap/preflight.html → doc/lib/recap/tasks/preflight.html
@@ -12,23 +12,23 @@
Jump To &hellip;
<div id="jump_wrapper">
<div id="jump_page">
- <a class="source" href="../../index.html">index.rb</a>
- <a class="source" href="../recap.html">recap.rb</a>
+ <a class="source" href="../../../index.html">index.rb</a>
+ <a class="source" href="../../recap.html">recap.rb</a>
+ <a class="source" href="../rails.html">rails.rb</a>
+ <a class="source" href="../ruby.html">ruby.rb</a>
+ <a class="source" href="../static.html">static.rb</a>
+ <a class="source" href="../support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="../support/cli.html">cli.rb</a>
+ <a class="source" href="../support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="../support/environment.html">environment.rb</a>
+ <a class="source" href="../support/namespace.html">namespace.rb</a>
<a class="source" href="bootstrap.html">bootstrap.rb</a>
<a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
<a class="source" href="deploy.html">deploy.rb</a>
<a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
<a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
<a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.rb</a>
- <a class="source" href="ruby.html">ruby.rb</a>
- <a class="source" href="static.html">static.rb</a>
- <a class="source" href="version.html">version.rb</a>
+ <a class="source" href="../version.html">version.rb</a>
</div>
</div>
</div>
@@ -65,8 +65,8 @@
should a check fail.</p>
</td>
<td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Preflight</span>
- <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Namespace</span>
+ <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Tasks::Preflight</span>
+ <span class="kp">extend</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">Namespace</span>
<span class="n">namespace</span> <span class="ss">:preflight</span> <span class="k">do</span></pre></div>
</td>
View
22 doc/lib/recap/version.html
@@ -14,20 +14,20 @@
<div id="jump_page">
<a class="source" href="../../index.html">index.rb</a>
<a class="source" href="../recap.html">recap.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="capistrano_extensions.html">capistrano_extensions.rb</a>
- <a class="source" href="cli.html">cli.rb</a>
- <a class="source" href="compatibility.html">compatibility.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="environment.html">environment.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="namespace.html">namespace.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
<a class="source" href="rails.html">rails.rb</a>
<a class="source" href="ruby.html">ruby.rb</a>
<a class="source" href="static.html">static.rb</a>
+ <a class="source" href="support/capistrano_extensions.html">capistrano_extensions.rb</a>
+ <a class="source" href="support/cli.html">cli.rb</a>
+ <a class="source" href="support/compatibility.html">compatibility.rb</a>
+ <a class="source" href="support/environment.html">environment.rb</a>
+ <a class="source" href="support/namespace.html">namespace.rb</a>
+ <a class="source" href="tasks/bootstrap.html">bootstrap.rb</a>
+ <a class="source" href="tasks/bundler.html">bundler.rb</a>
+ <a class="source" href="tasks/deploy.html">deploy.rb</a>
+ <a class="source" href="tasks/env.html">env.rb</a>
+ <a class="source" href="tasks/foreman.html">foreman.rb</a>
+ <a class="source" href="tasks/preflight.html">preflight.rb</a>
<a class="source" href="version.html">version.rb</a>
</div>
</div>
View
21 lib/recap.rb
@@ -1,12 +1,17 @@
module Recap
- autoload :Namespace, 'recap/namespace'
+ module Support
+ autoload :Namespace, 'recap/support/namespace'
+ autoload :Compatibility, 'recap/support/compatibility'
+ autoload :Environment, 'recap/support/environment'
+ end
+
+ module Tasks
+ autoload :Bootstrap, 'recap/tasks/bootstrap'
+ autoload :Bundler, 'recap/tasks/bundler'
+ autoload :Deploy, 'recap/tasks/deploy'
+ autoload :Env, 'recap/tasks/env'
+ autoload :Foreman, 'recap/tasks/foreman'
+ end
- autoload :Bootstrap, 'recap/bootstrap'
- autoload :Bundler, 'recap/bundler'
- autoload :Compatibility, 'recap/compatibility'
- autoload :Deploy, 'recap/deploy'
- autoload :Env, 'recap/env'
- autoload :Environment, 'recap/environment'
- autoload :Foreman, 'recap/foreman'
autoload :Rails, 'recap/rails'
end
View
76 lib/recap/capistrano_extensions.rb
@@ -1,76 +0,0 @@
-require 'tempfile'
-
-module Recap
- module CapistranoExtensions
- # Run a command as the given user
- def as_user(user, command, pwd = deploy_to)
- sudo "su - #{user} -c 'cd #{pwd} && #{command}'"
- end
-
- # Run a command as root
- def as_root(command, pwd = deploy_to)
- as_user 'root', command, pwd
- end
-
- # Run a command as the application user
- def as_app(command, pwd = deploy_to)
- as_user application_user, command, pwd
- end
-
- # Put a string into a file as the application user
- def put_as_app(string, path)
- put string, "/tmp/recap-put-as-app"
- as_app "cp /tmp/recap-put-as-app #{path} && chmod g+rw #{path}", "/"
- ensure
- run "rm /tmp/recap-put-as-app"
- end
-
- # Edit a file on the remote server, using a local editor
- def edit_file(path)
- if editor = ENV['DEPLOY_EDITOR'] || ENV['EDITOR']
- as_app "touch #{path} && chmod g+rw #{path}"
- local_path = Tempfile.new('deploy-edit').path
- get(path, local_path)
- `#{editor} #{local_path}`
- File.read(local_path)
- else
- abort "To edit a remote file, either the EDITOR or DEPLOY_EDITOR environment variables must be set"
- end
- end
-
- # Run a git command in the `deploy_to` directory
- def git(command)
- run "cd #{deploy_to} && umask 002 && sg #{application_group} -c \"git #{command}\""
- end
-
- # Capture the result of a git command run within the `deploy_to` directory
- def capture_git(command)
- capture "cd #{deploy_to} && umask 002 && sg #{application_group} -c 'git #{command}'"
- end
-
- def exit_code(command)
- capture("#{command} > /dev/null 2>&1; echo $?").strip
- end
-
- # Find the latest tag from the repository. As `git tag` returns tags in order, and our release
- # tags are timestamps, the latest tag will always be the last in the list.
- def latest_tag_from_repository
- result = capture_git("tag | tail -n1").strip
- result.empty? ? nil : result
- end
-
- # Does the given file exist within the deployment directory?
- def deployed_file_exists?(path)
- exit_code("cd #{deploy_to} && [ -f #{path} ]") == "0"
- end
-
- # Has the given path been created or changed since the previous deployment? During the first
- # successful deployment this will always return true.
- def deployed_file_changed?(path)
- return true unless latest_tag
- exit_code("cd #{deploy_to} && git diff --exit-code #{latest_tag} origin/#{branch} #{path}") == "1"
- end
-
- Capistrano::Configuration.send :include, self
- end
-end
View
54 lib/recap/environment.rb
@@ -1,54 +0,0 @@
-class Recap::Environment
- def initialize(variables = {})
- @variables = variables
- end
-
- def get(name)
- @variables[name]
- end
-
- def set(name, value)
- if value.nil? || value.empty?
- @variables.delete(name)
- else
- @variables[name] = value
- end
- end
-
- def set_string(string)
- if string =~ /\A([A-Za-z0-9_]+)=(.*)\z/
- set $1, $2
- end
- end
-
- def empty?
- @variables.empty?
- end
-
- def merge(hash)
- hash.each {|k, v| set(k, v)}
- end
-
- def each(&block)
- @variables.sort.each(&block)
- end
-
- def include?(key)
- @variables.include?(key)
- end
-
- def to_s
- @variables.keys.sort.map do |key|
- key + "=" + @variables[key] + "\n" if @variables[key]
- end.compact.join
- end
-
- class << self
- def from_string(string)
- string.split(/[\n\r]/).inject(new) do |env, line|
- env.set_string(line)
- env
- end
- end
- end
-end
View
4 lib/recap/rails.rb
@@ -1,7 +1,7 @@
-require 'recap/deploy'
+require 'recap/tasks/deploy'
module Recap::Rails
- extend Recap::Namespace
+ extend Recap::Support::Namespace
namespace :rails do
namespace :db do
View
6 lib/recap/ruby.rb
@@ -1,3 +1,3 @@
-require 'recap/deploy'
-require 'recap/bundler'
-require 'recap/foreman'
+require 'recap/tasks/deploy'
+require 'recap/tasks/bundler'
+require 'recap/tasks/foreman'
View
2  lib/recap/static.rb
@@ -1 +1 @@
-require 'recap/deploy'
+require 'recap/tasks/deploy'
View
74 lib/recap/support/capistrano_extensions.rb
@@ -0,0 +1,74 @@
+require 'tempfile'
+
+module Recap::Support::CapistranoExtensions
+ # Run a command as the given user
+ def as_user(user, command, pwd = deploy_to)
+ sudo "su - #{user} -c 'cd #{pwd} && #{command}'"
+ end
+
+ # Run a command as root
+ def as_root(command, pwd = deploy_to)
+ as_user 'root', command, pwd
+ end
+
+ # Run a command as the application user
+ def as_app(command, pwd = deploy_to)
+ as_user application_user, command, pwd
+ end
+
+ # Put a string into a file as the application user
+ def put_as_app(string, path)
+ put string, "/tmp/recap-put-as-app"
+ as_app "cp /tmp/recap-put-as-app #{path} && chmod g+rw #{path}", "/"
+ ensure
+ run "rm /tmp/recap-put-as-app"
+ end
+
+ # Edit a file on the remote server, using a local editor
+ def edit_file(path)
+ if editor = ENV['DEPLOY_EDITOR'] || ENV['EDITOR']
+ as_app "touch #{path} && chmod g+rw #{path}"
+ local_path = Tempfile.new('deploy-edit').path
+ get(path, local_path)
+ `#{editor} #{local_path}`
+ File.read(local_path)
+ else
+ abort "To edit a remote file, either the EDITOR or DEPLOY_EDITOR environment variables must be set"
+ end
+ end
+
+ # Run a git command in the `deploy_to` directory
+ def git(command)
+ run "cd #{deploy_to} && umask 002 && sg #{application_group} -c \"git #{command}\""
+ end
+
+ # Capture the result of a git command run within the `deploy_to` directory
+ def capture_git(command)
+ capture "cd #{deploy_to} && umask 002 && sg #{application_group} -c 'git #{command}'"
+ end
+
+ def exit_code(command)
+ capture("#{command} > /dev/null 2>&1; echo $?").strip
+ end
+
+ # Find the latest tag from the repository. As `git tag` returns tags in order, and our release
+ # tags are timestamps, the latest tag will always be the last in the list.
+ def latest_tag_from_repository
+ result = capture_git("tag | tail -n1").strip
+ result.empty? ? nil : result
+ end
+
+ # Does the given file exist within the deployment directory?
+ def deployed_file_exists?(path)
+ exit_code("cd #{deploy_to} && [ -f #{path} ]") == "0"
+ end
+
+ # Has the given path been created or changed since the previous deployment? During the first
+ # successful deployment this will always return true.
+ def deployed_file_changed?(path)
+ return true unless latest_tag
+ exit_code("cd #{deploy_to} && git diff --exit-code #{latest_tag} origin/#{branch} #{path}") == "1"
+ end
+
+ Capistrano::Configuration.send :include, self
+end
View
6 lib/recap/cli.rb → lib/recap/support/cli.rb
@@ -1,13 +1,13 @@
require 'thor'
-module Recap
+module Recap::Support
class CLI < Thor
include Thor::Actions
attr_accessor :name, :repository
def self.source_root
- File.expand_path("../deploy/templates", __FILE__)
+ File.expand_path("../templates", __FILE__)
end
desc 'setup', 'Setup basic capistrano recipes, e.g: recap setup'
@@ -29,4 +29,4 @@ def guess_repository
`git remote -v`.split[1]
end
end
-end
+end
View
4 lib/recap/compatibility.rb → lib/recap/support/compatibility.rb
@@ -5,8 +5,8 @@
# Including this recipe adds these legacy settings, but provides no guarantee that original tasks
# will work. Many are based on assumptions about the deployment layout that no longer hold true.
-module Recap::Compatibility
- extend Recap::Namespace
+module Recap::Support::Compatibility
+ extend Recap::Support::Namespace
# As `git` to manages releases, all deployments are placed directly in the `deploy_to` folder. The
# `current_path` is always this directory (no symlinking required).
View
56 lib/recap/support/environment.rb
@@ -0,0 +1,56 @@
+module Recap::Support
+ class Environment
+ def initialize(variables = {})
+ @variables = variables
+ end
+
+ def get(name)
+ @variables[name]
+ end
+
+ def set(name, value)
+ if value.nil? || value.empty?
+ @variables.delete(name)
+ else
+ @variables[name] = value
+ end
+ end
+
+ def set_string(string)
+ if string =~ /\A([A-Za-z0-9_]+)=(.*)\z/
+ set $1, $2
+ end
+ end
+
+ def empty?
+ @variables.empty?
+ end
+
+ def merge(hash)
+ hash.each {|k, v| set(k, v)}
+ end
+
+ def each(&block)
+ @variables.sort.each(&block)
+ end
+
+ def include?(key)
+ @variables.include?(key)
+ end
+
+ def to_s
+ @variables.keys.sort.map do |key|
+ key + "=" + @variables[key] + "\n" if @variables[key]
+ end.compact.join
+ end
+
+ class << self
+ def from_string(string)
+ string.split(/[\n\r]/).inject(new) do |env, line|
+ env.set_string(line)
+ env
+ end
+ end
+ end
+ end
+end
View
6 lib/recap/namespace.rb → lib/recap/support/namespace.rb
@@ -1,7 +1,7 @@
require 'capistrano'
-require 'recap/capistrano_extensions'
+require 'recap/support/capistrano_extensions'
-module Recap::Namespace
+module Recap::Support::Namespace
def self.default_config
@default_config
end