I just create a simple WxRuby app and then try to turn it into .exe file
using Ocra. The code is something like…
require ‘wx’
class SimpleApp < Wx:App
def on_init
Wx::Frame.new(nil, -1, “Simple App”).show()
end
end
SimpleApp.new.main_loop
However, the exe file from Ocra is quite big, about 5.45 Mb. I think it
is because Wx requires many dependencies so that make this result.
BTW, Is there any way to reduce file size of this exe ?
I don’t think so, since the ‘require ‘wx’’ line loads all of WxRuby. I
think you’ll find that if you write a very elaborate ruby code, along
the lines of 300KB in size, the .exe will not change much.
But if I’m proved otherwise, by all means ignore me.
when I do >ocra very_simple_app.rb, then ocra compile and the trace
looks something like…
…
…
a
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/icon4.xpm
a
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/icon5.xpm
a
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/treectrl/treectrl.r
b
m lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc
a
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc/samples.xrc
a
lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mswin32-60/samples/xrc/xrc_sample.rb
e RUBYOPT -rubygems
e RUBYLIB
e GEM_PATH \gemhome
p \bin\ruby.exe ruby.exe “\src\very_simple_app.rb”
=== Compressing
=== Finished building very_simple_app.exe (5720630 bytes)
I think I don’t need to load such dependencies like /samples, etc…
I look into ocra document again and found that ocra will load all
dependencies describe in manifest file of the required gem(or source
file). So that I should be able to reduce size by modify the manifest of
my wxruby.
But the problem is, I cannot find the manifest file in the
/lib/ruby/gem/1.8/gems/wxruby-2.0.1-x86-mswin32-60/, cann’t find it from
the root of ruby path as well
I believe the exe will be much more than 300 KB in size,
since exe files include all library
it need, and Wx is not a very small one.
about 5 mb is normal
I have used ruby script2exe before and the result is way bigger than 5
mb
so yours is fine, really
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.