Sunday, June 19, 2011

Local SVN rep on OS X

I have this little web project I've been maintaining for a long time now and decided that it will make a good learning environment for my daughter to do some web development.

So I want both of us to be able to work on it side by side and decided to set up local SVN repository on a desktop machine. This way we can do the work on laptops in the comfort of our living room.

The objective are:


1 - set up svn repo


2 - import an existing project into the repo with the help of NetBeans (that's what we'll be using as an html editor)


3 - Check out the project


These 3 links were crucial in their guidance of this little project:



http://www.rubyrobot.org/tutorial/subversion-with-mac-os-x




http://mark-kirby.co.uk/2008/how-to-set-up-and-use-subversion-svn-on-os-x-leopard/



and



http://www.fedoraforum.org/forum/showthread.php?t=247211



The only prerequisite here is that you have to have SVN installed. 

To get started, set up a directory where you'd like to have your repository


  1. For example, I set up mine like so from the command line:
    $ svnadmin create /Users/some_user_name/work/web/SVN-REP
    ... navigate to the repository folder:
    $ cd /Users/some_user_name/work/web/SVN-REP
    ... create a directory for the project
    $ mkdir SundanceStables

    ... that's all as far as setting up a local svn repo is concerned. This is ready to be used from the command line if you like


  2. Next I did initial import of the project following prompts in NetBeans

  3. But that's only half the fun! Next we'll need to make repo available over the network and that's where playing a little with Apache configuration comes into play.

  4. ... changing ownership will make the repo accessible in the browser:

    $ sudo chown -R www:www /Users/some_user_name/work/web/SVN-REP
    

  5. Create svn.conf file in /etc/apache2/svn.conf
    LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so
    
        <location /sundancestables >
    
            DAV svn
            SVNPath /Users/some_user_name/work/SVN-REP
    
        </location >
       
    
    ... save the file and restart apache
    $ sudo apachectl restart
    
    ... to make sure I got the syntax correct I run
    $ sudo apachectl configtest
    
    I initially had some errors and searching the error message in google led to a speedy fix.

  6. Once all was set, went to Chrom and entered

    http://192.168.1.101/SundanceStables/

    and there was my project in the repository

  7. Finally I was able to switch over to my laptop, fired up NetBeans and checkout the project.

  8. One last thing left is to guide my daughter through the install of svn and NetBeans on her laptop and we'll be on our way!

  9. Last but not least

    this is not a secure set up by any means!

    If you need authentication, it's up to you from here on. If you visit the 3rd link from the beginning of this post, at the bottom of the page/thread you will find a link that will point you in the right direction. So we have working toy set up for a toy summer project.

Local SVN rep on OS X

I have this little web project I've been maintaining for a long time now and decided that it will make a good learning environment for ...