Accessing SVN through Ruby

B

Bob Aman

I want to code up a CMS of sorts in Ruby that uses Subversion as the
backend. However, the only simple interface to Subversion I seem to
have available to me is to call out to the Subversion command line
client, which is rather less than optimal. I saw the Subversion SWIG
bindings in the Subversion repository at
http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ruby/
but when I tried to work with them, I couldn't figure out how to set
them up properly.

I kept getting "No such file to load -- svn/ext/core (LoadError)" when
trying to run run-test.rb

Has anyone out there had better luck with the ruby svn bindings or
does anyone know of a nicer ruby interface to SVN, preferably one
that's more "ruby-like"? There also seems to be disclaimers about the
functionality of the ruby bindings in the Subversion documentation,
but not a lot of information about what doesn't quite work. Just that
there might be some stuff. Anyone know what's missing or not working?
 
T

Tanner Burson

Has anyone out there had better luck with the ruby svn bindings or
does anyone know of a nicer ruby interface to SVN, preferably one
that's more "ruby-like"? There also seems to be disclaimers about the
functionality of the ruby bindings in the Subversion documentation,
but not a lot of information about what doesn't quite work. Just that
there might be some stuff. Anyone know what's missing or not working?

I also would be interested. I was looking for this very thing not a
week ago, and wasn't able to find anything substantial.
 
B

Bob Aman

Has anyone out there had better luck with the ruby svn bindings or
I also would be interested. I was looking for this very thing not a
week ago, and wasn't able to find anything substantial.

