ThinkCode
ThinkCode

Reputation: 7961

How to Instantiate/Run a Ruby program (uses Watir) using Linux?

Scenario :

I mapped a network drive on a Win XP machine and I double click a .bat file to execute this Ruby script. The .rb and .bat file reside on this networked drive.

The batch file is as follows :

Z: cd Z:\ABC\StatusCheck\ "C:\Program Files\Ruby\Bin\ruby.exe" Z:\ABC\StatusCheck\rubyScript.rb 6

The Ruby file is as follows :

require 'watir'
rec = File.open("list.txt", "r")
ie = Watir::IE.start()
***Other processing here***

My Question : How do I instantiate this batch file using Linux (when I am at home cos I cannot remote into to this machine. I want to run the .rb file from the terminal)?

Hope I made sense. I really appreciate your time guys! Thank you!

Upvotes: 1

Views: 1607

Answers (1)

Paul McMahon
Paul McMahon

Reputation: 1280

You don't need any batch file to run this on linux. All you need to do is run the script directly with

ruby rubyScript.rb

or add

#!/usr/bin/env ruby

to the top of rubyScript.rb and make it executable, then you can run directly.

However, your bigger problem is that you are using watir to automate IE, which obviously won't work on Linux, so you'll need to change it to use another browser.

Upvotes: 1

Related Questions