RubyScript2Exe

Hi,

I am a complete novice to ruby, so please feel free to ask for more
information so this post makes more sense.

I am trying to create an exe from the ruby script, and it all seems to
go well but the resulting exe doesn’t do what it’s supposed to. Well it
doesn’t do anything at all in fact!

I am creating the exe from the ruby script at:

http://po-ru.com/files/iplayer-dl-latest.tar.gz

I’ve created 2 folders:

  1. C:\Test:\rubyscript2exe

  2. C:\Test\iplayer-dl-0.1.15

  3. Contains all the rubyscript2exe files and the ev directory.

  4. Contains the files and folders from the above link.

I then run the following line in my command prompt (Win XP)

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

It starts to looks good with the following output:
Tracing iplayer …
Gathering files …
Copying files …
Creating iplayer.exe

However if I try to execute iplayer.exe nothing happens in the console.
I just get the console prompt after a short pause.
I am expecting to receive a whole load of relevant help information
about iplayer.exe

I’ve managed to get this to work before but for some reason I can’t get
the exe working anymore. Is there something dumb that I’m doing?

Charlie

Hello Charlie,

However if I try to execute iplayer.exe nothing happens in the console.
I just get the console prompt after a short pause.

Maybe, the console prompt shows the right messages for, say, some
milli-seconds and then imediately disappears?
To avoid this, you can do:

Invoke a persisten Console Window (in German Windows it is: Start >
Ausfuehren > type “cmd” )
In the console window run your iplayer.exe; maybe you have to use the
full path.

Axel

Axel,

Thanks for you post but I am already using the Command Prompt (Start >
Run > cmd)
:frowning:

Charlie

unknown wrote:

Hello Charlie,

However if I try to execute iplayer.exe nothing happens in the console.
I just get the console prompt after a short pause.

Maybe, the console prompt shows the right messages for, say, some
milli-seconds and then imediately disappears?
To avoid this, you can do:

Invoke a persisten Console Window (in German Windows it is: Start >
Ausfuehren > type “cmd” )
In the console window run your iplayer.exe; maybe you have to use the
full path.

Axel

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

Hi,

I am a complete novice to ruby, so please feel free to ask for more
information so this post makes more sense.

I am trying to create an exe from the ruby script, and it all seems to
go well but the resulting exe doesn’t do what it’s supposed to. Well it
doesn’t do anything at all in fact!

I had a quick look at rubyscript2exe yesterday. It’s not currently
maintained and is not compatible with current versions of Ruby (throws
exceptions with 1.8.6p287). I would not recommend it for use in its
current state.

Lars C. wrote:

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

Hi,

I am a complete novice to ruby, so please feel free to ask for more
information so this post makes more sense.

I am trying to create an exe from the ruby script, and it all seems to
go well but the resulting exe doesn’t do what it’s supposed to. �Well it
doesn’t do anything at all in fact!

I had a quick look at rubyscript2exe yesterday. It’s not currently
maintained and is not compatible with current versions of Ruby (throws
exceptions with 1.8.6p287). I would not recommend it for use in its
current state.

Nah, rubyscript2exe.rb works like a charm. I assume you are talking
about the frozen string exception which is a trivial fix (below).

I understand your concern that it has not been updated for a while, but
on the other hand it doesn’t need any updating apart from this one-liner
fix. It is not uncommon for someone to write a sweet tool and then fall
off the Earth for a time. You can help by writing the author
[rubyscript2exe at erikveen dot dds dot nl], or if you live in
Netherlands knock on his door and say, “Yo, change that line!” in Dutch.

— rubyscript2exe.rb.orig 2009-04-03 10:28:41.140806000 -0400
+++ rubyscript2exe.rb 2009-04-03 10:29:40.108423800 -0400
@@ -618,7 +618,7 @@

newlocation do
if FILE == $0

  •  $0.replace(File.expand_path("./init.rb"))
    
  •  $0 = File.expand_path("./init.rb")
    
     TAR2RUBYSCRIPT   = true  unless defined?(TAR2RUBYSCRIPT)
    

Lars,

Thanks for taking the time to help me.

As I mentioned in my original post I’ve managed to get this to work
before but for some reason I can’t get the exe working anymore.

It says it’s supported up to version 1.8, and I’ve got 1.8.26, so would
it be best to just install version 1.8 of Ruby?

Charlie

Lars C. wrote:

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

Hi,

I am a complete novice to ruby, so please feel free to ask for more
information so this post makes more sense.

I am trying to create an exe from the ruby script, and it all seems to
go well but the resulting exe doesn’t do what it’s supposed to. �Well it
doesn’t do anything at all in fact!