Ok, so I guess I should create something then. I'd just assume wrap
the ruby SWIG bindings with something more elegant, but I'm still
having trouble getting them to run as expected. I'm not sure how to
get the external parts of the bindings to work. The thing errors out
looking for the svn/ext/core stuff (mainly because it's not there).
But I can't figure out where it is or how to create it. From little
snippets in the changelists, it seems like the ext directory should
have the .so files (or probably .dll files in Windows) but those
aren't in the Subversion respository and it's not really obvious how
to build them. If anyone could give me pointers for how to get
started, that would be much appreciated. I'm doing the development on
both FreeBSD and Windows, so explanations for both environments would
be really helpful.
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Accessing SVN through Ruby" on Fri, 8 Apr 2005 01:00:27 +0900,
Bob Aman said:
I saw the Subversion SWIG
bindings in the Subversion repository at
http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ruby/
but when I tried to work with them, I couldn't figure out how to set
them up properly.

Try the following sequence:

% svn co http://svn.collab.net/repos/svn/trunk svn
% cd svn
% ./autogen.sh
# or
# % env AUTOCONF=autoconf259 \
# AUTOHEADER=autoheader259 \
# LIBTOOL_M4=/usr/local/share/aclocal/libtool15.m4 \
# ./autogen.sh
# (If you are working on FreeBSD.)
% ./configure
# or
# % ./configure \
# --with-apr=/usr/local/lib/apache2 \
# --with-apr-util=/usr/local/lib/apache2
# (If you are working on FreeBSD.)
% make check-swig-rb
% sudo make install-swig-rb # if you pass all test.
 
B

Bob Aman

Try the following sequence:
% svn co http://svn.collab.net/repos/svn/trunk svn
% cd svn
% ./autogen.sh
# or
# % env AUTOCONF=autoconf259 \
# AUTOHEADER=autoheader259 \
# LIBTOOL_M4=/usr/local/share/aclocal/libtool15.m4 \
# ./autogen.sh
# (If you are working on FreeBSD.)
% ./configure
# or
# % ./configure \
# --with-apr=/usr/local/lib/apache2 \
# --with-apr-util=/usr/local/lib/apache2
# (If you are working on FreeBSD.)
% make check-swig-rb
% sudo make install-swig-rb # if you pass all test.

I'm on Windows at home, and I don't think TextDrive (only FreedBSD
machine I have access to) would be keen on me doing this. I don't
suppose I could get info on how to do this for Windows?
 
G

Garrett Rooney

Bob said:
I'm on Windows at home, and I don't think TextDrive (only FreedBSD
machine I have access to) would be keen on me doing this. I don't
suppose I could get info on how to do this for Windows?

I don't think anyone has done the leg work to make the ruby bindings for
svn work on windows yet.

-garrett
 
K

Kouhei Sutou

In <[email protected]>
"Re: Accessing SVN through Ruby" on Sat, 9 Apr 2005 10:59:01 +0900,
Bob Aman said:
I'm on Windows at home, and I don't think TextDrive (only FreedBSD
machine I have access to) would be keen on me doing this. I don't
suppose I could get info on how to do this for Windows?

I'm sorry for my poor English skill, but I can't understand
what you want to say.

Please try the sequence on Windows and show me the output of
it.
 
B

Bob Aman

Please try the sequence on Windows and show me the output of

Heh, ok.
(I already had svn checked out, so I'm skipping that bit.)

"Windows cannot open this file: autogen.sh"
Windows doesn't do the whole scripting thing very well.
 
K

Kouhei Sutou

In <[email protected]>
"Re: Accessing SVN through Ruby" on Sat, 9 Apr 2005 11:21:55 +0900,
Bob Aman said:
"Windows cannot open this file: autogen.sh"
Windows doesn't do the whole scripting thing very well.

I don't have Windows box, so I can't help you about the
thing. But INSTALL file in Subversion repository may help
you:
 
L

Lee Marlow

You might want to take a look at the rscm library on rubyforge: http://rubyforge.org/projects/rscm/

-----Original Message-----
From: Bob Aman [mailto:[email protected]]
Sent: Thursday, April 07, 2005 10:00 AM
To: ruby-talk ML; (e-mail address removed)
Subject: Accessing SVN through Ruby

I want to code up a CMS of sorts in Ruby that uses Subversion as the backend. However, the only simple interface to Subversion I
seem to have available to me is to call out to the Subversion command line client, which is rather less than optimal. I saw the
Subversion SWIG bindings in the Subversion repository at http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/ruby/
but when I tried to work with them, I couldn't figure out how to set them up properly.

I kept getting "No such file to load -- svn/ext/core (LoadError)" when trying to run run-test.rb

Has anyone out there had better luck with the ruby svn bindings or does anyone know of a nicer ruby interface to SVN, preferably one
that's more "ruby-like"? There also seems to be disclaimers about the functionality of the ruby bindings in the Subversion
documentation, but not a lot of information about what doesn't quite work. Just that there might be some stuff. Anyone know what's
missing or not working?
 
G

gabriele renzi

Bob Aman ha scritto:
Heh, ok.
(I already had svn checked out, so I'm skipping that bit.)

"Windows cannot open this file: autogen.sh"
Windows doesn't do the whole scripting thing very well.

try installing a tiny unisih environment such as cygwin or msys/mingw ,
and use the shell that is coming with it to do this.
 
B

Bob Aman

You might want to take a look at the rscm library on rubyforge: http://rubyforge.org/projects/rscm/

Saw it already, won't do what I need. I have to have access to the
metadata, and speed is going to be an issue, so going through the
command line client will be less than optimal.

try installing a tiny unisih environment such as cygwin or msys/mingw ,
and use the shell that is coming with it to do this.

I have cygwin, but ideally, I'd like to make sure my code works everywhere.


I don't have Windows box, so I can't help you about the
thing. But INSTALL file in Subversion repository may help
you:

I'll give it a whirl, see what happens.
 
B

Bob Aman

I'll give it a whirl, see what happens.

From the INSTALL file:

E.1 Prerequisites

* Visual Studio 6 and service pack. It can be built with Visual Studio
7 (aka Visual Studio.NET aka Visual Studio.NET 2002) but these
instructions assumes VS6.
* A recent Windows SDK, the one provided with Visual Studio 6 is
too old. You only need the 'Core SDK'. You can get it from MSDN
if you have it or from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ if you
don't.
* Python 2.2 or higher, downloaded from http://www.python.org/ which is
used to generate the project files.
* Perl 5.8 or higher from http://www.activestate.com/
* Awk, from http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe
This is needed to compile Apache or APR. Note that this is the
actual awk program, not an installer - just rename it to awk.exe
and it is ready to use.
* Neon 0.24.7 or higher, downloaded from
http://www.webdav.org/neon/neon-0.24.7.tar.gz which is required
for building the client components. Neon is included in the zip file
distribution.
* Berkeley DB is required for support for local server components,
version 4.2.52 is available from
http://subversion.tigris.org/servlets/ProjectDocumentList as
db-4.2.52-win32.zip. For more information see Section I.5.
* Apache 2 source, downloaded from
http://httpd.apache.org/download.cgi, these instructions assume
version 2.0.50. Only needed for building the server dso modules.
* Apache 2 msi install file, also from
http://httpd.apache.org/download.cgi (required for running the
tests). Only needed for testing the server dso modules.
* Apache apr, apr-util, and apr-iconv libraries, version 0.9.5.
Included in both the Subversion ZIP file and the Apache 2 source
tarball. If you are building from a Subversion checkout and have
not downloaded Apache 2, then get these 3 libraries from
http://www.apache.org/dist/apr/
* ZLib 1.1.4 or higher (version 1.1.x) binaries
http://www.winimage.com/zLibDll/zlib114dll.zip.
* Openssl 0.9.7d or higher obtained from
http://www.openssl.org/source/openssl-0.9.7d.tar.gz
* An assembler, e.g., nasm which is available from
http://www.kernel.org/pub/software/devel/nasm/binaries/win32/
* For localization gnu gettext is needed. Get
gettext-runtime-0.13.bin.woe32.zip,
gettext-tools-0.13.bin.woe32.zip, and
libiconv-1.9.1.bin.woe32.zip from
http://mirrors.kernel.org/gnu/gettext/ and
http://mirrors.kernel.org/gnu/libiconv/.
* Either a Subversion client binary from http://subversion.tigris.org/ to
do the initial checkout of the Subversion source or the zip file
source distribution. See the section "Bootstrapping from a Zip or
Installer File under Windows" above for more.
* A means of unpacking the files. The Subversion tar.gz file uses the
POSIX.1 standard for file names which exceed 100 characters. This
format is not understood by all programs which claim to be able to
unpack .tar.gz files. Notable examples of this are WinZip and the
utilities which can be found at http://unxutils.sourceforge.net/. The
version of tar at http://gnuwin32.sourceforge.net/ is derived from GNU
tar, so it can handle POSIX.1. However, it is *not* able to unpack
gzip files, although it is able to read a pipe from gzip. Cygwin can
unpack this file, however cygwin is a large package to install such
just to unpack the tarball on Windows. To avoid these problems use
the Subversion zip file source distribution. The other required
package which is packaged as a tar file (openssl) can be unpacked with
any of the utilities mentioned.

Please tell me that I don't need to do all of that just to generate
the SWIG bindings for Windows... (mumble, grumble, why can't this be
automated more easily?)

I was looking through the pickaxe book and I saw that rubygems seems
to make allowance for precompiled gems... Can I make use of this?

Ultimately, what I'd like to create is a simple ruby-svn gem that can
be installed anywhere with zero hassle. If it's possible, I'd like to
just include the external libraries for svn for each of the possible
platforms inside the gem or something like that. I don't want to rely
on the library's user actually having all of the required build tools
(especially for the windows platform). Is this possible? If so, how
hard is it, and what do I have to watch out for as far as pitfalls?
I'd prefer not to have to make seperate gems for each platform, is
that possible, given what I want to do?

For that matter, how hard would it be to make a pure-ruby svn client
that conversed with svn only via http/apache? How bad of an idea is
this?

Be aware, I've never tried to make a gem before. (Heck, I'm only just
getting started with ruby, so...)
 
E

Eric Hodel

--Apple-Mail-15--343599839
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

Please tell me that I don't need to do all of that just to generate
the SWIG bindings for Windows... (mumble, grumble, why can't this be
automated more easily?)

I was looking through the pickaxe book and I saw that rubygems seems
to make allowance for precompiled gems... Can I make use of this?

Ultimately, what I'd like to create is a simple ruby-svn gem that can
be installed anywhere with zero hassle. If it's possible, I'd like to
just include the external libraries for svn for each of the possible
platforms inside the gem or something like that. I don't want to rely
on the library's user actually having all of the required build tools
(especially for the windows platform). Is this possible? If so, how
hard is it, and what do I have to watch out for as far as pitfalls?
I'd prefer not to have to make seperate gems for each platform, is
that possible, given what I want to do?

Is DL unsuitable for this? That would require only a compiled SVN
library.
For that matter, how hard would it be to make a pure-ruby svn client
that conversed with svn only via http/apache? How bad of an idea is
this?

You'd then have to track any changes to the svn protocol, which is
unlikely to be fun/easy.

svn lists easily parseable output as one of its features...
Be aware, I've never tried to make a gem before. (Heck, I'm only just
getting started with ruby, so...)

