Browse files

Host documentation at gofreerange.com/recap/docs

It's quite simple to upload the files to our server; in the virtual host
for Apache, I've added the following configuration:

    AliasMatch ^/recap/docs(.*)$ /home/freerange/docs/recap$1
    <Directory "/home/freerange/docs/recap">
      PassengerEnabled off
      AllowOverride all
      allow from all
      Options +Indexes
    </Directory>

Since with this change we wouldn't use github to host the docs, we don't
need the documentation in git, so I've also removed the files and
ignored the `doc` directory. If this is acceptable, we can also remove
the gh-pages branch.
  • Loading branch information...
1 parent 17e5c7c commit c3cd8c57b3fcb6e1ab308cc429d21856b25fedb3 @lazyatom lazyatom committed May 4, 2012
View
3 .gitignore
@@ -4,4 +4,5 @@
Gemfile.lock
pkg/*
/test-vm/share/*
-capistrano.log
+capistrano.log
+doc
View
6 Rakefile
@@ -22,11 +22,7 @@ end
desc 'publish docs'
task :publish do
- sha = `git ls-tree -d HEAD doc | awk '{print $3}'`.strip
- commit = `echo "Publishing docs from master branch" | git commit-tree #{sha} -p refs/heads/gh-pages`.strip
- `git update-ref refs/heads/gh-pages #{commit}`
- puts "The gh-pages branch now points to the latest version of the docs."
- puts "All that remains is for you to push gh-pages to github."
+ `scp -r doc/* gofreerange.com:/home/freerange/docs/recap`
end
RSpec::Core::RakeTask.new(:spec) do |t|
View
1 doc/index.html
@@ -1 +0,0 @@
- <html><meta http-equiv="refresh" content="0; url=recap.html">
View
223 doc/recap.html
@@ -1,223 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>recap.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="recap.html">recap.rb</a>
- <a class="source" href="recap/recipes/rails.html">rails.rb</a>
- <a class="source" href="recap/recipes/ruby.html">ruby.rb</a>
- <a class="source" href="recap/recipes/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/support/shell_command.html">shell_command.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/tasks/rails.html">rails.rb</a>
- <a class="source" href="recap/version.html">version.rb</a>
- </div>
- </div>
- </div>
- <table cellspacing=0 cellpadding=0>
- <thead>
- <tr>
- <th class=docs><h1>recap.rb</h1></th>
- <th class=code></th>
- </tr>
- </thead>
- <tbody>
- <tr id='section-Getting_started'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-Getting_started">&#182;</a>
- </div>
- <p>This is the documentation for <a href="http://github.com/freerange/recap">recap</a>, a simple, opinionated
-set of capistrano deployment recipes.</p>
-
-<p>Inspired in part by
-<a href="https://github.com/blog/470-deployment-script-spring-cleaning">this blog post</a>, these recipes use
-git&rsquo;s strengths to deploy applications in a faster, simpler manner than the standard capistrano
-deployment.</p>
-
-<h3>Getting started</h3>
-
-<p>To use recap you&rsquo;ll need to install the gem, most likely by adding an entry like the following to
-the <code>Gemfile</code>, then running <code>bundle install</code>.</p>
-
-<pre>gem &lsquo;recap&rsquo;, &lsquo;~>1.0.0&rsquo;</pre>
-
-<p>Once the gem is installed, generate a <code>Capfile</code> by running <code>recap setup</code> within your project
-folder. You can see the supported options with <code>recap help setup</code>. The generated <code>Capfile</code>
-will look something like this:</p>
-
-<pre>require &lsquo;recap/recipes/rails&rsquo;
-
-set :application, &lsquo;example-app&rsquo;
-set :repository, &lsquo;git@example.com:example/example-app.git&rsquo;
-
-server &lsquo;server.example.com&rsquo;, :app</pre>
-
-<p>Edit the <code>Capfile</code> to point at your deployment server and you should be ready to go. <code>cap -T</code>
-will show all the available tasks. Before you can deploy an app the server needs to be setup, and
-there are tasks to do this. Running <code>cap bootstrap</code> will add the application user and directory.
-Next <code>cap deploy:setup</code> clones your code and gets everything ready for the first deployment.</p>
-
-<p>Finally <code>cap deploy</code> will deploy your app.</p>
-
-<h3>Using git to manage deployments</h3>
-
-<p>Releases are managed using git. All code is deployed to a single directory, and git tags are used
-to manage different released versions. No <code>releases</code>, <code>current</code> or <code>shared</code> directories are
-created, avoiding unecessary symlinking. For more information on how releases work, see
-<a href="recap/tasks/deploy.html">recap/tasks/deploy.rb</a></p>
-
-<p>Deployments do the minimum work possible, using git to determine whether tasks need to run. e.g.
-the <code>bundle:install</code> task only runs if the app contains a <code>Gemfile.lock</code> file and it has changed
-since the last deployment. You can see how this works in the
-<a href="recap/tasks/bundler.html">recap/tasks/bundler.rb</a> recipe.</p>
-
-<h3>Deployment user accounts</h3>
-
-<p>Applications have their own user account and group, owning all of that application&rsquo;s associated
-files and processes. This gives them a dedicated environment, allowing environment variables to
-be used for application specific configuration. Tasks such as <code>env</code>, <code>env:set</code> and <code>env:edit</code> make
-setting and changing these variables easy. <a href="recap/tasks/env.html">recap/tasks/env.rb</a> has more
-information about using these environment variables.</p>
-
-<p>Personal accounts are used to deploy to the server, distinct from the application user. The right
-to deploy an application is granted simply by adding a user to the application group. Most tasks
-are run as the application user using <code>sudo su&hellip;</code>. To avoid having to enter a password when
-running them, these lines can be added to <code>/etc/sudoers.d/application</code>
-(change <code>application</code> to the name of your app).</p>
-
-<pre>%application ALL=NOPASSWD: /sbin/start application*
-%application ALL=NOPASSWD: /sbin/stop application*
-%application ALL=NOPASSWD: /sbin/restart application*
-%application ALL=NOPASSWD: /bin/su &ndash; application*
-%application ALL=NOPASSWD: /bin/su application*</pre>
-
-<h3>Deployment target</h3>
-
-<p>These recipes have been developed and tested using Ubuntu 11.04, though they may work well with
-other flavours of unix.</p>
-
-<p>The application should be run as the application user; if using Apache and Passenger, you should
-set the <code>PassengerDefaultUser</code> directive to be the same as the <code>application_user</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre></pre></div>
- </td>
- </tr>
- <tr id='section-Code_layout'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-Code_layout">&#182;</a>
- </div>
- <h3>Code layout</h3>
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap</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>The main deployment tasks are defined in <a href="recap/tasks/deploy.html">recap/tasks/deploy.rb</a>. Automatic
-checks to ensure servers and users are correctly setup are in
-<a href="recap/tasks/preflight.html">recap/tasks/preflight.rb</a>, while tasks to bootstrap the machine and users
-are in <a href="recap/tasks/bootstrap.html">recap/tasks/bootstrap.rb</a>. Tasks to alter environment variables are
-in <a href="recap/tasks/env.html">recap/tasks/env.rb</a></p>
-
-<p>In addition, there are extensions for <a href="recap/tasks/bundler.html">bundler</a> and
-<a href="recap/tasks/foreman.html">foreman</a></p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">module</span> <span class="nn">Tasks</span>
- <span class="nb">autoload</span> <span class="ss">:Bootstrap</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/bootstrap&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Bundler</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/bundler&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Deploy</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/deploy&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Env</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/env&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Foreman</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/foreman&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Preflight</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/preflight&#39;</span></pre></div>
- </td>
- </tr>
- <tr id='section-4'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-4">&#182;</a>
- </div>
- <p>Deploying <a href="recap/recipes/rails.html">Rails</a> requires a bit of extra work to ensure that migrations and run and
-assets are generated. These can be included by simply requiring <code>recap/recipes/rails</code> instead of <code>recap/recipes/static</code>
-or <code>recap/recipes/ruby</code> in your <code>Capfile</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="nb">autoload</span> <span class="ss">:Rails</span><span class="p">,</span> <span class="s1">&#39;recap/tasks/rails&#39;</span>
- <span class="k">end</span>
-
- <span class="k">module</span> <span class="nn">Support</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>For limited compatibility with other existing Capistrano recipes, that were not built for recap,
-see <a href="recap/support/compatibility.html">compatibility</a>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="nb">autoload</span> <span class="ss">:Compatibility</span><span class="p">,</span> <span class="s1">&#39;recap/support/compatibility&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Namespace</span><span class="p">,</span> <span class="s1">&#39;recap/support/namespace&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:Environment</span><span class="p">,</span> <span class="s1">&#39;recap/support/environment&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:ShellCommand</span><span class="p">,</span> <span class="s1">&#39;recap/support/shell_command&#39;</span>
- <span class="nb">autoload</span> <span class="ss">:CLI</span><span class="p">,</span> <span class="s1">&#39;recap/support/cli&#39;</span>
- <span class="k">end</span></pre></div>
- </td>
- </tr>
- <tr id='section-Versioning'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-Versioning">&#182;</a>
- </div>
- <h3>Versioning</h3>
-
-<p>recap uses <a href="http://semver.org/">semantic versioning</a>, so things may change before the <code>1.0.0</code>
-release.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="nb">autoload</span> <span class="ss">:Version</span><span class="p">,</span> <span class="s1">&#39;recap/version&#39;</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>The code is available <a href="http://github.com/freerange/recap">on github</a> and released under the
-<a href="https://github.com/freerange/recap/blob/master/LICENSE">MIT License</a></p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
70 doc/recap/recipes/rails.html
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>rails.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="../../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="../support/shell_command.html">shell_command.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="../tasks/rails.html">rails.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>rails.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>
- <p>The <code>recap/recipes/rails</code> builds on the <a href="recap/recipes/ruby.html">ruby</a>
-recipe, which provides support for both <code>bundler</code> and <code>foreman</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/recipes/ruby&#39;</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>It adds to this with a number of rails specific tasks.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/tasks/rails&#39;</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
83 doc/recap/recipes/ruby.html
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>ruby.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="../../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="../support/shell_command.html">shell_command.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="../tasks/rails.html">rails.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>ruby.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>
- <p>Require <code>recap/recipes/ruby</code> in your <code>Capfile</code> to use the default recap recipies for deploying a
-Ruby application.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/tasks/deploy&#39;</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>If your application uses Bundler, <code>bundle install</code> will be run automatically when deploying
-any changes to your <code>Gemfile</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/tasks/bundler&#39;</span></pre></div>
- </td>
- </tr>
- <tr id='section-3'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-3">&#182;</a>
- </div>
- <p>If your application uses Foreman, recap will use that to stop, start and restart your
-application processes.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/tasks/foreman&#39;</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
59 doc/recap/recipes/static.html
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>static.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="../../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="../support/shell_command.html">shell_command.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="../tasks/rails.html">rails.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>static.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>
- <p>Require <code>recap/recipes/static</code> if you are deploying a simple application which doesn&rsquo;t use
-Rails, Bundler or Foreman.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="nb">require</span> <span class="s1">&#39;recap/tasks/deploy&#39;</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
230 doc/recap/support/capistrano_extensions.html
@@ -1,230 +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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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></pre></div>
- </td>
- </tr>
- <tr id='section-2'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>These methods are used by recap tasks to run commands and detect when files have changed
-as part of a deployments</p>
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Support::CapistranoExtensions</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 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-4'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-4">&#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-5'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-5">&#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-6'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-6">&#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>
-
- <span class="k">def</span> <span class="nf">editor</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="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>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="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="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">ShellCommand</span><span class="o">.</span><span class="n">execute_interactive</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">#{</span><span class="n">editor</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">local_path</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</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-8'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-8">&#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-9'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-9">&#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>
-
- <span class="k">def</span> <span class="nf">exit_code_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">capture</span><span class="p">(</span><span class="sx">%|sudo -p &#39;sudo password: &#39; su - </span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="sx"> -c &#39;cd </span><span class="si">#{</span><span class="n">pwd</span><span class="si">}</span><span class="sx"> &amp;&amp; </span><span class="si">#{</span><span class="n">command</span><span class="si">}</span><span class="sx"> &gt; /dev/null 2&gt;&amp;1&#39;; echo $?|</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-10'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-10">&#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-11'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-11">&#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-12'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-12">&#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
121 doc/recap/support/cli.html
@@ -1,121 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>cli.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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>cli.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;thor&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/support/shell_command&#39;</span>
-
-<span class="k">module</span> <span class="nn">Recap::Support</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>Recap provides a simple command-line tool (<code>recap</code>) to generate a <code>Capfile</code> in your
-project.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">class</span> <span class="nc">CLI</span> <span class="o">&lt;</span> <span class="no">Thor</span>
- <span class="kp">include</span> <span class="no">Thor</span><span class="o">::</span><span class="no">Actions</span>
-
- <span class="kp">attr_accessor</span> <span class="ss">:name</span><span class="p">,</span> <span class="ss">:repository</span><span class="p">,</span> <span class="ss">:recipe</span><span class="p">,</span> <span class="ss">:server</span>
-
- <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">source_root</span>
- <span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="s2">&quot;../templates&quot;</span><span class="p">,</span> <span class="bp">__FILE__</span><span class="p">)</span>
- <span class="k">end</span>
-
- <span class="n">desc</span> <span class="s1">&#39;setup&#39;</span><span class="p">,</span> <span class="s1">&#39;Setup basic capistrano recipes, e.g: recap setup&#39;</span>
- <span class="n">method_option</span> <span class="ss">:name</span>
- <span class="n">method_option</span> <span class="ss">:repository</span>
- <span class="n">method_option</span> <span class="ss">:server</span>
- <span class="n">method_option</span> <span class="ss">:recipe</span><span class="p">,</span> <span class="ss">:type</span> <span class="o">=&gt;</span> <span class="s1">&#39;string&#39;</span><span class="p">,</span> <span class="ss">:banner</span> <span class="o">=&gt;</span> <span class="s1">&#39;static|ruby|rails&#39;</span>
-
- <span class="k">def</span> <span class="nf">setup</span>
- <span class="nb">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">options</span><span class="o">[</span><span class="s2">&quot;name&quot;</span><span class="o">]</span> <span class="o">||</span> <span class="n">guess_name</span>
- <span class="nb">self</span><span class="o">.</span><span class="n">repository</span> <span class="o">=</span> <span class="n">options</span><span class="o">[</span><span class="s2">&quot;repo&quot;</span><span class="o">]</span> <span class="o">||</span> <span class="n">guess_repository</span>
- <span class="nb">self</span><span class="o">.</span><span class="n">recipe</span> <span class="o">=</span> <span class="n">options</span><span class="o">[</span><span class="s2">&quot;recipe&quot;</span><span class="o">]</span> <span class="o">||</span> <span class="n">guess_recipe</span>
- <span class="nb">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">options</span><span class="o">[</span><span class="s2">&quot;server&quot;</span><span class="o">]</span> <span class="o">||</span> <span class="s1">&#39;your-server-address&#39;</span>
- <span class="n">template</span> <span class="s1">&#39;Capfile.erb&#39;</span><span class="p">,</span> <span class="s1">&#39;Capfile&#39;</span>
- <span class="k">end</span>
-
- <span class="kp">private</span>
-
- <span class="k">def</span> <span class="nf">guess_name</span>
- <span class="no">Dir</span><span class="o">.</span><span class="n">pwd</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="no">File</span><span class="o">::</span><span class="no">SEPARATOR</span><span class="p">)</span><span class="o">.</span><span class="n">last</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">guess_repository</span>
- <span class="no">ShellCommand</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s1">&#39;git remote -v&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="o">[</span><span class="mi">1</span><span class="o">]</span>
- <span class="k">rescue</span>
- <span class="nb">warn</span> <span class="s2">&quot;Unable to determine git repository. Setting to &lt;unknown&gt;.&quot;</span>
- <span class="s2">&quot;&lt;unknown&gt;&quot;</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">guess_recipe</span>
- <span class="k">if</span> <span class="no">File</span><span class="o">.</span><span class="n">exist?</span><span class="p">(</span><span class="s1">&#39;Gemfile.lock&#39;</span><span class="p">)</span>
- <span class="k">if</span> <span class="no">File</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s1">&#39;Gemfile.lock&#39;</span><span class="p">)</span> <span class="o">=~</span> <span class="sr">/ rails /</span>
- <span class="s1">&#39;rails&#39;</span>
- <span class="k">else</span>
- <span class="s1">&#39;ruby&#39;</span>
- <span class="k">end</span>
- <span class="k">else</span>
- <span class="s1">&#39;static&#39;</span>
- <span class="k">end</span>
- <span class="k">end</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
77 doc/recap/support/compatibility.html
@@ -1,77 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>compatibility.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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>compatibility.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>
- <p><code>recap</code> isn&rsquo;t intended to be compatible with tasks (such as those within the <code>bundler</code>
-or <code>whenever</code> projects) that are built on the original capistrano deployment recipes. At times
-though there are tasks that would work, but for some missing (and redundant) settings.</p>
-
-<p>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.</p>
- </td>
- <td class=code>
- <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'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>As <code>git</code> to manages releases, all deployments are placed directly in the <code>deploy_to</code> folder. The
-<code>current_path</code> is always this directory (no symlinking required).</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:current_path</span><span class="p">)</span> <span class="p">{</span> <span class="n">deploy_to</span> <span class="p">}</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
125 doc/recap/support/environment.html
@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>environment.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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>environment.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="k">module</span> <span class="nn">Recap::Support</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>This class is used to manipulate environment variables on the remote server.
-You should not need to use it directly; you are probably looking for the
-<a href="../tasks/env.html">env</a> tasks instead.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="k">class</span> <span class="nc">Environment</span>
- <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">variables</span> <span class="o">=</span> <span class="p">{})</span>
- <span class="vi">@variables</span> <span class="o">=</span> <span class="n">variables</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
- <span class="vi">@variables</span><span class="o">[</span><span class="nb">name</span><span class="o">]</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">set</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="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">nil?</span> <span class="o">||</span> <span class="n">value</span><span class="o">.</span><span class="n">empty?</span>
- <span class="vi">@variables</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
- <span class="k">else</span>
- <span class="vi">@variables</span><span class="o">[</span><span class="nb">name</span><span class="o">]</span> <span class="o">=</span> <span class="n">value</span>
- <span class="k">end</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">set_string</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
- <span class="k">if</span> <span class="n">string</span> <span class="o">=~</span> <span class="sr">/\A([A-Za-z0-9_]+)=(.*)\z/</span>
- <span class="n">set</span> <span class="vg">$1</span><span class="p">,</span> <span class="vg">$2</span>
- <span class="k">end</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">empty?</span>
- <span class="vi">@variables</span><span class="o">.</span><span class="n">empty?</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">merge</span><span class="p">(</span><span class="nb">hash</span><span class="p">)</span>
- <span class="nb">hash</span><span class="o">.</span><span class="n">each</span> <span class="p">{</span><span class="o">|</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="o">|</span> <span class="n">set</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)}</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">each</span><span class="p">(</span><span class="o">&amp;</span><span class="n">block</span><span class="p">)</span>
- <span class="vi">@variables</span><span class="o">.</span><span class="n">sort</span><span class="o">.</span><span class="n">each</span><span class="p">(</span><span class="o">&amp;</span><span class="n">block</span><span class="p">)</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">include?</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
- <span class="vi">@variables</span><span class="o">.</span><span class="n">include?</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">to_s</span>
- <span class="vi">@variables</span><span class="o">.</span><span class="n">keys</span><span class="o">.</span><span class="n">sort</span><span class="o">.</span><span class="n">map</span> <span class="k">do</span> <span class="o">|</span><span class="n">key</span><span class="o">|</span>
- <span class="n">key</span> <span class="o">+</span> <span class="s2">&quot;=&quot;</span> <span class="o">+</span> <span class="vi">@variables</span><span class="o">[</span><span class="n">key</span><span class="o">]</span> <span class="o">+</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="vi">@variables</span><span class="o">[</span><span class="n">key</span><span class="o">]</span>
- <span class="k">end</span><span class="o">.</span><span class="n">compact</span><span class="o">.</span><span class="n">join</span>
- <span class="k">end</span>
-
- <span class="k">class</span> <span class="o">&lt;&lt;</span> <span class="nb">self</span>
- <span class="k">def</span> <span class="nf">from_string</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
- <span class="n">string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="sr">/[\n\r]/</span><span class="p">)</span><span class="o">.</span><span class="n">inject</span><span class="p">(</span><span class="kp">new</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">env</span><span class="p">,</span> <span class="n">line</span><span class="o">|</span>
- <span class="n">env</span><span class="o">.</span><span class="n">set_string</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
- <span class="n">env</span>
- <span class="k">end</span>
- <span class="k">end</span>
- <span class="k">end</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
111 doc/recap/support/namespace.html
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>namespace.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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>namespace.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;capistrano&#39;</span>
-<span class="nb">require</span> <span class="s1">&#39;recap/support/capistrano_extensions&#39;</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>This module is used to capture the definition of capistrano tasks, which makes it
-easier to test the behaviour of specific tasks without loading everything. If you
-are writing tests for a collection of tasks, you should put those tasks in a module
-and extend that module with Recap::Support::Namespace.</p>
-
-<p>You can look at some of the existing tasks (such as <a href="../tasks/env.html">env</a>) and
-its corresponding specs for an example of this in practice.</p>
-
-<p>You should not need to use this module directly when using recap to deploy.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Support::Namespace</span>
- <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">default_config</span>
- <span class="vi">@default_config</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">default_config</span><span class="o">=</span><span class="p">(</span><span class="n">config</span><span class="p">)</span>
- <span class="vi">@default_config</span> <span class="o">=</span> <span class="n">config</span>
- <span class="k">end</span>
-
- <span class="k">if</span> <span class="no">Capistrano</span><span class="o">::</span><span class="no">Configuration</span><span class="o">.</span><span class="n">instance</span>
- <span class="nb">self</span><span class="o">.</span><span class="n">default_config</span> <span class="o">=</span> <span class="no">Capistrano</span><span class="o">::</span><span class="no">Configuration</span><span class="o">.</span><span class="n">instance</span><span class="p">(</span><span class="ss">:must_exist</span><span class="p">)</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">capistrano_definitions</span>
- <span class="vi">@capistrano_definitions</span> <span class="o">||=</span> <span class="o">[]</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">namespace</span><span class="p">(</span><span class="nb">name</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">block</span><span class="p">)</span>
- <span class="n">capistrano_definitions</span> <span class="o">&lt;&lt;</span> <span class="no">Proc</span><span class="o">.</span><span class="n">new</span> <span class="k">do</span>
- <span class="n">namespace</span> <span class="nb">name</span> <span class="k">do</span>
- <span class="nb">instance_eval</span><span class="p">(</span><span class="o">&amp;</span><span class="n">block</span><span class="p">)</span>
- <span class="k">end</span>
- <span class="k">end</span>
-
- <span class="n">load_into</span><span class="p">(</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="o">.</span><span class="n">default_config</span><span class="p">)</span> <span class="k">if</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="o">.</span><span class="n">default_config</span>
- <span class="k">end</span>
-
- <span class="k">def</span> <span class="nf">load_into</span><span class="p">(</span><span class="n">configuration</span><span class="p">)</span>
- <span class="n">configuration</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="nb">self</span><span class="p">)</span>
- <span class="n">capistrano_definitions</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">definition</span><span class="o">|</span>
- <span class="n">configuration</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="o">&amp;</span><span class="n">definition</span><span class="p">)</span>
- <span class="k">end</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
46 doc/recap/support/shell_command.html
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>shell_command.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="shell_command.html">shell_command.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="../tasks/rails.html">rails.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>shell_command.rb</h1></th>
- <th class=code></th>
- </tr>
- </thead>
- <tbody>
- </table>
-</div>
-</body>
View
105 doc/recap/tasks/bootstrap.html
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>bootstrap.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="../support/shell_command.html">shell_command.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.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>bootstrap.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>
- <p>These tasks are used to perform the initial configuration of your servers
-for deployment with recap.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre><span class="k">module</span> <span class="nn">Recap::Tasks::Bootstrap</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">:bootstrap</span> <span class="k">do</span>
- <span class="n">set</span><span class="p">(</span><span class="ss">:remote_username</span><span class="p">)</span> <span class="p">{</span> <span class="n">capture</span><span class="p">(</span><span class="s1">&#39;whoami&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span> <span class="p">}</span>
- <span class="n">set</span><span class="p">(</span><span class="ss">:application_home</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">&quot;</span><span class="p">}</span>
-
- <span class="n">task</span> <span class="ss">:default</span> <span class="k">do</span>
- <span class="n">application</span>
- <span class="n">user</span>
- <span class="k">end</span>
-
- <span class="n">desc</span> <span class="s1">&#39;Sets up the server account used by the application, including home directory and environment support&#39;</span>
- <span class="n">task</span> <span class="ss">:application</span> <span class="k">do</span>
- <span class="k">if</span> <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;id </span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span> <span class="o">!=</span> <span class="s2">&quot;0&quot;</span>
- <span class="n">sudo</span> <span class="s2">&quot;useradd </span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2"> -d </span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">&quot;</span>
- <span class="k">end</span>
- <span class="n">sudo</span> <span class="s2">&quot;mkdir -p </span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">&quot;</span>
- <span class="n">sudo</span> <span class="s2">&quot;chown </span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2">:</span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">&quot;</span>
- <span class="n">sudo</span> <span class="s2">&quot;chmod 755 </span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">&quot;</span>
-
- <span class="n">put_as_app</span> <span class="sx">%{</span>
-<span class="sx">if [ -s &quot;$HOME/.env&quot; ]; then</span>
-<span class="sx"> sed -e &#39;s/\\r//g&#39; -e &#39;s/^/export /g&#39; .env &gt; .recap-env-export</span>
-<span class="sx"> . $HOME/.recap-env-export</span>
-<span class="sx">fi</span>
-<span class="sx"> }</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">/.recap&quot;</span>
-
- <span class="n">as_app</span> <span class="s2">&quot;touch .profile&quot;</span><span class="p">,</span> <span class="s2">&quot;~&quot;</span>
-
- <span class="k">if</span> <span class="n">exit_code</span><span class="p">(</span><span class="s2">&quot;grep &#39;</span><span class="se">\\</span><span class="s2">. $HOME/</span><span class="se">\\</span><span class="s2">.recap&#39; </span><span class="si">#{</span><span class="n">application_home</span><span class="si">}</span><span class="s2">/.profile&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="s2">&quot;0&quot;</span>
- <span class="n">as_app</span> <span class="sx">%{echo &quot;. \\$HOME/.recap&quot; &gt;&gt; .profile}</span><span class="p">,</span> <span class="s2">&quot;~&quot;</span>
- <span class="k">end</span>
-
- <span class="n">as_app</span> <span class="s2">&quot;mkdir -p </span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot;~&quot;</span>
- <span class="k">end</span>
-
- <span class="n">desc</span> <span class="s1">&#39;Sets up the server account used by a deploying user&#39;</span>
- <span class="n">task</span> <span class="ss">:user</span> <span class="k">do</span>
- <span class="n">git_user_name</span> <span class="o">=</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">ShellCommand</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;git config user.name&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
- <span class="n">git_user_email</span> <span class="o">=</span> <span class="no">Recap</span><span class="o">::</span><span class="no">Support</span><span class="o">::</span><span class="no">ShellCommand</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;git config user.email&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span>
- <span class="n">run</span> <span class="s2">&quot;git config --global user.name &#39;</span><span class="si">#{</span><span class="n">git_user_name</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
- <span class="n">run</span> <span class="s2">&quot;git config --global user.email &#39;</span><span class="si">#{</span><span class="n">git_user_email</span><span class="si">}</span><span class="s2">&#39;&quot;</span>
- <span class="n">sudo</span> <span class="s2">&quot;usermod --append -G </span><span class="si">#{</span><span class="n">application_group</span><span class="si">}</span><span class="s2"> </span><span class="si">#{</span><span class="n">remote_username</span><span class="si">}</span><span class="s2">&quot;</span>
- <span class="k">end</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
183 doc/recap/tasks/bundler.html
@@ -1,183 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>bundler.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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="../support/shell_command.html">shell_command.rb</a>
- <a class="source" href="bootstrap.html">bootstrap.rb</a>
- <a class="source" href="bundler.html">bundler.rb</a>
- <a class="source" href="deploy.html">deploy.rb</a>
- <a class="source" href="env.html">env.rb</a>
- <a class="source" href="foreman.html">foreman.rb</a>
- <a class="source" href="preflight.html">preflight.rb</a>
- <a class="source" href="rails.html">rails.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>bundler.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>
- <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::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>
- </tr>
- <tr id='section-2'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-2">&#182;</a>
- </div>
- <p>Each bundle is declared in a <code>Gemfile</code>, by default in the root of the application directory</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:bundle_gemfile</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2">/Gemfile&quot;</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>
- <p>As well as a <code>Gemfile</code>, application repositories should also contain a <code>Gemfile.lock</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:bundle_gemfile_lock</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">bundle_gemfile</span><span class="si">}</span><span class="s2">.lock&quot;</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>An application&rsquo;s gems are installed within the application directory. By default they are
-placed under <code>vendor/gems</code>.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:bundle_path</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;</span><span class="si">#{</span><span class="n">deploy_to</span><span class="si">}</span><span class="s2">/vendor/gems&quot;</span> <span class="p">}</span></pre></div>
- </td>
- </tr>
- <tr id='section-5'>
- <td class=docs>
- <div class="pilwrap">
- <a class="pilcrow" href="#section-5">&#182;</a>
- </div>
- <p>Not all gems are needed for production environments, so by default the <code>development</code>, <code>test</code> and
-<code>assets</code> groups are skipped.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:bundle_without</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;development test&quot;</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>The main bundle install command uses all the settings above, together with the <code>&mdash;deployment</code>,
-<code>&mdash;binstubs</code> and <code>&mdash;quiet</code> flags</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">set</span><span class="p">(</span><span class="ss">:bundle_install_command</span><span class="p">)</span> <span class="p">{</span> <span class="s2">&quot;bundle install --gemfile </span><span class="si">#{</span><span class="n">bundle_gemfile</span><span class="si">}</span><span class="s2"> --path </span><span class="si">#{</span><span class="n">bundle_path</span><span class="si">}</span><span class="s2"> --deployment --quiet --binstubs --without </span><span class="si">#{</span><span class="n">bundle_without</span><span class="si">}</span><span class="s2">&quot;</span> <span class="p">}</span>
-
- <span class="n">namespace</span> <span class="ss">:install</span> <span class="k">do</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>After cloning or updating the code, we only install the bundle if the <code>Gemfile</code> or <code>Gemfile.lock</code> have changed.</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">desc</span> <span class="s2">&quot;Install the latest gem bundle only if Gemfile or Gemfile.lock have changed&quot;</span>
- <span class="n">task</span> <span class="ss">:if_changed</span> <span class="k">do</span>
- <span class="k">if</span> <span class="n">deployed_file_changed?</span><span class="p">(</span><span class="n">bundle_gemfile</span><span class="p">)</span> <span class="o">||</span> <span class="n">deployed_file_changed?</span><span class="p">(</span><span class="n">bundle_gemfile_lock</span><span class="p">)</span>
- <span class="n">top</span><span class="o">.</span><span class="n">bundle</span><span class="o">.</span><span class="n">install</span><span class="o">.</span><span class="n">default</span>
- <span class="k">end</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>Occassionally it&rsquo;s useful to force an install (such as if something has gone wrong in
-a previous deployment)</p>
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">desc</span> <span class="s2">&quot;Install the latest gem bundle&quot;</span>
- <span class="n">task</span> <span class="ss">:default</span> <span class="k">do</span>
- <span class="k">if</span> <span class="n">deployed_file_exists?</span><span class="p">(</span><span class="n">bundle_gemfile</span><span class="p">)</span>
- <span class="k">if</span> <span class="n">deployed_file_exists?</span><span class="p">(</span><span class="n">bundle_gemfile_lock</span><span class="p">)</span>
- <span class="n">as_app</span> <span class="n">bundle_install_command</span>
- <span class="k">else</span>
- <span class="nb">abort</span> <span class="s1">&#39;Gemfile found without Gemfile.lock. The Gemfile.lock should be committed to the project repository&#39;</span>
- <span class="k">end</span>
- <span class="k">else</span>
- <span class="nb">puts</span> <span class="s2">&quot;Skipping bundle:install as no Gemfile found&quot;</span>
- <span class="k">end</span>
- <span class="k">end</span>
- <span class="k">end</span>
-
- <span class="n">task</span> <span class="ss">:check_installed</span> <span class="k">do</span>
- <span class="k">if</span> <span class="n">exit_code_as_app</span><span class="p">(</span><span class="s1">&#39;bundle --version&#39;</span><span class="p">)</span> <span class="o">!=</span> <span class="s2">&quot;0&quot;</span>
- <span class="nb">abort</span> <span class="s2">&quot;The application user &#39;</span><span class="si">#{</span><span class="n">application_user</span><span class="si">}</span><span class="s2">&#39; cannot execute `bundle`. Please check you have bundler installed.&quot;</span>
- <span class="k">end</span>
- <span class="k">end</span>
- <span class="n">after</span> <span class="s1">&#39;preflight:check&#39;</span><span class="p">,</span> <span class="s1">&#39;bundle:check_installed&#39;</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>To install the bundle automatically each time the code is updated or cloned, hooks are added to
-the <code>deploy:clone_code</code> and <code>deploy:update_code</code> tasks.</p>
-
- </td>
- <td class=code>
- <div class='highlight'><pre> <span class="n">after</span> <span class="s1">&#39;deploy:clone_code&#39;</span><span class="p">,</span> <span class="s1">&#39;bundle:install:if_changed&#39;</span>
- <span class="n">after</span> <span class="s1">&#39;deploy:update_code&#39;</span><span class="p">,</span> <span class="s1">&#39;bundle:install:if_changed&#39;</span>
- <span class="k">end</span>
-<span class="k">end</span></pre></div>
- </td>
- </tr>
- </table>
-</div>
-</body>
View
345 doc/recap/tasks/deploy.html
@@ -1,345 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
- <title>deploy.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="../../recap.html">recap.rb</a>
- <a class="source" href="../recipes/rails.html">rails.rb</a>
- <a class="source" href="../recipes/ruby.html">ruby.rb</a>
- <a class="source" href="../recipes/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"