RubyGems

From $1

Table of contents
    1. 1.1. Usage
      1. 1.1.1. Native gems
      2. 1.1.2. CLR gems
  1. 2. Known issues

RubyGems 1.2 (will be updated to 1.3.1) is included with IronRuby. The "bin" folder also includes igem.bat which can be used to manage gems with IronRuby, similar to the gem.bat used by MRI.

Usage

There are two ways to use gems:

  • Do not share gems with MRI - By default, RubyGems looks in different locations for each Ruby implementation. For IronRuby, it would look in c:\ironruby\lib\ironruby\gems\1.8 assuming ir.exe exists in c:\ironruby\bin. In this case, you will need to install all gems you want to use with IronRuby using igem.bat (c:\ironruby\bin\igem.bat), even if the gem was previously installed for MRI using gem.bat
  • Share gems with MRI - Set the GEM_PATH environment variable in your user profile to point to your <mri>\lib\ruby\gems\1.8 directory, e.g. c:\ruby\lib\ruby\gems\1.8. This allows sharing of gems with MRI. IronRuby also includes igem.bat which runs gems with IronRuby. This can be used to install IronRuby-specific gems.
    • Note that the GEM_HOME environment variables controls where new gems will be installed by running igem.bat. Unless you set this to match GEM_PATH, note that gems installed by "igem.bat" may not be usable from IronRuby [need to check if this is true or not]. And if you set GEM_PATH to include the location of IronRuby gems, MRI will be able to find them as well.

Many gems create wrapper batch files for convinience. For example, the Rails gem adds rails.bat to the bin folder, and the Cucumber gem adds cucumber.bat to the bin folder. However, these batch fails run the gem with MRI. Therefore, you will need to manually create IronRuby versions of these batch files. The IronRuby releases include a few such batch files (eg. irails.bat), but it cannot include them all. Also, note that you can use the GEM_BIN folder to control where "gem install" will install such batch files in case you do not like the default location of the "bin" folder.

Native gems

Native gems are gems with Ruby native extensions containing native code. The platform  attribute will be Gem::Platform::Win32, and gem filename will be something like foo-1.2.3-win32.gem. Native extensions are not supported by IronRuby. Currently, there is no known way of avoiding native gems. When you install gems, you will have to manually exclude gems with win32 in the name. If a native gem is installed by MRI and you are sharing gems with MRI, requiring the gem can fail even if you have a version with platform=ruby installed [Need to check exactly what happens in this case, and which platform gets precedence].

CLR gems

Gems with CLR assemblies should be marked with platform = "ironruby". [Need to check if this works seamlessly, if the assembly loads fine, if the gem can consist of multiple assemblies or if there will be LoadFrom problems, etc]

Known issues

  • Native extensions are not supported.
  • Signed gems cannot be used since IronRuby does not support OpenSSL yet.
  • Unit test result is "755 tests, 2422 assertions, 8 failures, 14 errors, 4 skips". See full log here.
Tags:
 
Images (0)
 
Comments (0)
You must login to post a comment.

 
SourceForge.net