How to extend Subversion with Ruby

From WhyNotWiki

Jump to: navigation, search

Extending Subversion with Ruby  edit   (Category  edit)


There are basically these ways to extend Subversion with Ruby:

I was originally considering just doing a command-line wrapper script, but when I saw Red Bean's warning about that (read below), I thought I'd first look at the options. I tried going the Ruby Subversion bindings with SWIG route and failed miserably while trying to build from source. I haven't looked at the Ruby/DL solution yet. Currently the most promising option looks like extending Ruby Source Control Management API. (Though I wonder... what approach do they take for integrating with/binding to Subversion? Looks like they take the command-line wrapper approach...boo!)

Re: Accessing SVN through Ruby (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/137902). Retrieved on 2007-02-08 11:15.

DL or an svn wrapper will probably get you farther faster than SWIG, since both have a lower barrier to entry. For an svn wrapper you just need svn installed. For DL you need to be able to find an svn .dll or .so, which may be as simple as installing svn. For SWIG you need headers and a compiler, which can be no fun if there's no default compiler and you have 2 or 3 different compilers to choose from.


Binding Directly—A Word About Correctness (http://svnbook.red-bean.com/en/1.1/ch08.html). Retrieved on 2007-02-08 11:42.

Why should your GUI program bind directly with a libsvn_client instead of acting as a wrapper around a command-line program? Besides simply being more efficient, this can address potential correctness issues as well. A command-line program (like the one supplied with Subversion) that binds to the client library needs to effectively translate feedback and requested data bits from C types to some form of human-readable output. This type of translation can be lossy. That is, the program may not display all of the information harvested from the API, or may combine bits of information for compact representation.

If you wrap such a command-line program with yet another program, the second program has access only to already-interpreted (and as we mentioned, likely incomplete) information, which it must again translate into its representation format. With each layer of wrapping, the integrity of the original data is potentially tainted more and more, much like the result of making a copy of a copy (of a copy …) of a favorite audio or video cassette.

Personal tools