How do I create an RBA Ruby Archive File?

J

Jayson Williams

I am using rubyscript2exe to wrap an application. The problem is that
the files that are external to the ruby script are not getting wrapped
into the exe file. I think I need to create a RBA file first and then
wrap it using rubyscript2exe. Any suggestions?

Thanks
 
J

Joel VanderWerf

Jayson said:
I am using rubyscript2exe to wrap an application. The problem is that
the files that are external to the ruby script are not getting wrapped
into the exe file. I think I need to create a RBA file first and then
wrap it using rubyscript2exe. Any suggestions?

Are you certain that your program, when you run it with rubyscript2exe,
requires every library that it will eventually need?
 
J

Jayson Williams

Actual my problem is a bit more simple. I replaced the default Tk icon
with one I created. But when I wrap the application into an exe, the
exe version is dependent on the external icon file. If I remove the
icon file, my exe application will no longer run. I want to be able to
wrap the icon file along with the rest of the application.
 
J

Joel VanderWerf

Jayson said:
Actual my problem is a bit more simple. I replaced the default Tk icon
with one I created. But when I wrap the application into an exe, the
exe version is dependent on the external icon file. If I remove the
icon file, my exe application will no longer run. I want to be able to
wrap the icon file along with the rest of the application.

Sorry, I assumed you were talking about .rb files.

IIRC, you can use tar2rubyscript (from the same source as
rubyscript2exe) to wrap up non-ruby files.
 
J

Jayson Williams

Hi David,
When i use this method
RUBYSCRIPT2EXE.bin = ["my_logo.ico"]

What do I use as a reference to the Icon.
root = TkRoot.new
root.iconbitmap= ?
...on a whim I tried
root.iconbitmap = RUBYSCRIPT2EXE.bin.last
which runs as a ruby script but not after I wrap it as an exe

Jayson

Very nice...
Thanks

Jayson said:
I want to be able to wrap the icon file
along with the rest of the application.

I use the following method...

RUBYSCRIPT2EXE.bin = ["my_logo.ico"]

...as outlined here...

http://www.erikveen.dds.nl/rubyscript2exe/index.html#3.3.1

David

http://rubyonwindows.blogspot.com
 
J

Jano Svitok

Hi David,
When i use this method
RUBYSCRIPT2EXE.bin = ["my_logo.ico"]

What do I use as a reference to the Icon.
root = TkRoot.new
root.iconbitmap= ?
...on a whim I tried
root.iconbitmap = RUBYSCRIPT2EXE.bin.last
which runs as a ruby script but not after I wrap it as an exe

Jayson

Either use relative paths to your source file (i.e. to __FILE__) or
try stuff mentioned under g) in the erik's page.

Jano
 
J

Jayson Williams

I think I have figured out what the problem has been.

RUBYSCRIPT2EXE.bin=['my_icon.ico'] results in the file being placed in
the .../bin directory at execution time (makes sense).

The documentation says that RUBYSCRIPT2EXE.appdir points to the
.../bin directory.

require "rubyscript2exe"
RUBYSCRIPT2EXE.appdir ===> C:/bin
RUBYSCRIPT2EXE.appdir("README") ===> C:/bin/README
RUBYSCRIPT2EXE.appdir{Dir.pwd} ===> C:/bin

But as you might assume from the method name, RUBYSCRIPT2EXE.appdir
infact points to the .../app directory.

There is no method that I can see that references the bin directory,
but this is where all the bins and dlls go. Secondly, there is no
mehod for placing a file in the .../app folder, but this is the folder
that RUBYSCRIPT2EXE.appdir points to. The only solution I can come up
with is chopping off the app portion and adding bin

binDir = RUBYSCRIPT2EXE.appdir
3.times{binDir.chop!}
binDir += 'bin'

Am I overthinking this. Seems like there must be a better way
Jayson

Hi David,
When i use this method
RUBYSCRIPT2EXE.bin = ["my_logo.ico"]

What do I use as a reference to the Icon.
root = TkRoot.new
root.iconbitmap= ?
...on a whim I tried
root.iconbitmap = RUBYSCRIPT2EXE.bin.last
which runs as a ruby script but not after I wrap it as an exe

Jayson

Either use relative paths to your source file (i.e. to __FILE__) or
try stuff mentioned under g) in the erik's page.

Jano
 
D

David Mullet

I work with wxRuby, not TK. In wxRuby, I set the icon with:

set_icon(Icon.new('my_icon.ico'))

No path, just the filename.

Then I include the line:

RUBYSCRIPT2EXE.bin=['my_icon.ico']

That always works for me.

David
 
J

Jayson Williams

Thats interesting. In Tk, I have to tell the main window where the
my_icon.ico will be at execution time. I would like to know if this is
the norm, or am I taking the long route? You mentioned earlier that
in rubyscript2exe, that wxruby was getting copied twice into the exe,
causing the larger exe file. Do you know of any workarounds?
 
A

Alex Fenton

Jayson said:
Thats interesting. In Tk, I have to tell the main window where the
my_icon.ico will be at execution time. I would like to know if this is
the norm, or am I taking the long route? You mentioned earlier that
in rubyscript2exe, that wxruby was getting copied twice into the exe,
causing the larger exe file. Do you know of any workarounds?

After you've created the initial (oversize) executable:

1) Extract the application with 'application.exe --eee-justextract'

2) You should now have a file called "app.eee" which is a manifest of
all things that should be bundled into the .exe. Open this file and
delete the line "bin/wxruby.so" (or possibly wxruby.bundle, on OS X)
3) Repack the executable with 'eee.exe app.eee newapplication.exe'
4) Test that newapplication.exe runs

See here for more info:
http://www.erikveenstra.nl/rubyscript2exe/index.html#3.4.3

This works for me reducing a "nothing" app from about 9.7 to 4.7MB.
Still on the big side for simple apps, but not unreasonable for more
complex ones.

alex
 

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,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top