<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Wolfmans Howlings: a Capistrano scm module for local SVN access</title>
    <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>A programmers Blog about Ruby, Rails and a few other issues</description>
    <item>
      <title>a Capistrano scm module for local SVN access</title>
      <description>&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt; 2007-06-09 This method has been deprecated in &lt;a href="http://capify.org/"&gt;Cap 2.0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt; 2007-02-21 I have updated the files to correctly update revisions.log&lt;/p&gt;

&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt; I added rsync as suggested see end of article for more info.&lt;/p&gt;

&lt;p&gt;I previously published a custom deploy recipe that allowed subversion
to checkout from a local repository and send to the remote server.&lt;/p&gt;

&lt;p&gt;This was a suboptimal solution, as it wouldn't work with things like
&lt;a href="http://codemode.blogspot.com/2006/11/deprec-install-rails-stack-and-deploy.html"&gt;deprec&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So here is the way I should have done it in the first place. It is a
modified version of the standard subversion scm module, it should be
backward compatible with the built in version, but adds a couple of
features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles the subversion repository only being accessible from the local
machine&lt;/li&gt;
&lt;li&gt;If the subversion repository is accessible from the remote server
allows for different URLs for access from the local and remote
machines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use a standard &lt;code&gt;deploy.rb&lt;/code&gt; and your subversion is accessible
from the server, then it should work exactly as the built-in version
(no need to use it then, but it should work)&lt;/p&gt;

&lt;p&gt;However if you have your subversion server behind your local firewall,
you just add these three lines to your &lt;code&gt;deploy.rb&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'lib/tasks/local_subversion_rsync.rb'
set :scm, Capistrano::SCM::LocalSubversionRsync
set :repository_is_not_reachable_from_remote, true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And everything will work as before, even though the server has no idea
what subversion is.&lt;/p&gt;

&lt;p&gt;Of course for this to work you need to download
&lt;a href="http://blog.wolfman.com/files/local_subversion_with_rsync_3.tar.gz"&gt;this&lt;/a&gt; de-tar
it and put it in your lib/tasks directory. (That's where the require
line gets this extension from). There is also a unit test for the
new_subversion module which is extended from the one shipped with
Capistrano, which passes.&lt;/p&gt;

