# SVN and distributed shared projects?

**URL:** <https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382>\
**Category:** Rails\
**Created:** [September 24, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382 "2007-09-24T19:15:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/1 "2007-09-24T19:15:00Z")

</div>

I thought I asked this question before, but now I can’t find it! Maybe I  
didn’t succesfully navigate a capcha or something. So I’ll try again and  
try to make the question simpler and more concise.

Let’s say I have an open source Rails project, being collaboratively  
worked on by several developers at several different sites/institutions.

We have a common SVN for the code, of course.

But there are a few config files that are not common. databases.yml,  
perhaps environment.rb, perhaps even some fixtures. In my case, I have  
unusual other files that are not common, say some stuff in the directory  
app/layouts/local. But this could apply even just to the standard Rails  
config.

Individual developers at individual sites really want to keep those  
'local’files in their own local svn—but still have the bulk of the  
code in the main shared svn.

The fact that these files are scattered about the Rails hiearchy doesnt’  
help–and the fact that some of them (ie databases.yml) are in a  
directory that _otherwise_ needs to be in the shared svn–makes it  
downright tricky.

Have other people been in this situation? What solutions do you use? How  
do you handle this? Any advice would be welcome!

I am contemplating some horrible rake tasks that assemble all this  
‘local’ stuff for you and import/co them from your local svn, but the  
details seem terribly complex.

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/2 "2007-09-24T20:45:14Z")

</div>

I think you are bumping up against one of the fundamental limits of  
svn, paired with a project which was not designed to be used with it.  
As I’m sure you know, subversion allows you to do many creative  
things–at the directory level. For files, it can get touchy.

First, there is a policy matter. Everyone is running their own  
environment, and this environment needs to be portable. Everything  
goes in one repository.

You don’t mention if you are \*nix or m$. As usual, there is a  
workable solution for \*nix

Create a directory trunk/local\_env. Inside trunk/local\_env, create a  
directory for every local environment. Depending on corporate  
paranoia policy, these directories can be accessible only to their  
owners.

Each file which is part of a local environment is made into a soft  
link. That soft link in turn goes through trunk/env–a directory link  
which is NOT part of the repository. Now anyone can potentially check  
out the project with everyone’s environments, and can select which  
ever they wish to use, by linking the single directory.

I have no idea what the equivalent might be in m$.

On Sep 24, 12:15 pm, Jonathan R. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/3 "2007-09-24T21:15:31Z")

</div>

That’s interesting, thanks.

I am using Unix.

But I was hoping there was some solution that would allow people to keep  
their local stuff in their OWN svn repo, instead of keeping it all in  
the central repo.

But I’ll consider the solution you’ve proposed, I don’t entirely  
understand it, but it does seem promissing.

Any other hints or suggestions from experience welcome as well.

Jonathan

Student wrote:

> I think you are bumping up against one of the fundamental limits of  
> svn, paired with a project which was not designed to be used with it.  
> As I’m sure you know, subversion allows you to do many creative  
> things–at the directory level. For files, it can get touchy.
> 
> First, there is a policy matter. Everyone is running their own  
> environment, and this environment needs to be portable. Everything  
> goes in one repository.
> 
> You don’t mention if you are \*nix or m$. As usual, there is a  
> workable solution for \*nix
> 
> Create a directory trunk/local\_env. Inside trunk/local\_env, create a  
> directory for every local environment. Depending on corporate  
> paranoia policy, these directories can be accessible only to their  
> owners.
> 
> Each file which is part of a local environment is made into a soft  
> link. That soft link in turn goes through trunk/env–a directory link  
> which is NOT part of the repository. Now anyone can potentially check  
> out the project with everyone’s environments, and can select which  
> ever they wish to use, by linking the single directory.
> 
> I have no idea what the equivalent might be in m$.
> 
> On Sep 24, 12:15 pm, Jonathan R. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 10:09pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/4 "2007-09-24T22:09:28Z")

</div>

database.yml is an ERB template, actually. So, you can add a line to  
it to check if database.yml.local is present, and load it.

Same story with other configuration files (which are .rb, so it’s even  
easier).