I had a quick look at rubyscript2exe yesterday. It’s not currently
maintained and is not compatible with current versions of Ruby (throws
exceptions with 1.8.6p287). I would not recommend it for use in its
current state.

I’ve been using rubyscript2exe with 1.8.7 without any problems.

I’ve tested it in Vista + XP … It uses an “eee” wrapper for the
executable
… You’ll find that when you run an exe compiled by rubyscript2exe, it
extracts all of the files into:

\Documents and Settings<username>\eee\

There is an option to just extract the files from Rubyscript2exe and not
run
the .RB, I would extract the files, and make sure your application runs
via
“ruby scriptname.rb” in the directory that it extracts to.

The argument to pass to your compiled exe is --eee-just-extract.

On Fri, Apr 3, 2009 at 9:21 AM, Charlie Openshaw <

Brian,

That’s really interesting Brian because I’m not getting anything in

C:\Documents and Settings<username>\eee\

When I run the exe I actually get a file created, but it then
disappears!

Brian W. wrote:

There is an option to just extract the files from Rubyscript2exe and not
run
the .RB, I would extract the files, and make sure your application runs
via
“ruby scriptname.rb” in the directory that it extracts to.

The argument to pass to your compiled exe is --eee-just-extract.

I’m really sorry I’m not sure what you mean. Is this an option for
creating the exe or running the exe?

Charlie

Higgs Bozo,

Thanks for your post, it’s good to know that there’s an update.

I applied the change you suggested but with no luck, I get the same
behaviour (it says it’s created the new exe, but the exe doesn’t do
anything when it runs).

Charlie

On Fri, Apr 3, 2009 at 4:47 PM, The Higgs bozo [email protected]
wrote:

Lars C. wrote:

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

Nah, rubyscript2exe.rb works like a charm. I assume you are talking
about the frozen string exception which is a trivial fix (below).

Sorry, it does work with your fix, but still not via the gem. I need
to invoke realstuff.rb directly.

The $0 mangling is not working with paths on my setup:

This script:

a =
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”
$0 = a
p a
p $0

Gives me:

“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5”

ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

Lars,

Thanks for you post, can I just check a couple of things?

  1. You managed to get the iplayer-dl-0.1.15.rb compiled as an exe with
    rubyscript2exe?
  2. Where can i find thie realstuff.rb file that I need to edit, I don’t
    seem to have it.

Thanks

Charlie

Lars C. wrote:

On Fri, Apr 3, 2009 at 4:47 PM, The Higgs bozo [email protected]
wrote:

Lars C. wrote:

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

Nah, rubyscript2exe.rb works like a charm. �I assume you are talking
about the frozen string exception which is a trivial fix (below).

Sorry, it does work with your fix, but still not via the gem. I need
to invoke realstuff.rb directly.

The $0 mangling is not working with paths on my setup:

This script:

a =
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”
$0 = a
p a
p $0

Gives me:

“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/realstuff.rb”
“C:/lang/Ruby-186-27/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5”

ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

On Apr 3, 2009, at 9:47 AM, The Higgs bozo wrote:

I understand your concern that it has not been updated for a while,
but
on the other hand it doesn’t need any updating apart from this one-
liner
fix. It is not uncommon for someone to write a sweet tool and then
fall
off the Earth for a time. You can help by writing the author
[rubyscript2exe at erikveen dot dds dot nl], or if you live in
Netherlands knock on his door and say, “Yo, change that line!” in
Dutch.

Something like “Verander dat lijn.” ought to do it.

Cheers–

Charles

Charles J.
Advanced Computing Center for Research and Education
Vanderbilt University

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

However if I try to execute iplayer.exe nothing happens in the console.

You are trying to build a .exe from a Ruby library. Nothing is
supposed to happen when you just load the library. “bin/iplayer-dl”
does the actual work.

Lars,

Apologies if I’m being dumb, but I’m really new to ruby

Just to confirm, are you saying that instead of:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

I should have:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”
“C:\Test\iplayer-dl-0.1.15\bin\iplayer-dl”

I tried that but got :
Gathering Files…
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
‘gem_original_require’: no such file to load – iplayer (LoadError)
from
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
‘require’
from C:/Test/iplayer-dl-0.1.15/bin/iplayer-dl:9
Copying files…
Creating iplyaer-dl.exe …

Thanks

Charlie

Lars C. wrote:

On Thu, Apr 2, 2009 at 4:49 PM, Charlie Openshaw
[email protected] wrote:

ruby “C:\Test\rubyscript2exe\rubyscript2exe.rb”
“C:\Test\iplayer-dl-0.1.15\lib\iplayer.rb”

However if I try to execute iplayer.exe nothing happens in the console.

You are trying to build a .exe from a Ruby library. Nothing is
supposed to happen when you just load the library. “bin/iplayer-dl”
does the actual work.