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

Join 136,137 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,855 people online right now. 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
14 Apr, 2007 - 10:13 AM
Post #1

D.I.C Head
**

Joined: 28 Apr, 2006
Posts: 226


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
+Quote Post

Amadeus
RE: Runnign A Ruby Script
14 Apr, 2007 - 11:12 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 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
+Quote Post

NeoGreen
RE: Runnign A Ruby Script
14 Apr, 2007 - 12:14 PM
Post #3

D.I.C Head
**

Joined: 28 Apr, 2006
Posts: 226


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
+Quote Post

Amadeus
RE: Runnign A Ruby Script
14 Apr, 2007 - 12:22 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 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
+Quote Post

NeoGreen
RE: Runnign A Ruby Script
19 Apr, 2007 - 05:27 AM
Post #5

D.I.C Head
**

Joined: 28 Apr, 2006
Posts: 226


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
+Quote Post

rahulbatra
RE: Runnign A Ruby Script
6 May, 2007 - 08:59 AM
Post #6

D.I.C Head
Group Icon

Joined: 28 Dec, 2005
Posts: 161


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
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 10:36PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month