That's the easy part

--
Eric Hodel - (e-mail address removed) - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

--Apple-Mail-15--343599839
content-type: application/pgp-signature; x-mac-type=70674453;
name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iEYEARECAAYFAkJa7J4ACgkQMypVHHlsnwRoiACfV7Z8x3+4L5cSw1IeA6BzC1tg
WsUAoOw6kLojEwdGuReeSGdc/eH4t9wv
=YGWn
-----END PGP SIGNATURE-----

--Apple-Mail-15--343599839--
 
B

Bob Aman

(Cross-posting to (e-mail address removed) since at least part of
this message is probably better answered by them. Apologies to the
respective mailing lists for the parts that are off topic.)
Is DL unsuitable for this? That would require only a compiled SVN
library.
DL?

svn lists easily parseable output as one of its features...

I don't think calling out to the command line client is a truely viable option.

Ideally, I need a reliable interface to Subversion for Ruby. I want
to be able to easily wrap it with something more "ruby-like" than the
raw API. Ideally, I need to be able to "checkout" to memory - I
probably don't have the luxury of checking stuff out to disk. The
ultimate purpose is something almost like ViewSVN or WebSVN, except
that I need to, at the very least, be able to modify the metadata from
within the web app. And we're probably talking about around 50-100
concurrent users, not just one person at a time. It needs to be
cross-platform. It needs to be somewhat easy, because I am not a C
hacker by any stretch of the imagination. And it's got to be
reasonably simple to set up on Windows, since, for the moment, that's
the dev environment I'm stuck with.

