4

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"
azamsharp
  • 19,710
  • 36
  • 144
  • 222

3 Answers3

3

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
  • 639
  • 5
  • 20
  • Please Check out my comments above! – azamsharp Sep 21 '09 at 03:57
  • I also updated ruby gems with the following command: gem update --system can i revert back? – azamsharp Sep 21 '09 at 04:14
  • 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 Sep 21 '09 at 04:15
  • I do not know of a way to revert versions (other than the obvious uninstall/reinstall earlier version). – J.R. Garcia Sep 21 '09 at 04:19
  • 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 Sep 21 '09 at 04:20
  • how can I use the full path to ruby watir files in ironruby? – azamsharp Sep 21 '09 at 04:20
  • 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 Sep 21 '09 at 04:31
  • 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 Sep 21 '09 at 05:01
  • I reinstalled IronRuby again. How does the IronRuby set paths in win environment. Do I have to do this manually? – azamsharp Sep 21 '09 at 14:08
  • I got the path working correctly. I think I have to tell IronRuby to use Ruby watir path. – azamsharp Sep 21 '09 at 14:37
  • 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 Sep 21 '09 at 17:53
  • WatiR is not currently supported with IronRuby! – azamsharp Sep 28 '09 at 22:29
1

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

Bret Pettichord
  • 455
  • 2
  • 8
1

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
  • 12,626
  • 10
  • 72
  • 101