Ruby and .NET for the uninitiated

Coming with no experience in both Ruby or IronRuby, this is just a big dump of my thoughts on the topic as i make my way around to learn them both and bring them into direct use within our project.

  • Most frustrating thing i want to say upfront and get out of the way now – almost all documentation i’ve found for Ruby (the language) is discussed in the context of using Rails. Whilst this might be true for 95% of Ruby users, it frustrates the poo-poo’s out of me. Rails is quite obviously a very advanced framework, and it really helps blur the distinction between what is “Ruby” and what is “Rails”. Particuarly to do with shortcuts provided by the rails framework I haven’t found elsewhere (for example, ruby script/generate rspec)
  • Installing Ruby is as difficult as downloading the installer for Windows and running it. That’s where my degree pays for itself.

  • Of course depending on how old the download package you’re using is, you’ll need to update your gems to the latest version with gem update –system

  • In the event you’re behind a company firewall, or you need to use an HTTP proxy for whatever reason, you need to tell the GEM command to use the http proxy as it doesn’t honour your default internet options. SET HTTP_PROXY=http://your.proxy.server:3128, substituting the server and port where appropriate.

  • When it comes time to play with IronRuby, you’ll need to install a few gems which didn’t seem to come with the pre-built version of the assembly.

    Firstly, make sure you put your IronRuby bin directory into the path. If you want to use RSpec (which you do), then you’ll need to igem install rspec and igem install hoe. if you do igem install cucumber you should get both for free.

    Secondly, it seems like recent changes to the IR project have broken the implementation of the expand_path method. Although there is claimed to be an available workaround, I have not had any luck thusfar with it. (Will try recompiling from source). A quick chat with @jschementi confirms there is something broken with the current build and will be fixed soon.

  • mspec works, though you might have some complications with getting mspec to use the right ruby interpreter. big props go out to @jredville for helping me sort that one out. If you run mspec by itself or try to invoke it directly through IR, you will invariably end up with an error like this:

    c:sourcerubycalcdotnet>imspec spec
    ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

    1) An exception occurred during: loading c:/source/ruby/calcdotnet/spec/calculator_spec.rb ERROR
    LoadError: 127: The specified procedure could not be found. – Init_calculator
    c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’

    Finished in 0.090000 seconds

    1 file, 0 examples, 0 expectations, 0 failures, 1 error

    The trick here is that mspec is designed to allow itself to swap one copy out for another. If you pass mspec the argument “-t c:ironrubybinir.exe” it will use IR instead of the ruby interpreter. eg: mspec -t c:ironrubybinir.exe spec/

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>