|
|
IronRuby > Documentation > Real Ruby Applications and Libraries > RubyGems
RubyGemsFrom $1Table of contents
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. UsageThere are two ways to use gems:
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, the names of the batch files can conflict with the batch files used by MRI. The IronRuby releases include a few such batch files with "i" prepended to the name (eg. igem.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 gemsNative 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]. IronRuby-specific gemsGems could specifically target IronRuby. They may contain Ruby code which uses .NET APIs, or they may even include compiled .NET assemblies. In such cases, the Gem specification should set platform to "universal-dotnet" (or "universal-dotnet4.0" to run only on .NET 4), and build the gem using IronRuby ("ir.exe -S igem build"). Note that if you build the gem with MRI using "gem build", MRI will not be able to recognize the platform string, and will create a gem file named something like foo-universal-unknown.gem (instead of the expected foo-universal-dotnet.gem"). To avoid this, build the gem using IronRuby as mentioned above. [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]
Tags:
|