title: Compile ruby script into exe?
body: <p>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.):</p>
  
  <ol>
  <li><a href="http://ocra.rubyforge.org/" rel="noreferrer">http://ocra.rubyforge.org/</a> </li>
  <li><a href="http://exerb.sourceforge.jp/index.en.html" rel="noreferrer">http://exerb.sourceforge.jp/index.en.html</a></li>
  </ol>
  
  <p>I'm using Ruby 1.8.7 on Windows 7 Ultimate (64bit.) from a clean system I do this:</p>
  
  <ol>
  <li>Install RubyInstaller 1.8.7-p358 from rubyinstaller.org</li>
  <li>gem install watir</li>
  <li>gem install ocra</li>
  <li>git clone git://github.com/snaury/exerb-mingw.git</li>
  <li>cd exerb-mingw</li>
  <li>ruby setup.rb</li>
  </ol>
  
  <p>I have a fairly simple script that does this:</p>
  
  <pre><code>require 'rubygems'
  require 'watir'
  browser = Watir::Browser.new
  browser.goto 'http://slashdot.org'
  </code></pre>
  
  <p>When I run Ocra I don't get any error messages, and nothing happens:</p>
  
  <pre><code>ocra --output test.exe test.rb
  === Loading script to check dependencies
  </code></pre>
  
  <p>Exerb seems like a better solution since it compiles to rbc, and it does actually do something:</p>
  
  <pre><code>ruby -r exerb/mkexy test.rb
  # Window pops up and after I close it it writes out test.exy
  C:\Users\jonathan\dev\Citation&gt;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
  </code></pre>
  
  <p>So it can't find win32/api.so. When I look in C:/Ruby187/lib/ruby/site_ruby/1.8/exerb/recipe.rb it looks like gems are not in the search path:</p>
  
  <pre><code>DIR: C:/Users/jonathan/dev/Citation
  DIR: C:/Ruby187/lib/ruby/site_ruby/1.8
  DIR: C:/Ruby187/lib/ruby/site_ruby/1.8/i386-msvcrt
  DIR: C:/Ruby187/lib/ruby/site_ruby
  DIR: C:/Ruby187/lib/ruby/vendor_ruby/1.8
  DIR: C:/Ruby187/lib/ruby/vendor_ruby/1.8/i386-msvcrt
  DIR: C:/Ruby187/lib/ruby/vendor_ruby
  DIR: C:/Ruby187/lib/ruby/1.8
  DIR: C:/Ruby187/lib/ruby/1.8/i386-mingw32
  DIR: .
  </code></pre>
  
  <p>So after digging around I found out you can add search paths in the exy file like so:</p>
  
  <pre><code>path:
    - C:/Ruby187/lib/ruby/gems/
    - C:/Ruby187/lib/ruby/gems/1.8
    - C:/Ruby187/lib/ruby/gems/1.8/gems
  </code></pre>
  
  <p>After this it does show these paths in search_path, but it still gives me the same error. Obviously there must be some way to get rubygems paths to be included in the exy?</p>
  
  <p>So, how does someone build a .exe on Windows these days?</p>
  
  <p>I made some progress with Exerb, I found out you can run mkexy with the -rrubygems option to pull this in. And this works GREAT for most ruby projects. I've tried it for a few ruby scripts that use a number of different libraries without problems. For example:</p>
  
  <pre><code>mkexy -rrubygems test.rb
  exerb test.exy
  test.exe === WORKS!
  </code></pre>
  
  <p>Unfortunately, it doesn't work for watir. When I run an .exe built with watir I get the following:</p>
  
  <pre><code>s4t-utils/claims.rb:24:in `user_is_bewildered': Error in the default values: :br
  </code></pre>
  
  <p>owser's value must be one of 'safari', 'firefox', or 'ie', and '' doesn't look r
  ight. (StandardError)</p>