[Ironruby-core] Towards gems - setup.rb

Wayne Kelly w.kelly at qut.edu.au
Wed Feb 20 23:03:59 EST 2008

I thought I'd see how far I could get trying to execute gems setup.rb using IronRuby.

The following lists the issues that I came across and how I fixed or worked around them:

 1.  Encountered assertion error in MergeLocations method when parsing setup.rb
 - changed code to cope with case where start location > end location
 - fixed a subsequent bug where _currentLineIndex wasn't restored after encountering a HEREDOC
 (see MergeLocations.patch)
 2.  Encountered unimplemented exception for NTH_REF.TransformRead
 - quick hack: provide a dummy implementation that simply returns Null
 (see NTH_REF.patch)
 3.  Undefined constant ENV
 - created a new global constant of type ENV and implemented [] and delete methods in EnvOps.cs
 - note, this should really have be done by adding singleton methods rather than creating a new type
 (see ENV.patch)
 4.  Uninitialized constant Config
 - this is meant to come from rbconfig.rb which gets loaded when gems are loaded via -rubygems command line option
 - so I added a -r command line option to automatically preload said modules
 - we may also want to support getting command line arguments from RUBYOPT environment variable.
 (see RequireOption.patch)
    *   Now using rbx.exe /paths:\ruby\lib\ruby\1.8;\ruby\lib\ruby\site_ruby\1.8;\ruby\lib\ruby\1.8\i386-mswin32 -rubygems setup.rb
 5.  Loads ubygems.rb but then can't load thread.so
 - quick hack: change thread.rb so that it doesn't require thread.so
 6.  Runtime error: version 1.8.6 doesn't match executable version in rbconfig.rb
 - change rbconfig.rb to expect
 - Note this is going to be a problem in general as many ruby apps access RUBY_VERSION at runtime and expect it to be 1.8.x
   The question is, should the version represent the version of the language supported or the version of the platform implementation?
 7.  Versions still don't match as RUBY_VERSION constant is a CLR string rather than a MutableString.
 - change RUBY_VERSION and RUBY_RELEASE_DATE to be MutableString
 (see RUBY_VERSION.patch)
 8.  Uninitialized constant DESTDIR in rbconfig.rb
 - this is due to bug in defined?, so I extended AstNodeDescriptionExpression.TransformRead to deal correctly with uninitialized constants
 (see defined.patch)
 9.  Scoping bug for nested blocks in rbconfig.rb as discussed in a previous email
 - create new CodeContext constructor to initialize parent property for nested code contexts
 - Note: these changes are entirely within the DLR, not IronRuby! - is it really a DLR bug or is IronRuby
   using these constructs incorrectly?
 (see NestedContext.patch)
 10. undefined method gsub! in rbconfig.rb
 - this method is not yet implemented. Is it waiting for port of the JRuby regular expression library?
   Are we sure we can't get by with built-in .NET regular expressions (with some workarounds)?
   Does anyone have an example of a Ruby regular expression that we can't deal with using .NET regular expressions?

Some of the patches that I've provided are quick and dirty hacks, so I don't necessarily expect them to find their way into the official version in their current form, but they should at least give some idea about some of the fixes that will be required to get gems and hence rails working.

Cheers, Wayne.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MergeLocations.patch
Type: application/octet-stream
Size: 3298 bytes
Desc: MergeLocations.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0007.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NTH_REF.patch
Type: application/octet-stream
Size: 498 bytes
Desc: NTH_REF.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0008.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: defined.patch
Type: application/octet-stream
Size: 4204 bytes
Desc: defined.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0009.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ENV.patch
Type: application/octet-stream
Size: 1811 bytes
Desc: ENV.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0010.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RequireOption.patch
Type: application/octet-stream
Size: 2867 bytes
Desc: RequireOption.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0011.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RUBY_VERSION.patch
Type: application/octet-stream
Size: 917 bytes
Desc: RUBY_VERSION.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0012.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NestedContext.patch
Type: application/octet-stream
Size: 1676 bytes
Desc: NestedContext.patch
Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080221/a61504bf/attachment-0013.obj 

More information about the Ironruby-core mailing list