Accessing Subversion from Rails in an ActiveRecord way

I needed to present products and their corresponding branches and tags in Subversion in a Rails app. So I’ve come up with this quite simple solution.

The GenericModel class (attached) is ihnerited by Tag, Branch and Product.
The Product class supports methods find, branches and tags for which it uses ‘svn/client’.

The config.yml (which is read into OpenStruct) is very simple:

svn:
  url: http://svn/svn/repos
  user: roman
  password: roman

The Product class tries to provide interface similar to the ActiveRecord (of course I didn’t immitate everything, just the basic stuff). Implementing interfaces in a contract-less language is an adventure 🙂

generic_model.rb

product.rb

2 Responses to “Accessing Subversion from Rails in an ActiveRecord way”

  1. Evgeny Says:

    Looks cool, does it have a real connection to SVN with some SVN Ruby module that can manage the files?

    Reply

  2. roman Says:

    Yes, it has a real connection using ‘svn/client’. It doesn’t manage the files, though. It’s used only for listing the directories.

    Reply

Leave a Reply

Pages

Adsense