From: bbiker Date: 2009-07-04T13:45:05+09:00 Subject: Re: RubyScript2Exe fix for bug in line 621? On Jul 3, 5:51 pm, __ __ wrote: > > I am not sure what you mean by "compatible with OCRA. " > > Specifically, I meant the gem is capable of being compiled by OCRA. > From your response, it sounds like all gems are compatible.  That's good > to know. Please, let me emphasize that ocra, rubyscript2exe, and crate do not "compile" your program into an executable binary code. All they do is package the ruby interpreter, the required resources (gems and any other needed libraries), and your source files into a bundle with an .exe' extension. At runtime, all the files are unpacked into a temporary directory and run your program. Effectively a ruby installation is placed on the host computer which stays resident until your program terminates. Crate accomplishes this differently but for all practical purposes it is essentially the same idea. When ocra invokes your program, the program only needs to run until all the 'requires' have been executed. At that point, your program could be terminated and ocra would have enough information to package your program. The "magical' statement is: exit if Objective.const_defined?(:Ocra) You can verify by placing this statement before your program prints "Hello World". Your "executable" program will run to completion. For example I have a program which normally requires 1/2 hour runtime. Here is the beginning of the top level source file # gems that the program needs require 'rubygems' require 'windows/api' include Windows # source files that make up the programs require 'dealer' require 'df' require 'analysis' require 'report' exit if Object.const_defined?(:Ocra) When invoked via ocra, the program terminates in a blink of an eye and ocra begins its packaging at that point. The console output lists all the resources that makeup the package. A point you should be aware. If your program interfaces with external programs, these programs are not part of the package. In my program, dealer.rb executes an external program via a dos console and df.rb controls an external program via its dll. This means that the .exe must be run in the directory that these external programs exist. > I figured as much.  That's okay; there are bound to be some good GUI and > graphics gems out there, although I can't think of any at the moment. > What do you people recommend? I have not programmed any GUI programs. There have been several threads on mailing lists that discuss the various gui available. Ask 10 programmers and you'll get 20 opinions. It would be worthwhile for you to use google. > I tried OCRA, and it works great so far!  I haven't had any problems > with it.  Granted, I did test it on only a Hello World script, so I > haven't tried it with gems yet.  However, I don't doubt it works with gems. A long journey begins but with one step. In my opinion, if you want to know how a horse feels, ask the horse and not the jockey. A good resource for programming ruby in windows is: http://rubyonwindows.blogspot.com/ http://rubyforge.org/forum/?group_id=8185 is the forum url for ocra. Lars Christensen the author of ocra has shown to be responsive to question and uncovered bugs. Please do not take the above as a put off. I am glad to answer your questions. But I am just someone that bet on the horse and came out a winner. I have not mentioned that rubyscript2exe has problems with ruby-1.8.6 and later. It appears that for one reason or another it is no longer supported. It is a shame, since the author (Erik Veenstra) has contributed very good gems to the Ruby community. Regards Bernard Kenik renard@nc.rr.com