I've been trying to get the Ruby SWIG bindings to work, but I have
absolutely no idea how to get SWIG to do its thing. It just sits
there and complains about missing files.

--
E:\Ruby Projects\Libraries\ruby-svn\swig>swig svn_client.i
apr.i(47): Error: Unable to find 'apr.h'
svn_types.i(527): Error: Unable to find 'svn_types.h'
svn_delta.i(91): Error: Unable to find 'svn_delta.h'
svn_wc.i(116): Error: Unable to find 'svn_wc.h'
svn_client.i(434): Error: Unable to find 'svn_client.h'
--

Of course, it doesn't help that building svn on Windows seems to
require superhuman effort, though it's quite possible that I'm just
missing some build step somewhere.

But for me to actually do what I want, this thing needs to all get
packaged up in a gem. (http://docs.rubygems.org/read/book/1) Thus
far, I've gotten the impression that even if I were to get this whole
SWIG thing to work, the steps required to get there might be too
difficult for rubygems to handle compiling from source. Which seems
to leave me with precompiled gems? I don't know, I'm kinda fuzzy on
this.

I want this as the end result:
gem install ruby-svn
*poof, magic ensues*

And I want that magic to ensue regardless of what platform I'm running
on. If the user doesn't have subversion installed, I don't want that
to be a problem. I want the only prerequisite to be ruby and
rubygems. That includes build tools. If the user lacks SWIG or vc++
or whatever, I don't want that to prevent the library from working. I
think that leaves me with binaries, but...

It looked like the fxruby library did some stuff with SWIG and managed
to pull it off fairly well, but I'm not sure I want users of the
library to be presented with a list of 10 possible versions for
different platforms when they type gem install ruby-svn like what
happens with fxruby. Especially when one of those platforms is
"ruby". Sooooo.... what happens with fxruby if I'm on Windows and I
select "ruby" as my platform instead of "win32"? "ruby" doesn't make
sense as an option, so ideally, I'd rather just have the end result
work everywhere instead of confusing the user with nonsensical choices
that I don't have much control over.

Also, I don't want to be dealing with bleeding edge stuff from
Subversion's svn repository. I have to make the corporate overlords
happy, and you all know how that goes.

So... is there any way for me to access the subversion client library
without doing any SWIG magic, or at the very least, doing the SWIG
magic ahead of time and then including any necessary binaries for the
various platforms within a single gem? And if I'm absolutely stuck
doing SWIG magic, can someone hold my hand and walk me through getting
that to work in Windows? I've been trying to do this for almost a
week now, and I'm really no further than when I first started.
 
S

Saynatkari

Le 12/4/2005 said:
I'll give it a whirl, see what happens.

From the INSTALL file:

E.1 Prerequisites

[snip requirements]

Please tell me that I don't need to do all of that just to generate
the SWIG bindings for Windows... (mumble, grumble, why can't this be
automated more easily?)

Hey, it is not that bad. See the snippet at the end that
I wrote for a 'native' extension. The code is not all that
great (I was mainly trying to get it to just work) but
that Apache Portable Runtime is some truly horrible stuff.
I was looking through the pickaxe book and I saw that rubygems seems
to make allowance for precompiled gems... Can I make use of this?

Ultimately, what I'd like to create is a simple ruby-svn gem that can
be installed anywhere with zero hassle. If it's possible, I'd like to
just include the external libraries for svn for each of the possible
platforms inside the gem or something like that. I don't want to rely
on the library's user actually having all of the required build tools
(especially for the windows platform). Is this possible? If so, how
hard is it, and what do I have to watch out for as far as pitfalls?
I'd prefer not to have to make seperate gems for each platform, is
that possible, given what I want to do?

For that matter, how hard would it be to make a pure-ruby svn client
that conversed with svn only via http/apache? How bad of an idea is
this?

Be aware, I've never tried to make a gem before. (Heck, I'm only just
getting started with ruby, so...)

