How do I make an autonomous program?

Discussion in 'Ruby' started by Todd Jacobus, Aug 23, 2008.

  1. Todd Jacobus

    Todd Jacobus Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
    Todd Jacobus, Aug 23, 2008
    #1
    1. Advertising

  2. Todd Jacobus

    Adam Akhtar Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
    Adam Akhtar, Aug 23, 2008
    #2
    1. Advertising

  3. Todd Jacobus

    Todd Jacobus Guest

    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.

    --
    Posted via http://www.ruby-forum.com/.
    Todd Jacobus, Aug 23, 2008
    #3
  4. On Fri, Aug 22, 2008 at 10:21 PM, Todd Jacobus <> 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
    Martin DeMello, Aug 23, 2008
    #4
  5. Todd Jacobus

    Daniel N Guest

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

    On Sat, Aug 23, 2008 at 3:26 PM, Martin DeMello <>wrote:

    > On Fri, Aug 22, 2008 at 10:21 PM, Todd Jacobus <>
    > 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



    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
    Daniel N, Aug 23, 2008
    #5
  6. Todd Jacobus

    Todd Jacobus Guest

    Todd Jacobus, Aug 23, 2008
    #6
  7. Todd Jacobus

    Daniel N Guest

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

    On Sat, Aug 23, 2008 at 5:31 PM, matu <> wrote:

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

    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, Aug 23, 2008
    #7
  8. 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."
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    --
    NP: Disbelief - For God
    Jabber:
    ICQ: 205544826
    Sebastian Hungerecker, Aug 23, 2008
    #8
  9. Todd Jacobus

    Dave Bass Guest

    Sebastian Hungerecker 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.
    --
    Posted via http://www.ruby-forum.com/.
    Dave Bass, Aug 24, 2008
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abby
    Replies:
    1
    Views:
    494
    Jack Klein
    Aug 29, 2003
  2. Aaron Leung
    Replies:
    0
    Views:
    285
    Aaron Leung
    Dec 8, 2004
  3. Mark Asbach
    Replies:
    1
    Views:
    467
    Leo Kislov
    Nov 3, 2006
  4. Replies:
    4
    Views:
    344
    Juha Nieminen
    Nov 24, 2007
  5. alb

    autonomous monitors

    alb, Sep 7, 2013, in forum: VHDL
    Replies:
    2
    Views:
    273
Loading...

Share This Page