Accessing Subversion from Rails in an ActiveRecord way
Filed in: Rails, Ruby Add comments
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
August 27th, 2007 at 18:39
Looks cool, does it have a real connection to SVN with some SVN Ruby module that can manage the files?
Reply
August 27th, 2007 at 18:41
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