Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,527 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,968 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Runnign a ruby script

 
Reply to this topicStart new topic

Runnign a ruby script, Ruby, Script, Where to save

NeoGreen
post 14 Apr, 2007 - 11:13 AM
Post #1


D.I.C Head

**
Joined: 28 Apr, 2006
Posts: 222


My Contributions


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. smile.gif
User is offlineProfile CardPM

Go to the top of the page


Amadeus
post 14 Apr, 2007 - 12:12 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 11,894



Thanked 24 times

Dream Kudos: 25
My Contributions


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?
User is offlineProfile CardPM

Go to the top of the page

NeoGreen
post 14 Apr, 2007 - 01:14 PM
Post #3


D.I.C Head

**
Joined: 28 Apr, 2006
Posts: 222


My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 14 Apr, 2007 - 01:22 PM
Post #4


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 11,894



Thanked 24 times

Dream Kudos: 25
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

NeoGreen
post 19 Apr, 2007 - 06:27 AM
Post #5


D.I.C Head

**
Joined: 28 Apr, 2006
Posts: 222


My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

rahulbatra
post 6 May, 2007 - 09:59 AM
Post #6


D.I.C Head

Group Icon
Joined: 28 Dec, 2005
Posts: 156



Dream Kudos: 275
My Contributions


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

CODE
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.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 03:41PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month