From: David Ainley on
I have a pretty basic .rb script that I would like to turn into an
executable. What is the best way to do this for Linux? I have no
intentions of cross compatibility, so I don't care if it won't work for
Windows or Mac.

I've tried rubyscript2exe. Doesn't work, but afaik, that's old so
whatevz.
I've tried to install crate via "gem install crate", but it gives me the
following error

Error installing crate:
ERROR: Failed to build gem native extension.


Can anyone give me a decent way to get a .rb to an executable for Linux?
(damn you ocra!)

Thanks guys.

wrinkliez
--
Posted via http://www.ruby-forum.com/.

From: Rick DeNatale on
On Tue, Jul 6, 2010 at 2:42 PM, David Ainley <wrinkliez(a)gmail.com> wrote:
> I have a pretty basic .rb script that I would like to turn into an
> executable.  What is the best way to do this for Linux?  I have no
> intentions of cross compatibility, so I don't care if it won't work for
> Windows or Mac.
>
> I've tried rubyscript2exe.  Doesn't work, but afaik, that's old so
> whatevz.
> I've tried to install crate via "gem install crate", but it gives me the
> following error
>
> Error installing crate:
>  ERROR: Failed to build gem native extension.
>
>
> Can anyone give me a decent way to get a .rb to an executable for Linux?
> (damn you ocra!)
>
> Thanks guys.

In Posix systems executable doesn't necessarily mean a file has to be binary.

Why not just put a shebang on the first line of the main file

#! /usr/bin/ruby

Check the actual path to put there by issuing the shell command which ruby

Then chmod the file to be executable.

You can optionally leave the .rb off the end of the file name, or symlink

e.g. if your main ruby file is

my_nifty_executable.rb

you could either rename it to just my_nifty_executable

or

ln -s my_nifty_executable.rb my_nifty_executable

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

From: David Ainley on
I see. Well I could use that as a last resort I suppose, but won't the
user have to download the entire Ruby language and gems and whatnot if I
go that route? Certainly no problem, but it just seems unnecessary.

I appreciate the response though :)
--
Posted via http://www.ruby-forum.com/.

From: Ben Bleything on
On Tue, Jul 6, 2010 at 4:26 PM, David Ainley <wrinkliez(a)gmail.com> wrote:
> I see.  Well I could use that as a last resort I suppose, but won't the
> user have to download the entire Ruby language and gems and whatnot if I
> go that route?  Certainly no problem, but it just seems unnecessary.

Yes, that's true. I think your best bet is going to be to figure out
why crate isn't working... does it give you any more output than you
pasted above?

Ben

From: Charles Oliver Nutter on
FWIW, you can create a single-file executable (a jar file, basically,
run with java -jar jarfile.jar) with JRuby that runs anywhere Java's
installed and doesn't require any per-machine build or any other
dependencies to be installed (including JRuby itself). Might be an
easier path, if you're willing to use JRuby.

On Tue, Jul 6, 2010 at 6:26 PM, David Ainley <wrinkliez(a)gmail.com> wrote:
> I see.  Well I could use that as a last resort I suppose, but won't the
> user have to download the entire Ruby language and gems and whatnot if I
> go that route?  Certainly no problem, but it just seems unnecessary.
>
> I appreciate the response though :)
> --
> Posted via http://www.ruby-forum.com/.
>
>