Someone is already working on a SVN extension to go with the RSCM
project... I would suggest taking a look if you can help there
instead?

E

//////////////////////
// rsvn.c

//-- rsvn_client_ls / Method --//
/* -- Lists the contents of a repo directory.
*/
VALUE rsvn_client_ls(VALUE self,
VALUE path_or_url,
VALUE revision,
VALUE recurse)
{
rsvn_client_rep* clt; // The raw client info
const char* encoded_uri; // URI-encoded path/URL
svn_opt_revision_t revision_data; // SVN revision information
apr_pool_t* pool; // Memory pool for this operation
apr_pool_t* subpool; // Temporary pool for looping
apr_hash_t* directory; // Hash for the file/dir names
apr_hash_index_t* element; // A single element in the directory
has
const void* filename; // Hashed file/directory name
void* file_entry; // File information
svn_error_t* error; // Any received errors
VALUE directory; // The directory structure

// Initializations

// Get the raw data for the client
Data_Get_Struct(self, rsvn_client_rep, clt);

// Extract the revision information from the Ruby object
_rsvn_revision_get_svn_revision(revision, &revision_data);

// Subpool for safe looping
pool = svn_pool_create(clt->memory_pool);
subpool = svn_pool_create(pool);

// Generate an encoded URI (spaces replaced etc.)
// TODO: Can't seem to be able to access local reps on a Windows
// machine.
encoded_uri = svn_path_uri_encode(STR2CSTR(path_or_url), pool);

// Implementation

// Propagate to SVN
error = svn_client_ls(&directory, // Directory entries
encoded_uri, // Path to list
&revision_data, // Revision to retrieve
0, // Recursion
clt->context, // Context
pool);

if (error != 0)
{
// Throw an error <fix>Only prints the topmost error</fix>
rb_raise(rsvn_eSVNError,
"Ruby-SVN::rsvn_new_client (%s:%d): %s\n", error->file,
error->line,
error->message);
}

// Sort the retrieved file names
// TODO: Remove completely?
//files = svn_sort__hash(directory_hash,
svn_sort_compare_items_as_paths,
pool);


// Create a directory to fill
directory = rb_class_new_instance(0, 0, rsvn_cDirectory);

// Fill it
for (element = apr_hash_first(pool, directory);
element != 0; element = apr_hash_next(element))
{
// Extract the key (filename) and value (file info)
// from the hash, ignore key length
apr_hash_this(element, &filename, 0, &file_entry);

// Add the file to the directory
_rsvn_directory_add(directory, filename, file_entry);
}

// Release both pools
svn_pool_destroy(pool);

// The user will receive the directory
return directory;
}

// ...

