How do I make an autonomous program?

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

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

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.

On Fri, Aug 22, 2008 at 10:21 PM, Todd J. [email protected]
wrote:

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

Awesome, that worked out great thanks!

On Sat, Aug 23, 2008 at 3:26 PM, Martin DeMello
[email protected]wrote:

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

On Sat, Aug 23, 2008 at 5:31 PM, matu [email protected] wrote:

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

Daniel N wrote:

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.”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sebastian H. wrote:

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.

Daniel N wrote:

#!/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.

this still needs the ruby interpreter.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs