I would like to use traditional Ruby libraries (1.8.6) with Ironruby. I'm having problems. For instance, "require 'thread'" doesn't seem to work in an Ironruby script. Do I need to put the ruby libraries in the Ironruby lib folder?

有帮助吗?

解决方案

IronRuby use igem, you can use igem ENV to inspect where are the gems, and install the missing one using igem install.

    C:\devkit\home\demo>igem ENV
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mswin32]
  - INSTALLATION DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.
9.1
  - RUBY EXECUTABLE: "C:/Program Files (x86)/IronRuby 1.1/bin/ir.exe"
  - EXECUTABLE DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-dotnet-4.0
  - GEM PATHS:
     - C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.9.1
     - C:/Users/Ronda/.gem/ironruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

C:\devkit\home\demo>ir
IronRuby 1.1.3.0 on .NET 4.0.30319.239
Copyright (c) Microsoft Corporation. All rights reserved.

>>> require 'thread'
=> true
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top