tags:

views:

532

answers:

3

Has anyone used Watir with IronRuby successfully? I am getting an error that the required file 'Watir' was not found. What path do I need to set to get this file to work in IronRuby?

For some reason my igem command is not working:

C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Scripts\bin>igem instal l watir '"C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Scripts\bin\ir.exe"' is not recognized as an internal or external command, operable program or batch file.

I am using 0.9 version of Ironruby.

I remember that in 0.9 you have to indicate the ir tool: I used the following and got the error again!

C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Scripts\bin>ir igem ins tall watir ERROR: While executing gem ... (RangeError) bignum too big to convert into Fixnum

The current version of RubyGems is 1.3.5:

C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Scripts\bin>ir igem -v 1.3.5

I even tried using the full path:

require File.dirname(__FILE__) + "C:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir.rb"
+3  A: 

Did you use gem install watir or igem install watir? If you are installing gems for IronRuby you have to use igem. Otherwise, it ends up being put inside the gems directory where your Ruby installation resides. IronRuby will not see that gems directory by default and you would have to use the full path to get to it. When using igem it puts the gem in the correct directory for use with IronRuby.

J.R. Garcia
Please Check out my comments above!
azamsharp
I also updated ruby gems with the following command: gem update --systemcan i revert back?
azamsharp
You may try reinstalling IronRuby again. The way that I have it installed is simply going to IronRuby.net and downloading it. Creating a folder named IronRuby and extracting ironruby-0.9.0.zip into that folder. If you do that you end up with a different folder structure than what you have listed. There may be something different with how it works.
J.R. Garcia
I do not know of a way to revert versions (other than the obvious uninstall/reinstall earlier version).
J.R. Garcia
Actually I just checked and the problem only comes when I try to install watir or rails. It works when installing rspec. So, I am thinking that the problem might be in watir and rails for IronRuby.
azamsharp
how can I use the full path to ruby watir files in ironruby?
azamsharp
I am trying to use the full path but it does not work: require File.dirname(__FILE__) + "C:/ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.2/lib/watir.rb"
azamsharp
Well with rubygems installed you can just access it using require 'watir'. I'm really not sure how you would do that by requiring the file. By doing that you have to require all dependencies. Doing that can get very rough because it may depend on quite a few other files.
J.R. Garcia
I reinstalled IronRuby again. How does the IronRuby set paths in win environment. Do I have to do this manually?
azamsharp
I got the path working correctly. I think I have to tell IronRuby to use Ruby watir path.
azamsharp
In regards to IronRuby paths, yes, you have to set those up manually in your environment variables. If you are going to use Ruby's Watir rather than IronRuby's, then yes you will have to tell it to use Ruby's path. Unfortunately (and also fortunately), IronRuby won't just peruse Ruby's gems.
J.R. Garcia
WatiR is not currently supported with IronRuby!
azamsharp
Well, that would explain why it's not working properly ;)
J.R. Garcia
A: 

Watir uses MRI Ruby's WIN32OLE library. Is this library supported with Iron Ruby?

Bret Pettichord
A: 

I found that when you get the required watir not found message in regular ruby you need to put before require 'watir' the text require 'rubygems'

Mike Cheel