John Lam 1997 — 2026

Experimental RubyCLR gem

I finally got some time to hack together an experimental gem for RubyCLR distribution.

Here it is.

To install, just download the file and run gem install rubyclr-0.5.0.gem. Afterwards, run gem check -t rubyclr to verify that the unit tests pass on your computer.

There is still the unfortunate ActiveRecord dependency in the unit tests. So you must have the ActiveRecord gem installed if you want to pass the gem check. This will be fixed in the future.

37 archived reader comments

Alexey (2006-10-03)

This is what I get from gem check -t rubyclr:

d:/ruby/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in gem_original_require': no such file to load — rubyclr(LoadError) from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’ from ./tests/tests_basic.rb:4 from d:/ruby/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in gem_original_require' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’ from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:in unit_test' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:ineach’ from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:in unit_test' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:559:inexecute’ from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:69:in invoke' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:117:in``process_args’ from d:/ruby/lib/ruby/siteruby/1.8/rubygems/cmdmanager.rb:88:in run' from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:29:inrun’ from d:/ruby/bin/gem.bat:24

Are there some other steps as well? This is my first try to install RubyCLR.

John Lam (2006-10-03)

Alexey, did you do the gem install step first? I’m assuming that you are running the Ruby 1 click installer? If so, what’s in your d:\ruby\lib\ruby\gems\1.8\gems\rubyclr-0.5.0\lib directory? Do you see rubyclr.rb there?

Alexey (2006-10-03)

I did gem install, but d:\ruby\lib\ruby\gems\1.8\gems\rubyclr-0.5.0\ only has tests and Samples subdirectories, nothing else.

Ray V (2006-10-03)

Having the exact same issues as Alexey.

John Lam (2006-10-03)

Just updated the file. The missing lib dir should be there now.

Ray V (2006-10-03)

Much better! Thanks, John!

Alexey (2006-10-03)

ERROR: 205 tests, 447 assertions, 2 failures, 2 errors

Andrej Gaevskij (2006-10-03)

HI, John! 9:22:23 gem install “C:\Documents and Settings\gaevsky\Desktop\rubyclr-0.5.0.gem” Successfully installed rubyclr, version 0.5.0 C:\ 9:22:35 gem check -t rubyclr c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require`': no such file to load — text/format (MissingSourceFile) from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/`custom_require`.rb:27:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/`active_support`/dependencies.rb:147:in `require' from c:/ruby/lib/ruby/gems/1.8/gems/rubyclr-0.5.0/lib/rubyclr.rb:2 from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/`custom_require`.rb:33:ingem_original_require' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:inrequire’ from ./tests/tests_basic.rb:4 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require`' from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/`custom_require`.rb:27:in `require' from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/validator.rb:134:inunit_test' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:ineach’ from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:in unit_test`' from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/`gem_commands`.rb:559:in `execute' from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/command.rb:69:in `invoke' from c:/ruby/lib/ruby/`site_ruby`/1.8/rubygems/`cmd_manager`.rb:117:inprocess_args' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:88:inrun’ from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:29:in `run’ from c:/ruby/bin/gem.bat:24

Andrej Gaevskij (2006-10-03)

9:27:57 >gem install text-format … C:\ 9:29:40 >gem check -t rubyclr ERROR: 205 tests, 447 assertions, 2 failures, 2 errors

Andrej Gaevskij (2006-10-03)

