Goal: Equip my C# project with a sane, useful IronRuby testing environment
that is consistent across OS X and Windows. To that end, I hope to use RVM,
Bundler (with binstubs), Rake, RR, and RSpec.

Background:
Per http://www.mono-project.com/Release_Notes_Mono_2.10#Languages:
"Starting with Mono 2.10, we are bundling the open source F# compilers and
tools, and the IronRuby <http://ironruby.net/> and
IronPython<http://ironpython.net/> systems
in our Linux packages as well as in our Mac installer."
So, my /Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/
contains: bin with all /compiled/ IronRuby assemblies and configs (not
including important stuff like gem, etc.), and Lib with a regular ol Ruby
standard library with IronRuby goodies mixed in.

Problems:
- RVM doesn't support IronRuby at all, and all patches or forks that I found
have gone stale.
- requirement.rb patch is necessary to even begin using rubygems:
http://www.ruby-forum.com/topic/1864531
- Mono's IronRuby distribution doesn't include gem/igem, so I ganked it from
the Github repo @v1.1.3, but executing something like "ir
IronLanguages/Languages/Ruby/Scripts/bin/gem install bundler --backtrace"
produces this output:
ERROR:  Loading command: install (IndexError)
    Array index is out of range.
mscorlib:0:in `GetChars'
mscorlib:0:in `GetChars'
 mscorlib:0:in `GetChars'
mscorlib:0:in `ReadBuffer'
mscorlib:0:in `Read'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
mscorlib:0:in `require'
 mscorlib:0:in `CallSite.Target'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 mscorlib:0:in `require'
mscorlib:0:in `invoke_object__this___Func`5<CallSite, RubyScope, object,
object, object>_CallSite_RubyScope_object_object'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:164:in
`const_missing'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:164:in
`load_and_instantiate'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:90:in
`[]'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:146:in
`find_command'
 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:133:in
`process_args'
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/command_manager.rb:104:in
`run'
- Using standard Ruby, I can "gem install bundler
--install-dir 
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1"
and
"bundle install --binstubs", but then running ir bin/rspec spec/pong_spec.rb
produces:
mscorlib:0:in `invoke_object__this___Func`4<object, Proc, object,
object>_object_Proc_object': undefined method `realpath' for File:Class
(NoMethodError)
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/pathname.rb:446:in
`realpath'

I can get around this by editing the binstubs to just use __FILE__ instead
of Pathname.new(__FILE__).realpath, which gives me:

$
GEM_PATH=/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1
ir bin/rspec spec/pong_spec.rb
mscorlib:0:in `invoke_object__this___Func`4<object, Proc, object,
object>_object_Proc_object': can't convert Pathname into String (TypeError)
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/settings.rb:5:in
`initialize'
 from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:185:in
`settings'
 from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:261:in
`configure_gem_home_and_path'
 from mscorlib:0:in `invoke_object__this___Func`4<object, Proc, object,
object>_object_Proc_object'
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:82:in
`configure'
 from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:136:in
`definition'
 from mscorlib:0:in `invoke_object__this___Func`4<object, Proc, object,
object>_object_Proc_object'
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:126:in
`load'
 from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:110:in
`setup'
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
 from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/bin/../Lib/ruby/1.9.1/rubygems/custom_require.rb:28:in
`require'
from
/Library/Frameworks/Mono.framework/Versions/2.10.2/lib/ironruby/Lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/setup.rb:17

Current workarounds:
Steal gem from IronLanguages, patch requirement.rb, don't use RVM, don't use
Bundler, use standard Ruby to install gems to IronRuby's gems dir.

Plea for help:
The lack of RVM+Bundler support and all the manual mucking around is
definitely sub-optimal; is anyone working on this problem, or does anyone
have suggestions on where to start trying to fix it? I really want to show
my OS X Ruby brethren all the cool stuff that's possible with IronRuby, but
there's no way I can make them go through this.

-- 
Michael Harrington | Rock Star from Mars
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to