[Ironruby-core] require 'spec' not working

Jim Deville jdeville at microsoft.com
Thu Mar 26 17:55:57 EDT 2009


Gemrc gets used by both gem and igem, so that might still not work. Jimmy’s solution might be the best so far (leaving it with the separate directories).

JD

From: Shri Borde
Sent: Thursday, March 26, 2009 2:52 PM
To: Shri Borde; ironruby-core at rubyforge.org
Subject: RE: [Ironruby-core] require 'spec' not working

The solution seems to be using a gemrc file. http://blogs.sun.com/mandy/entry/rubygems_etc_gemrc describes the file, but says that it is only used by the gem command, and not honored by a “require ‘somgem’”. However, http://rubyforge.org/pipermail/rubygems-developers/2008-September/004056.html says that this was a bug and has been fixed.

From: Shri Borde
Sent: Thursday, March 26, 2009 2:06 PM
To: Shri Borde; 'ironruby-core at rubyforge.org'
Subject: RE: [Ironruby-core] require 'spec' not working

I realized that this would only work for the igem.bat command and not while running a program which does “require rubygems”. We can figure out some way to get ir.exe to pick this up as well, like adding code to %HOME%\.irconfig.rb. Tomas, do we still support .irconfig.rb? I couldn’t find anything while grepping the sources.

Thanks,
Shri

From: Shri Borde
Sent: Thursday, March 26, 2009 1:48 PM
To: ironruby-core at rubyforge.org
Subject: RE: [Ironruby-core] require 'spec' not working

Could you change your igem.bat to the following, and set IRONRUBY_GEM_PATH, and then see if it works as you like? This would allow having different GEM_PATHs for MRI and for IronRuby.

@echo off
setlocal
if defined IRONRUBY_GEM_PATH (
    set GEM_PATH=%IRONRUBY_GEM_PATH%
)
@"ir.exe" "%~dpn0" %*

Thanks,
Shri

From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ivan Porto Carrero
Sent: Thursday, March 26, 2009 1:42 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] require 'spec' not working

igem env gives you all the paths rubygems look in

I actually want a separate list of gems for IronRuby and my Ruby install hence I added a different subdir as my gem path for ironruby.
2009/3/26 Shri Borde <Shri.Borde at microsoft.com<mailto:Shri.Borde at microsoft.com>>

You should not be editing ir.exe.config as you would end up adding new paths for every new library you want to use, which would not be a good thing. Using GEM_PATH is the right solution as you would be using the power of rubygems to find the gems.



You should run “igem query --local --name-matches spec” to make sure that RubyGems will indeed be able to find the gem. I wish there was a verbose mode where gem could tell you the paths it looked in, but I don’t see anything at http://docs.rubygems.org/read/chapter/10#page35. Does anyone know of a verbose option?



Thanks,

Shri



From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Ivan Porto Carrero
Sent: Thursday, March 26, 2009 12:59 PM

To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: Re: [Ironruby-core] require 'spec' not working



Hi

Did you edit your ir.exe.config to point to the right gems dir?

I don't think you still need to set the GEM_PATH do you?

It works for me and all I do is edit the ir.exe.config to point to the right directories. I am on the git layout so my paths won't make sense for you.

When I did that I could do

>> igem list

*** LOCAL GEMS ***

>> igem install rspec
************************************************

    Thank you for installing rspec-1.2.2

    Please be sure to read History.rdoc and Upgrade.rdoc
    for useful information about this release.

*************************************************
Successfully installed rspec-1.2.2
1 gem installed
Installing ri documentation for rspec-1.2.2...
Installing RDoc documentation for rspec-1.2.2...
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc
Could not find main page README.rdoc

>> ir
IronRuby 0.3.0.0 on .NET 2.0.50727.3074

>>> require 'rubygems'
=> true
>>> require 'spec'
=> true
>>> true.should == true
=> true
>>> exit

On Thu, Mar 26, 2009 at 8:17 PM, Shri Borde <Shri.Borde at microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:

Does it work with MRI (not the IronRubyInteorp part ofcourse)? Where do you expect spec.rb to be loaded from? I don't have spec.rb on my machine.

Thanks,
Shri

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] On Behalf Of Michael Delaney
Sent: Thursday, March 26, 2009 8:57 AM
To: ironruby-core at rubyforge.org<mailto:ironruby-core at rubyforge.org>
Subject: [Ironruby-core] require 'spec' not working

hi,
i've downloaded the latest ironruby 0.3 and built it locally.
its in my path

GEM_PATH C:\ruby\lib\ruby\gems\1.8\gems
PATH c:\ruby\bin;C:\ironruby\Merlin\Main\bin\Debug

File: product_spec.rb

require 'rubygems'
require 'spec'
require File.dirname(__FILE__) +
'/IronRubyInterop/IronRubyInterop/bin/Debug/IronRubyInterop.dll'

describe IronRubyInterop::Product do

 it "should have a name" do end
 it "should have a category"
 it "should have product lines"

end

running ir product_spec.rb

i get:

D:\IronRuby\RSpec>ir product_spec.rb
:0:in `require': no such file to load -- spec (LoadError)
       from custom_require.rb:26:in `require'
       from product_spec.rb:0


Is there anything I'm missing???

Regards.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core



_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>
http://rubyforge.org/mailman/listinfo/ironruby-core

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090326/5440deb1/attachment-0001.html>


More information about the Ironruby-core mailing list