//-- _rsvn_client_on_username_prompt / Callback --//
/* -- Invoked if the authenticator needs to get
the username interactively.
*/
svn_error_t*
_rsvn_client_on_username_prompt(svn_auth_cred_username_t** credentials,
void* client,
const char* realm_string,
svn_boolean_t may_save,
apr_pool_t * pool)
{
VALUE self; // Calling Client object
VALUE listener; // Event listener for this Client
VALUE retval; // The retrieved values in a hash
svn_auth_cred_username_t* cred = 0; // Collected credential data

// Extract the variables, propagate error out if there's a problem
SVN_TRY(_rsvn_client_get_listener(client, &self, &listener),
"Ruby-SVN::rsvn_client_on_username_prompt: ");

// Query the Listener for a username (may_save should be 0 or 1)
retval = rb_funcall(listener,
ID_PROMPT_USERNAME,
2,
rb_str_new2(realm_string),
INT2FIX(may_save));

// Verify the query succeeded
if (retval == Qnil)
{
// Error and cancel
return svn_error_createf(SVN_ERR_CANCELLED,
0,
"Ruby-SVN::rsvn_client_on_username_prompt: No username from
Listener.");
}

cred = apr_palloc(pool, sizeof(svn_auth_cred_username_t));

// Collect the data <todo>UTF conversion unnecessary?</todo>
SVN_TRY(svn_utf_cstring_to_utf8(&cred->username,
STR2CSTR(rb_funcall(retval,
ID_GET_INDEX,
1,

rb_str_new2("username"))),
pool),
"Ruby-SVN::rsvn_client_on_username_prompt: ");

cred->may_save = FIX2INT(rb_funcall(retval,
ID_GET_INDEX,
1,
rb_str_new2("cache")));

// No errors, we're done
*credentials = cred;

return SVN_NO_ERROR;
}

// End
 
E

Eric Hodel

--Apple-Mail-22--310562652
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed

(Cross-posting to (e-mail address removed) since at least part of
this message is probably better answered by them. Apologies to the
respective mailing lists for the parts that are off topic.)


DL?

DL is a generic dynamically-linked library wrapper that requires none=20
of this C compiler business. You load a so/dll and tell Ruby what the=20=

parameters are for the C calls, and it takes care of all the argument=20
passing for you.

DL ships with ruby 1.8, but there doesn't seem to be an exact home page=20=

for it.

http://www.google.com/search?q=3Druby+dl

Will give you several tutorial/documents on it.
I don't think calling out to the command line client is a truely=20
viable option.
Why?

Ideally, I need a reliable interface to Subversion for Ruby.

If you build it to be reliable, it will be reliable. Unit tests come=20
in really handy for this.
I want
to be able to easily wrap it with something more "ruby-like" than the
raw API.

There's nothing that prevents an svn wrapper from presenting a=20
ruby-like API. DL and SWIG only give different tradeoffs in how this=20
is implemented.
Ideally, I need to be able to "checkout" to memory - I
probably don't have the luxury of checking stuff out to disk.

While many of the svn commands can work directly with the repository=20
without local storage, I don't know of any way to avoid writing to disk=20=

for those commands that require a local checkout.
The
ultimate purpose is something almost like ViewSVN or WebSVN, except
that I need to, at the very least, be able to modify the metadata from
within the web app. And we're probably talking about around 50-100
concurrent users, not just one person at a time.

FreeBSD's CVSweb shells out for all of its commands, and likely handles=20=

50-100 concurrent users just fine (probably more, in fact).
It needs to be cross-platform.

This is easiest if you just shell out, since it will be easier to=20
maintain a svn wrapper than maintaining libraries for the platforms=20
that don't typically ship with a compiler (windows).
It needs to be somewhat easy, because I am not a C
hacker by any stretch of the imagination. And it's got to be
reasonably simple to set up on Windows, since, for the moment, that's
the dev environment I'm stuck with.

Sounds like you'd rather to an svn wrapper or DL (in that order).
I've been trying to get the Ruby SWIG bindings to work, but I have
absolutely no idea how to get SWIG to do its thing. It just sits
there and complains about missing files.

DL or an svn wrapper will probably get you farther faster than SWIG,=20
since both have a lower barrier to entry. For an svn wrapper you just=20=

need svn installed. For DL you need to be able to find an svn .dll or=20=

so, which may be as simple as installing svn. For SWIG you need=20
headers and a compiler, which can be no fun if there's no default=20
compiler and you have 2 or 3 different compilers to choose from.
--
E:\Ruby Projects\Libraries\ruby-svn\swig>swig svn_client.i
apr.i(47): Error: Unable to find 'apr.h'
svn_types.i(527): Error: Unable to find 'svn_types.h'
svn_delta.i(91): Error: Unable to find 'svn_delta.h'
svn_wc.i(116): Error: Unable to find 'svn_wc.h'
svn_client.i(434): Error: Unable to find 'svn_client.h'
--

Of course, it doesn't help that building svn on Windows seems to
require superhuman effort, though it's quite possible that I'm just
missing some build step somewhere.

If you're having these difficulties, do you expect other people to find=20=

it easier? Do you feel you can maintain what you've done when you've=20
completed your wrapper? These are important things to think about=20
before you put your hands on the keyboard. I have failed before when=20
trying to do something Too Big=99 because I didn't think about how hard=20=

it would be to complete.
But for me to actually do what I want, this thing needs to all get
packaged up in a gem. (http://docs.rubygems.org/read/book/1) Thus
far, I've gotten the impression that even if I were to get this whole
SWIG thing to work, the steps required to get there might be too
difficult for rubygems to handle compiling from source. Which seems
to leave me with precompiled gems? I don't know, I'm kinda fuzzy on
this.

I believe gems work can ship both precompiled libraries or build their=20=

own. I seem to recall that gems have setup.rb on the inside (or=20
something like it).
I want this as the end result:
gem install ruby-svn
*poof, magic ensues*

An svn wrapper or DL are going to get you something that works fastest=20=

and require the fewest incantations before the magic ensues.
And I want that magic to ensue regardless of what platform I'm running
on. If the user doesn't have subversion installed, I don't want that
to be a problem.

I think that you'll be better off making this a requirement, I would=20
hate to be stuck duplicating the three different svn access protocols=20
(http/DAV, file, svn) or even one of them.

The subversion people seem to have done a good job of getting=20
no-brainer svn packages for all the major platforms.
I want the only prerequisite to be ruby and
rubygems. That includes build tools. If the user lacks SWIG or vc++
or whatever, I don't want that to prevent the library from working. I
think that leaves me with binaries, but...

Remember that you'll have to do the work of making this cross-platform,=20=

which means keeping all the necessary packages up to date. That sounds=20=

like a lot of work.
It looked like the fxruby library did some stuff with SWIG and managed
to pull it off fairly well,

I believe that Lyle has a good deal of C mojo in his back pocket, which=20=

would make SWIG much easier for him.
but I'm not sure I want users of the
library to be presented with a list of 10 possible versions for
different platforms when they type gem install ruby-svn like what
happens with fxruby. Especially when one of those platforms is
"ruby". Sooooo.... what happens with fxruby if I'm on Windows and I
select "ruby" as my platform instead of "win32"? "ruby" doesn't make
sense as an option, so ideally, I'd rather just have the end result
work everywhere instead of confusing the user with nonsensical choices
that I don't have much control over.
Also, I don't want to be dealing with bleeding edge stuff from
Subversion's svn repository. I have to make the corporate overlords
happy, and you all know how that goes.

So... is there any way for me to access the subversion client library
without doing any SWIG magic, or at the very least, doing the SWIG
magic ahead of time and then including any necessary binaries for the
various platforms within a single gem? And if I'm absolutely stuck
doing SWIG magic, can someone hold my hand and walk me through getting
that to work in Windows? I've been trying to do this for almost a
week now, and I'm really no further than when I first started.

Ruby SWIG wrappers for svn once existed, but bitrotted due to lack of=20
maintenance...



It sounds like you need to step back and re-evaluate all of the options=20=

available.



SWIG seems to be more like a belt-fed, automatic, pneumatic nail gun,=20
and less like a box of nails and a hammer. Just about anybody can use=20=

a hammer, but a belt-fed, automatic, pneumatic nail gun is going to=20
take lots of practice to use correctly. Once you have it down though,=20=

you'll be able to pound out houses with ease. If you can invest the=20
time and energy to build SWIG bindings for subversion, then you'll get=20=

a great tool.

If you can't invest that time, I would instead go for DL, or a wrapper=20=

for svn.



Really, I think you should check out DL, you'll quickly cut your=20
problems down to those of actually wrapping the svn dll/so rather than=20=

trying to figure out why SWIG can't find your apr or svn headers.

--=20
Eric Hodel - (e-mail address removed) - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

--Apple-Mail-22--310562652
content-type: application/pgp-signature; x-mac-type=70674453;
name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iEYEARECAAYFAkJbbasACgkQMypVHHlsnwQ4/wCggSYuB5NqCLmnanoRtNYu89fJ
XJIAoM0oTteK01CMwldSkk2jGJop0tmK
=4HCk
-----END PGP SIGNATURE-----

--Apple-Mail-22--310562652--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top