How do I make an autonomous program?

T

Todd Jacobus

First, I would like to ask you all to excuse a Ruby-newbie question.
I'm very new to Ruby and, in fact, very new to programing at all. But
anyway...

I've finally finished this program which reads latitude and longitude
data, and various other attributes, from a file and formats it
automatically so that it can be imported into some GIS software. It's
an awesome program, but how do I make it autonomous, so that it doesn't
have to rely on the interpreter? Or rather, how can I get the program
and the Ruby interpreter to work together away from the path in which I
installed it?

I'd really appreciate the advice. I've exhausted all on-line tutorials
I can find, and I'd rather not ask my supervisor to download Ruby so he
can use the program.... Thanks!

Todd
 
A

Adam Akhtar

im a newb too so forgive me if my answer isnt what your looking for.

Do you mean youd like to be able to juts call the script anywhere you
want i.e. outside of the scripts path..

i think its something to do with

load path

google that or do a search on here for that

As a side note the best book ive read so far for ruby newbys is
"Everyday scripting with Ruby" - it has a chapter on this as well. I
havent quite finished the book yet and its one of the later chapters but
give it a look. Its not a reference and has exercises for you to
practice what youve learned. You also find yourself going away
experimenting with code as you read his examples as well.
Its a bit more (only a bit though) advanced than learning to program by
c.pine though. Also its all about scripting and writing scripts that are
"useful" e.g. webscraping amazon etc.

I think those two books should be read by every beginner
 
T

Todd Jacobus

Well that sounds like what I'm looking for. All I want to do is to be
able to transfer the script onto another computer (which doesn't have
Ruby installed) and run the script. From what I've seen by playing with
it on my computer, it doesn't seem to be as simple as just copying the
".rb" file. But thanks a lot for the comment, I'll have to check out
that book you mentioned.
 
M

Martin DeMello

Well that sounds like what I'm looking for. All I want to do is to be
able to transfer the script onto another computer (which doesn't have
Ruby installed) and run the script. From what I've seen by playing with
it on my computer, it doesn't seem to be as simple as just copying the
".rb" file. But thanks a lot for the comment, I'll have to check out
that book you mentioned.

http://www.erikveen.dds.nl/rubyscript2exe/

Bundles the ruby interpreter and your script together into a
self-contained executable

martin
 
D

Daniel N

[Note: parts of this message were removed to make it a legal post.]

http://www.erikveen.dds.nl/rubyscript2exe/

Bundles the ruby interpreter and your script together into a
self-contained executable

martin


If it's just for a script on a *nix / mac machine then you can put this in
on the first line of the file.

#!/usr/bin/env ruby

then chmod it so that it's executable and put it into a directory that's
picked up in the PATH env variable. Then it'll be avaialble just like any
other command on your system.

Is this what you meant?

HTH
Daniel
 
D

Daniel N

[Note: parts of this message were removed to make it a legal post.]

this still needs the ruby interpreter.
Yes it does. But if your just after an executable that you can run on the
system without having to type ruby path/to/executable then this solution is
usually all that's needed

Cheers
 
S

Sebastian Hungerecker

Daniel said:
Yes it does. But if your just after an executable that you can run on the
system without having to type ruby path/to/executable then this solution is
usually all that's needed

Quoth the OP:
"All I want to do is to be able to transfer the script onto another
computer (which doesn't have Ruby installed) and run the script."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
D

Dave Bass

Sebastian said:
Quoth the OP:
"All I want to do is to be able to transfer the script onto another
computer (which doesn't have Ruby installed) and run the script."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Or maybe it does have Ruby installed, but an incompatible version
(1.8/1.9?). In the worst case the script may run without errors but do
something subtly different from what's intended.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top