freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FR-devel] Managing Ruby extensions and FreeRIDE


From: Rich Kilmer
Subject: [FR-devel] Managing Ruby extensions and FreeRIDE
Date: Sun, 15 Sep 2002 23:45:55 -0400

FreeRIDE team,

I have been thinking about coming up with a standard way to wrap Ruby
extension libraries (site_ruby stuff) as plugins (such as log4r, rexml,
fxruby, etc).  In order to do this we need to control the ruby path
($:).  The concept is something along these lines (path names are
examples)

Ruby path ($:) is reduced to:
$: = ["c:/ruby/lib/ruby/1.7", "c:/ruby/lib/ruby/1.7/i386-mswin32", "."] 
Notice there are no references to the site_ruby directory.  Then, as a
plugin is loaded its directory is added to the Ruby path:

c:/freeride/plugins/rexml2.4.0/plugin.xml
                           .../rexml_plugin.rb
                           .../rexml/(all rexml files)

After this plugin is loaded, the new path looks like:
$: = ["c:/freeride/plugins/rexml2.4.0", "c:/ruby/lib/ruby/1.7",
"c:/ruby/lib/ruby/1.7/i386-mswin32", "."]

So, if in your code you added the dependency on REXML then you would not
load without it, and to access rexml you would still just have:

require 'rexml/document' # or whatever...

This would mean that EVERY library that is used in FreeRIDE would have
to be packaged as a plugin...the upside is FreeRIDE/FreeBASE plugins
have (or will have ;-) version capability and dependency management.
The actual "packaging" is brain-dead simple.  Just copy what would be in
the site_ruby/1.7 directory into the plugin directory (with the .so
files in the root of the plugin's directory.  This packaging of
libraries as plugins is the way the Eclipse project works (in Java) for
the exact same reason.

I also want to add into FreeBASE the ability to specify the platform
that the plugin runs on...that way we could have Linux plugins and Win32
plugins (and OS X plugins...some day :-) all sitting on the same
machine, but those compiled for other platforms would never load.

We could do this on an existing Ruby installation by chopping everything
except the core library directories out of the $: path upon FreeRIDE
loading, or distributing our own version of Ruby with FreeRIDE.

Thoughts?

-Rich






reply via email to

[Prev in Thread] Current Thread [Next in Thread]