Btw, database.yml can look like this:

common: &common  
adapter: mysql  
encoding: utf8  
host: localhost  
socket: \<%= %w[/tmp/mysql.sock /var/lib/mysql/mysql.sock  
/var/run/mysqld/mysqld.sock  
/opt/local/var/run/mysql5/mysqld.sock].detect { |f| File.exists? f }  
%\>  
database: petstore\_\<%= RAILS\_ENV %\>  
username: root  
password:

development:  
\<\<: \*common

test:  
\<\<: \*common

production:  
\<\<: \*common

–  
Alexey V.  
CruiseControl.rb [[http://cruisecontrolrb.thoughtworks.com](http://cruisecontrolrb.thoughtworks.com)]  
RubyWorks [[http://rubyworks.thoughtworks.com](http://rubyworks.thoughtworks.com)]

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 9:57pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/5 "2007-09-24T21:57:26Z")

</div>

so why not tell the “big” svn to ignore the local\_env directory and  
let the individual developer checkout his/her local stuff into that  
directory. It means having to do separate svn commands, but that  
detail could be hidden away in a Rakefile. (I’ve done this with a  
“tools” repository checked-out into a directory ignoring a “src”  
directory and checking out a separate repository in ./src)

-Rob

On Sep 24, 2007, at 3:15 PM, Jonathan R. wrote:

> understand it, but it does seem promissing.
> 
> > owners.
> > 
> > On Sep 24, 12:15 pm, Jonathan R. \<rails-mailing-l…@andreas-

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 24, 2007, 10:33pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/6 "2007-09-24T22:33:13Z")

</div>

Nice, that’s a good idea, thanks.

That probably solves the ‘individual files rather than directories’  
problem nicely.

I still have an issue of having, in my particular application,  
_multiple_ ‘local’ directories. One in config, one in views, one in  
controllers. But you really want the local people to be able to check  
out and update and commit their ‘local’ stuff with one command. At first  
I hoped to combine them all in one ‘local’ directory—local/config,  
local/controllers, local/models, etc. But, especially with models, at  
least in 1.8.4, it’s hard to add on a seperate models directory.

So maybe have a bunch of directories, but write some rake tasks up to  
import/checkout/update/commit them all in one go?

Any ideas here?

Thanks very much for everyone helping me think this through.

Jonathan

Alexey V. wrote:

> database.yml is an ERB template, actually. So, you can add a line to  
> it to check if database.yml.local is present, and load it.
> 
> Same story with other configuration files (which are .rb, so it’s even  
> easier).
> 
> Btw, database.yml can look like this:
> 
> common: &common  
> adapter: mysql  
> encoding: utf8  
> host: localhost  
> socket: \<%= %w[/tmp/mysql.sock /var/lib/mysql/mysql.sock  
> /var/run/mysqld/mysqld.sock  
> /opt/local/var/run/mysql5/mysqld.sock].detect { |f| File.exists? f }  
> %\>  
> database: petstore\_\<%= RAILS\_ENV %\>  
> username: root  
> password:
> 
> development:  
> \<\<: \*common
> 
> test:  
> \<\<: \*common
> 
> production:  
> \<\<: \*common
> 
> –  
> Alexey V.  
> CruiseControl.rb [[http://cruisecontrolrb.thoughtworks.com](http://cruisecontrolrb.thoughtworks.com)]  
> RubyWorks [[http://rubyworks.thoughtworks.com](http://rubyworks.thoughtworks.com)]

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [September 25, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/svn-and-distributed-shared-projects/115382/7 "2007-09-25T12:51:54Z")

</div>

SVK might be worth considering:

> **[Best Practical Solutions: The open-source ticketing system](https://bestpractical.com/)**
>
> open source ticketing software

This way you could all have your own local repos and merge in from the  
master

Example with Mephisto:  
[http://octopod.info/2006/8/19/managing-multiple-local-mephisto-repos-with-svk](http://octopod.info/2006/8/19/managing-multiple-local-mephisto-repos-with-svk)

On Sep 24, 6:15 pm, Jonathan R. \<rails-mailing-l…@andreas-