&lt;p&gt;Everything else in &lt;code&gt;deploy.rb&lt;/code&gt; should be the same as before, except
that you set the repository to the URL your local machine uses to
access your locally accessible subversion server or repository.
(Should even work with the URL file://...), for instance...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set :repository, "svn://your.svnserver.host/#{application}/trunk"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The assumption is that both the local and remote machines can create
files and directories in &lt;code&gt;/tmp&lt;/code&gt;, if this is not true then one or both
of these should be set...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set :tmpdir_local, "/usr/tmp"
set :tmpdir_remote, "/home/user/tmp"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The way this module works is to export the relevant version of the
project from Subversion into a temporary directory on the local
machine (default is /tmp/unique_name). Then I create a gzip'd tar
archive into the temp directory. The tar file is then transferred to
the target servers, using the Capistrano &lt;code&gt;put&lt;/code&gt; command into a
temporary directory (/tmp by default) on the server. I then create the
target directory on the server and un-tar the file into that
directory. Then clean up the various temporary files. From the
perspective of the server the end result should be identical to doing
an &lt;code&gt;svn export&lt;/code&gt; into the target directory on the server.&lt;/p&gt;

&lt;p&gt;The other facility this SCM Module provides is when your subversion
server is accessible from the server as is the "normal" use case (per
the Capistrano developers, but bad practice IMHO), but you need a
different URL to access the SVN repository from the local machine vs
the remote server, eg&lt;/p&gt;

&lt;p&gt;server accesses with this URL &lt;code&gt;svn://localhost/myapp/trunk&lt;/code&gt;
local machine accesses with this URL &lt;code&gt;svn+ssh://myserver.com/myapp/trunk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;in this case you add these lines...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'lib/tasks/local_subversion_rsync.rb'
set :scm, Capistrano::SCM::LocalSubversionRsync

set :local_repository_path, "svn+ssh://myserver.com/myapp/trunk"
set :repository, "svn://localhost/myapp/trunk"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In addition if the actual SVN binary is different on server and local
you can add these for instance...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set :remote_svn, "/usr/local/bin/svn"
set :local_svn, "/usr/bin/svn"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If the relevant configuration variable is not set then the standard
svn configuration variable is used, and then just "svn" if that is not set.&lt;/p&gt;

&lt;p&gt;Please beware I have not fully tested the use cases other than the
first one, where I use my local subversion server to deploy to my
remote servers that know nothing about subversion, however the unit
tests do pass for the other use cases.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;UPDATE&lt;/em&gt; 2007-02-15 check &lt;a href="http://blog.wolfman.com/articles/2007/02/18/updated-capistrano-local-subversion-and-perforce"&gt;this article&lt;/a&gt; for using the rsync option.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://technorati.com/tag/capistrano+subversion" rel="tag"&gt;&lt;/a&gt;
&lt;a href="http://technorati.com/tag/capistrano+scm" rel="tag"&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 06 Dec 2006 21:42:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:59eb03fa-5103-47be-aae3-e98ec17ce0cb</guid>
      <author>Jim Morris</author>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access</link>
      <category>Rails</category>
      <category>Ruby</category>
      <category>capistrano</category>
      <category>subversion</category>
      <trackback:ping>http://blog.wolfman.com/articles/trackback/91</trackback:ping>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;You should be using capistrano 2 which has this functionality built in. This article has been deprecated.&lt;/p&gt;

&lt;p&gt;See &lt;a href="http://capify.org/" rel="nofollow"&gt;http://capify.org/&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 08 Jan 2008 13:03:35 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:8f0a6139-ec91-4242-ada5-decb86b32808</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-193</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by saurabh purnaye</title>
      <description>&lt;p&gt;i m using a windows machine .. so can you pls guide me for the path to access a local repository &lt;/p&gt;</description>
      <pubDate>Mon, 07 Jan 2008 23:42:29 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:eaba73aa-68f5-4902-b862-c257296b4c1d</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-192</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;Now all we need is someone to port that solution to cap2.0 :)&lt;/p&gt;</description>
      <pubDate>Sat, 09 Jun 2007 15:31:21 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:966b560a-7678-443a-9580-5a12435ce176</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-13</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Jacob Atzen</title>
      <description>&lt;p&gt;I guess I never did get to say thank you for the rsync stuff. So here it is: Thanks a lot! The rsync deployment is really great :-)&lt;/p&gt;</description>
      <pubDate>Sat, 09 Jun 2007 14:12:36 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:3ee18ddd-63f8-454c-9d81-b5628a4b47f0</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-79</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;No this method is deprecated in cap 2 as cap 2 includes a way to do this. see the cap 2 docs.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Jun 2007 09:40:03 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:925ca2ad-3ea9-4ae5-90b6-f116385fe746</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-77</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Hasham</title>
      <description>Does this works with Capistrano 2. I am getting this error:

  /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- capistrano/scm/base (LoadError)
          from         ....</description>
      <pubDate>Fri, 08 Jun 2007 03:53:55 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:af116f4a-bfa4-4ac9-bcec-dc0849d3f693</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-73</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by James</title>
      <description>&lt;p&gt;Nice one. Thanks wolfman.&lt;/p&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:52:15 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:647148e5-96be-45d9-8d82-7f021915bcb8</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-48</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;OK the link is fixed - thanks, you should also read the updated blog entry.&lt;/p&gt;</description>
      <pubDate>Thu, 22 Feb 2007 11:31:34 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:3ce5a76b-c991-4c5e-811c-0a880d61c0e3</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-71</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by James</title>
      <description>&lt;p&gt;Cheers wolfman!&lt;/p&gt;

&lt;p&gt;Link is generating an Application Error at present though:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.wolfman.com/files/local" rel="nofollow"&gt;http://blog.wolfman.com/files/local&lt;/a&gt;&lt;em&gt;subversion&lt;/em&gt;with&lt;em&gt;rsync&lt;/em&gt;3&lt;/p&gt;</description>
      <pubDate>Thu, 22 Feb 2007 04:34:52 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:815e464d-c5d8-4686-aa78-d8343e94b9b7</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-60</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;Ok found the problem, and fixed it. Thanks&lt;/p&gt;</description>
      <pubDate>Wed, 21 Feb 2007 13:12:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:a0a702db-9137-4e49-8776-3a32fd5cc3a0</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-69</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by James</title>
      <description>&lt;p&gt;Very nice - works fine for me... apart from one thing :)&lt;/p&gt;

&lt;p&gt;revisions.log is no longer populated with the release details. Any chance you could add support for this?&lt;/p&gt;

