Runnign a ruby script

Ruby, Script, Where to save

Page 1 of 1

5 Replies - 4364 Views - Last Post: 06 May 2007 - 09:59 AM Rate Topic: -----

#1 NeoGreen  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 243
  • Joined: 28-April 06

Runnign a ruby script

Posted 14 April 2007 - 11:13 AM

Okay, I just started playing around with ruby. I installed ruby186-25 and I tried to install the Mondrain IDE but it didn't work the installer did but there was something wrong with the IDE. Anyway I was working through this tutorial online and it asked me to create a script using your favorite text editor. I use notepad since well I am using a windows machine right now. Anyway to get to the point: I created a simple Hello World ruby script and I can't get it to run. The tutorial states, to run it by typing ruby hello.rb, I am guessing in the command line. I do it but it doesn't work. Is there somewhere specific where I have to save this ruby script? I have it saved on my desktop right now. Any advice will be helpful. :)

Is This A Good Question/Topic? 0
  • +

Replies To: Runnign a ruby script

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Runnign a ruby script

Posted 14 April 2007 - 12:12 PM

Unless you are specifying the full path, you'll have to save it in the same directory as the ruby interpreter.

What is the error you are given when you try to run it?
Was This Post Helpful? 0
  • +
  • -

#3 NeoGreen  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 243
  • Joined: 28-April 06

Re: Runnign a ruby script

Posted 14 April 2007 - 01:14 PM

I get the following error:

ruby: No such file or directory -- hello.rb (Load Error)

I will try to move the file to the directory where Ruby is installled and see what happens.

Where would the Ruby Interpreter be located? I went into C drive and saw a folder named Ruby, but that didn't work.
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Runnign a ruby script

Posted 14 April 2007 - 01:22 PM

Where did you install it to? The file you are looking for is called ruby.exe. You have to either specify the path to the ruby interpreter or navigate your command prompt to that folder to run it.
Was This Post Helpful? 0
  • +
  • -

#5 NeoGreen  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 243
  • Joined: 28-April 06

Re: Runnign a ruby script

Posted 19 April 2007 - 06:27 AM

Sorry for the late reply, had to work overtime the past 5 days. Okay, I did a search for it and it states that it is in C:Ruby/bin. How do I give it a path to reach the script i wrote on the desktop. Would it be easier to move the sript to the ruby bin folder? Thanks for your help, I really appreciate it.
Was This Post Helpful? 0
  • +
  • -

#6 rahulbatra  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 16
  • View blog
  • Posts: 183
  • Joined: 28-December 05

Re: Runnign a ruby script

Posted 06 May 2007 - 09:59 AM

Well on Windows mostly, if you've used the one-click installer, you have the path set for you. Else you can navigate to the bin directory, and write

ruby <full path of the file here>


That is if you don't want to change the PATH variable. Which you should actually since it becomes annoying after a while otherwise.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1