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.

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

38 Responses to “Experimental RubyCLR gem”

  1. This is what I get from gem check -t rubyclr:
    d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.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:in `require’
    from ./tests/tests_basic.rb:4
    from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    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:in `each’
    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:in `execute’
    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/site_ruby/1.8/rubygems/cmd_manager.rb:88:in `run’
    from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:29:in `run’
    from d:/ruby/bin/gem.bat:24
    Are there some other steps as well? This is my first try to install RubyCLR.

  2. 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?

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

  4. Having the exact same issues as Alexey.

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

  6. Much better! Thanks, John!

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

  8. 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:in `gem_original_require’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require’
    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:in `unit_test’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:in `each’
    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:in `process_args’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:88:in `run’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:29:in `run’
    from c:/ruby/bin/gem.bat:24

  9. 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:in `gem_original_require’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require’
    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:in `unit_test’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb:134:in `each’
    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:in `process_args’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:88:in `run’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:29:in `run’
    from c:/ruby/bin/gem.bat:24

  10. 9:27:57 >gem install text-format

    C:\
    9:29:40 >gem check -t rubyclr
    ERROR: 205 tests, 447 assertions, 2 failures, 2 errors

  11. Brent Rowland 03. Oct, 2006 at 9:02 am
    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 #
    
  12. 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.

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

  14. 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…)

  15. Nevermind…working fine now.

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

  17. 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!

  18. 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
    
  19. 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]

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

  21. Scott Hanselman 03. Oct, 2006 at 4:01 pm

    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:in `re
    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:in `re
    quire__’
    from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:24:in `re
    quire’
    from tests_basic.rb:4

  22. Scott Hanselman 03. Oct, 2006 at 4:03 pm

    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 #

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

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

  25. Scott Hanselman 03. Oct, 2006 at 4:38 pm

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

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

  27. 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?

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

  29. Awesome John and thanks for the install guide Andrzej.

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

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

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

  33. 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:in `gem_original_require’
    from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.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/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from C:/Development/ruby/lib/rubyclr/Src/Ruby/wpf.rb:1
    from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from C:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from (irb):1
    irb(main):002:0>
    What do i need to do here?

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

  35. 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 ?