17
Is it possible to compile a ruby script into an .exe on Windows? I have searched everywhere and I've tried the following (It looked like RubyScript2EXE, Shoes and Crate all seemed dead or abandoned.):
I'm using Ruby 1.8.7 on Windows 7 Ultimate (64bit.) from a clean system I do this:
- Install RubyInstaller 1.8.7-p358 from rubyinstaller.org
- gem install watir
- gem install ocra
- git clone git://github.com/snaury/exerb-mingw.git
- cd exerb-mingw
- ruby setup.rb
I have a fairly simple script that does this:
require 'rubygems'
require 'watir'
browser = Watir::Browser.new
browser.goto 'http://slashdot.org'
When I run Ocra I don't get any error messages, and nothing happens:
ocra --output test.exe test.rb
=== Loading script to check dependencies
Exerb seems like a better solution since it compiles to rbc, and it does actually do something:
ruby -r exerb/mkexy test.rb
# Window pops up and after I close it it writes out test.exy
C:\Users\jonathan\dev\Citation>exerb test.exy
C:/Ruby187/lib/ruby/site_ruby/1.8/exerb/recipe.rb:146:in `add_file_entry': test.
exy: no such file -- C:/Ruby187/lib/ruby/gems/1.8/gems/win32-api-1.4.8-x86-mingw32/lib/win32/ruby18/win32/api.so (RuntimeError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/exerb/recipe.rb:86:in `create_archive'
from C:/Ruby187/lib/ruby/site_ruby/1.8/exerb/recipe.rb:85:in `each'
from C:/Ruby187/lib/ruby/site_ruby/1.8/exerb/recipe.rb:85:in `create_archive'
from C:/Ruby187/bin/exerb.bat:67:in `main'
from C:/Ruby187/bin/exerb.bat:196
So it can't find win32/api.so. When I look in C:/Ruby187/lib/ruby/site_ruby/1.