User:CasaShea/Possibles/OCRA: Difference between revisions

From Helpful
Jump to navigation Jump to search
m (moved User:MC Scared of Bees/OCRA to User:MC Scared of Bees/Possibles/OCRA: A little organization, I hope this works.)
(Creating)
Line 1: Line 1:
OCRA...
=One-Click Ruby Application=
 
Once you have the "Command prompt with Ruby" shortcut working (I believe it comes with Ruby for Windows), or something similar:
 
{{inlinecode|gem install ocra}}
 
You can also download a stand-alone from [http://rubyforge.org/frs/?group_id=8185 here], but I haven't played with that one at all.
 
After you have a working foo.rb (or .rbw):
 
{{inlinecode|ocra foo.rb}}
 
It will run the program once (to find dependencies) and then tell you some information about what it's doing.  When it's done, you should have a brand new foo.exe waiting for you.
 
If your program does any input or output at all (like, you know, 99+% of all DOS/Windows programs), Ruby will await input and present output while OCRA is doing its thing.  To prevent this, add the following line to the top of your program / right after entering your main loop / etc.:
 
{{inlinecode|exit if Object.const_defined?(:Ocra)}}
 
 
There are tons of options you can give ocra (list them by using {{inlinecode|ocra --help}}), but I haven't yet written anything complex enough to require them, sorry.

Revision as of 15:52, 19 November 2011

One-Click Ruby Application

Once you have the "Command prompt with Ruby" shortcut working (I believe it comes with Ruby for Windows), or something similar:

gem install ocra

You can also download a stand-alone from here, but I haven't played with that one at all.

After you have a working foo.rb (or .rbw):

ocra foo.rb

It will run the program once (to find dependencies) and then tell you some information about what it's doing. When it's done, you should have a brand new foo.exe waiting for you.

If your program does any input or output at all (like, you know, 99+% of all DOS/Windows programs), Ruby will await input and present output while OCRA is doing its thing. To prevent this, add the following line to the top of your program / right after entering your main loop / etc.:

exit if Object.const_defined?(:Ocra)


There are tons of options you can give ocra (list them by using ocra --help), but I haven't yet written anything complex enough to require them, sorry.