&lt;p&gt;J.&lt;/p&gt;</description>
      <pubDate>Wed, 21 Feb 2007 07:01:01 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:33a64499-37ca-4055-8b1a-a4246015de44</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-59</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;I uploaded a fixed version and tested the rsync version better&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 22:23:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:89c572ac-8e50-4a5e-ba51-7b21b7e29ea1</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-62</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;As suggested I have uploaded a new version that can use rsync instead of put to get the new version to the servers, I have updated the end of this article with the instructions. However I still use the put version so someone needs to test out this new rsync version. Thanks&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 14:40:51 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:9748891c-433b-4cb9-8212-3cc7735f37df</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-61</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Steve</title>
      <description>&lt;p&gt;Jim, this was exactly what I was looking for. They should make this a standard recipe for Capistrano&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 12:47:48 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:869bb055-004b-4437-8340-9420c8d8f2c0</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-57</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;none of these changes have been added to the cap release, as Jamis is working on a new architecture that will deprecate the need for this module.&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 12:19:02 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:fe5087cf-812d-4924-a9ad-6f8a544bb55b</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-56</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Chuck</title>
      <description>&lt;p&gt;p.s. Windows, eat me. MacBook's in the mail and I'm ready to move on in life.&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 00:53:32 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:2e6d5f2b-dacc-4daf-8ce2-c28cce2516c1</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-55</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Chuck</title>
      <description>&lt;p&gt;Works like a charm so far! Exactely what I needed. I should check if the local/remote repo options have been rolled into the new Capistrano release (since this is a few days old now).&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
      <pubDate>Thu, 15 Feb 2007 00:52:54 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:53a70c4a-c75b-4901-8751-c3ab7090d2fe</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-52</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Maxime Curioni</title>
      <description>&lt;p&gt;Thanks for this great Capistrano module. Works great on my config.&lt;/p&gt;</description>
      <pubDate>Thu, 08 Feb 2007 12:41:24 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:bcc1e1ba-61c5-411e-92c3-386c186b2e0e</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-35</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Jacob Atzen</title>
      <description>&lt;p&gt;Looks nice. A small improvement would be to have a "checkout" on the server which would be updated with rsync on each deployment. This checkout would then be copied into the releases directory. Just like the svn_cache from caboose. This would minimize deployment time and bandwidth usage.&lt;/p&gt;</description>
      <pubDate>Tue, 09 Jan 2007 13:36:29 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:af7eef2a-18ce-4f14-9018-711497808987</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-28</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Si</title>
      <description>&lt;p&gt;Great work, was just about to write something like this and then stumbled on yours.. Thanks..&lt;/p&gt;</description>
      <pubDate>Tue, 09 Jan 2007 07:39:03 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:69ac2603-47dc-4cc6-8354-3e0eb0b5b360</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-49</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Jon Evans</title>
      <description>&lt;p&gt;Thanks for this, most useful! It works perfectly. You directed me here from &lt;a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/c817c4dba7d84521" rel="nofollow"&gt;a message&lt;/a&gt; on the RoR mailing list but although I replied to that using Google Groups a good 6 hours ago it still hasn't shown up on the list.&lt;/p&gt;</description>
      <pubDate>Mon, 08 Jan 2007 09:30:58 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:0dbc0a76-7d0d-4359-bf87-ce9d1d18e19d</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-32</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Christophe</title>
      <description>&lt;p&gt;Many thanks for putting this together - it finally makes Capistrano a viable deployment option for us. Works like a charm :)&lt;/p&gt;</description>
      <pubDate>Tue, 19 Dec 2006 03:53:01 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:604e1a61-c506-40b0-8e21-649ab843ebf5</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-44</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;Arjen- Yes just replace the tar calls with zip and unzip, and it should work fine on Windows. You also have to make sure the tmp directories are set up properly as /tmp probably doesn't exist on windows either. Alternatively just install a win32 tar binary, there are a few around.&lt;/p&gt;</description>
      <pubDate>Thu, 07 Dec 2006 12:12:35 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:f7b03b91-2154-4f3d-a2af-408f0f2fa5da</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-22</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by Arjen</title>
      <description>&lt;p&gt;Too bad this won't work for windows users, since they can't use tar. Any clever ideas to work around this?&lt;/p&gt;</description>
      <pubDate>Thu, 07 Dec 2006 09:09:40 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:0108066f-1a2c-45a6-8ecb-b545237d789e</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-47</link>
    </item>
    <item>
      <title>"a Capistrano scm module for local SVN access" by wolfmanjm</title>
      <description>&lt;p&gt;I tar and gzip the directory then copy that tar file over using capistrano's put (which uses scp basically), then on the server I untar into the target directory. I'll add some explanation to the post, thanks for asking.&lt;/p&gt;</description>
      <pubDate>Wed, 06 Dec 2006 23:52:09 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:854a9bd5-0329-4554-a379-c999880b6e1d</guid>
      <link>http://blog.wolfman.com/articles/2006/12/06/a-capistrano-scm-module-for-local-svn-access#comment-45</link>
    </item>
  </channel>
</rss>