Here is result of running RssReader.rb((( http://rafb.net/paste/results/KOhNAq99.html

Brent Rowland (2006-10-03)

C:\download>gem install rubyclr-0.5.0.gem
Attempting local installation of 'rubyclr-0.5.0.gem'
Successfully installed rubyclr, version 0.5.0

C:\download>gem check -t rubyclr
ERROR: While executing gem ... (NoMethodError)
    undefined method `reference_file' for #

John Lam (2006-10-03)

Brent, I think you have an older version of the gem - download it again. The older version was missing the entire lib directory (due to curious interpretation of / vs. \ in Ruby.

Justin (2006-10-03)

John,

Worked like a charm! I got similar outputas Andrej and others above, but was not able to determine where the two errors where.

Edwin King (2006-10-03)

Not able to get it:

C:\ruby>gem install rubyclr-0.5.0.gem ERROR: While executing gem … (Gem::GemNotFoundException) Could not find rubyclr-0.5.0.gem (> 0) in the repository

(“…you were not put on this earth to ‘get it’, mr. burton…)

Edwin King (2006-10-03)

Nevermind…working fine now.

Joao Pedrosa (2006-10-03)

Hi,

first, I would like to say thank you for RubyCLR. It’s a very nice project.

Now, to what I think is bug/feature that needs fixing. hehe. Here’s the code:

require ‘wpf’

w = Window.new sp = StackPanel.new sp.orientation = Orientation::Horizontal cb = CheckBox.new sp.children.add cb cb.content = ‘Test?’ cb.isEnabled = true #runs

cb.IsChecked = true # doesn’t run p cb.IsChecked # doesn’t run

w.content = sp w.show Application.new.run

Maybe the problem is that the “ischecked” property has three states? Null/True/False? But when one of the commented out lines are uncommented, I get some error here. I’m using your latest gem version.

Thanks again. Great, wonderful job.

John Lam (2006-10-03)

Hi Joao,

Yes - there’s a problem with nullable types right now. I need to up the priority on that item - a workaround that I use is to create an explicit wrapper method using the inline C# feature of RubyCLR to at least make it so that you can make forward progress.

Hope that helps!

Joao Pedrosa (2006-10-03)

Here’s the code again:

require 'wpf'

w = Window.new
sp = StackPanel.new
sp.orientation = Orientation::Horizontal
cb = CheckBox.new
sp.children.add cb
cb.content = 'Test?'
cb.isEnabled = true #runs
#cb.IsChecked = true # doesn't run
#p cb.IsChecked # doesn't run
w.content = sp
w.show
Application.new.run

Andrzej (2006-10-03)

Hi, I’ve got the same problem as Brent: ERROR: While executing gem … (NoMethodError) undefined method `reference_file’ for # The gems\rubyclr-0.5.0 contains lib directory. ruby 1.8.4 (2006-04-14) [i386-mswin32]

Will Green (2006-10-03)

C:\installersgem check -t rubyclr ERROR: While executing gem … (NoMethodError) undefined method `reference_file’ for # Downloaded the gem at 6:50 p.m. on October 3rd.

Scott Hanselman (2006-10-03)

C:\ruby\lib\ruby\gems\1.8\gems\rubyclr-0.5.0\tests ruby tests_basic.rb c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in require\_\_': No such file to load — text/format (MissingSourceFile) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inre quire’ from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_suppo rt/dependencies.rb:147:in require' from c:/ruby/lib/ruby/gems/1.8/gems/rubyclr-0.5.0/lib/rubyclr.rb:2 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:24:inre quire__’ from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:24:in re quire' fromtests_basic`.rb:4

Scott Hanselman (2006-10-03)

C:\Documents and Settings\shanselm “c:\ruby\bin\ruby.exe” “c:\ruby\bin\gem” check -t rubyclr ERROR: While executing gem … (NoMethodError) undefined method `reference_file’ for #

John Lam (2006-10-03)

Regarding the text/format gem, you’ll need to gem install text-format first. I still need to remove that dependency (or figure out a good layering mechanism).

Joao Pedrosa (2006-10-03)

Cool, it worked, John! With all the “inline” power, what can’t be done, then? :-) Please don’t answer. j/k.

I tried to use VB.NET for its dynamic support, so I can later reuse this a code like this one for several different controls. Here’s the code:

    inline :vb do |compiler|
      compiler.reference 'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll'
      compiler.compile <<-EOF
      Public Class ARNativeHelpers
          Public Shared Function GetIsChecked(ByVal comp As Object) As Boolean
              Dim result As Boolean
              result = comp.isChecked
              If (result = True) Then
                  Return True
              Else
                  Return False
              End If
          End Function
          Public Shared Function SetIsChecked(ByVal comp As Object, v As Boolean) As Boolean
              comp.isChecked = v
          End Function
      End Class
      EOF
    end

Totally amazing! Thanks.

Scott Hanselman (2006-10-03)

I’m cool with dependencies, it’s just that I’d rather be prompted during the install of your gem for those.

John Lam (2006-10-03)

I’m still learning the whole gem and dependency thing. It will be fixed on the next release of the gem.

Andrej Gaevskij (2006-10-04)

Here is a complete RubyCLR installation guide - > http://gaech.blogspot.com/2006/10/rubyclr-complete-installation-guide.html

Andrzej (2006-10-04)

As an update to my previous complaint. I tried installing rubyclr on another machine and it works fine (are 2 unit tests errors ok?).

The machine differs in ruby version (the successful one is using ruby 1.8.4 (2005-12-24) [i386-mswin32], while the previous one was using ruby 1.8.4 (2006-04-14) [i386-mswin32]. Could it be a source of problem?

John Lam (2006-10-05)

Andrej, thanks for creating the installation guide!

Andrzej, I have to start creating a VMWare machine matrix to track issues on different Ruby versions - I’m still building on 1.8.2 to stay conservative for the time being. But clearly, I need to start testing on more recent builds of Ruby.

Josh (2006-10-05)

Awesome John and thanks for the install guide Andrzej.

Will Green (2006-10-05)

OK, installed text-format and text-hyphen. Now, when I run

gem check -t rubyclr

i get:

./tests/tests_basic.rb:174: [BUG] Segmentation fault
ruby 1.8.4 (2006-04-14) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Will Green (2006-10-05)

Might this, perchance, have something to do with not having the .Net 3 CTP framework(s) installed?

John Lam (2006-10-05)

Will, this looks like the problem that Andrezj mentioned earlier in the comments. It’s that specific version of Ruby (1.8.4 from 2006-04-14). If you revert to the Christmas build it apparently works. I’m going to need to install that version of Ruby somewhere so that I can debug what’s causing this segfault.

Thibaut Barrère (2006-10-06)

Works perfectly here!

Sanin Saracevic (2006-11-21)

Pardon my ignorance but I am trying the run posted by Joao and run into the following problem (ruby 1.8.5):

irb(main):001:0> require ‘wpf’ NameError: undefined local variable or method get_types_in_loaded_assemblies' for RubyClr:Module from C:/Development/ruby/lib/ruby/gems/1.8/gems/rubyclr-0.5.0/lib/dynamicmethod.rb:183:in``method_missing’ from C:/Development/ruby/lib/rubyclr/Src/Ruby/core.rb:446:in init' from C:/Development/ruby/lib/rubyclr/Src/Ruby/core.rb:476 from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingemoriginalrequire’ from C:/Development/ruby/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in require' from C:/Development/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in equire’ from C:/Development/ruby/lib/rubyclr/Src/Ruby/rubyclr.rb:10 from C:/Development/ruby/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in gem_original_require' from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’ from C:/Development/ruby/lib/rubyclr/Src/Ruby/wpf.rb:1 from C:/Development/ruby/lib/ruby/siteruby/1.8/rubygems/customrequire.rb:27:in gem_original_require' from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’ from (irb):1 irb(main):002:0>

What do i need to do here?

Sanin Saracevic (2006-11-21)

Ignorant indeed: I guess I would have to install .net 3.0 first — Duh!!

shilpa (2009/01/09)

i m also facing the same issue i get the following error when i m using ruby with some .net framework c:/ruby/lib/ruby/gems/1.8/gems/rubyclr-0.5.2-mswin32/Src/Ruby/dynamicmethod.rb:183: in `method_missing’ did i missed anything in installation ?