# Towards gems - setup.rb

**URL:** <https://www.ruby-forum.com/t/towards-gems-setup-rb/129739>\
**Category:** IronRuby\
**Created:** [February 21, 2008, 6:03am UTC](https://www.ruby-forum.com/t/towards-gems-setup-rb/129739 "2008-02-21T06:03:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wayne\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wayne\_K](https://www.ruby-forum.com/u/Wayne_K)\
**Post date:** [February 21, 2008, 6:03am UTC](https://www.ruby-forum.com/t/towards-gems-setup-rb/129739/1 "2008-02-21T06:03:48Z")

</div>

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)

1. Encountered unimplemented exception for NTH\_REF.TransformRead

- quick hack: provide a dummy implementation that simply returns Null  
(see NTH\_REF.patch)

1. 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)

1. 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

1. Loads ubygems.rb but then can’t load thread.so

- quick hack: change thread.rb so that it doesn’t require thread.so

1. Runtime error: version 1.8.6 doesn’t match executable version  
1.0.0.0 in rbconfig.rb

- change rbconfig.rb to expect 1.0.0.0.
- 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?

1. 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)

1. 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)

1. 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)

1. 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.

---

<div class="post-metadata">

**Author:** ![Wayne\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wayne\_K](https://www.ruby-forum.com/u/Wayne_K)\
**Post date:** [February 21, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/towards-gems-setup-rb/129739/2 "2008-02-21T17:23:17Z")

</div>

Wayne K.:

> I thought I’d see how far I could get trying to execute gems setup.rb  
> using IronRuby.
> 
> 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.

Thanks for sending this along, Wayne!

We’re buried getting ready for MIX right now, but we’ll definitely get  
right on these when the schedule eases up a bit 🙂

Thanks,  
-John

---

<div class="post-metadata">

**Author:** ![Wayne\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wayne\_K](https://www.ruby-forum.com/u/Wayne_K)\
**Post date:** [February 22, 2008, 12:58am UTC](https://www.ruby-forum.com/t/towards-gems-setup-rb/129739/3 "2008-02-22T00:58:43Z")

</div>

> -----Original Message-----  
> From: removed\_email\_address@domain.invalid  
> [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of  
> John L. (DLR)  
> Sent: Friday, 22 February 2008 2:21 AM  
> To: removed\_email\_address@domain.invalid  
> Subject: Re: [Ironruby-core] Towards gems - setup.rb
> 
> We’re buried getting ready for MIX right now, but we’ll  
> definitely get right on these when the schedule eases up a bit 🙂

Hi John,

As an ex-project lead, I understand this situation all too well!  
I realize you guys are tied up with MIX, so please don’t feel any  
pressure to respond to my postings promptly.

Any bombshells planned for MIX this year? 🙂

BTW, my next step will be to use the trace information to derive some  
test cases  
for these classes.

I’m not yet working on actually implementing any of these classes, so if  
others  
want to volunteer for specific classes, please do so now.

Cheers, Wayne.

---

<div class="post-metadata">

**Author:** ![Wayne\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b5ac83/32.png) [@Wayne\_K](https://www.ruby-forum.com/u/Wayne_K)\
**Post date:** [February 25, 2008, 11:12pm UTC](https://www.ruby-forum.com/t/towards-gems-setup-rb/129739/4 "2008-02-25T23:12:57Z")

</div>

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Wayne K.  
Sent: Wednesday, February 20, 2008 8:04 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Towards gems - setup.rb

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)  
I’ve fixed this one. Thanks for the report!  
Tomas
