Since ruby is an interpreted language, whenever you want to release your program you need to release the source code. Also your program users must install Ruby virtual machine before they can run your program. Is there a way to distribute ruby program as a standalone executable?
Erik Veenstra has created a tool called RubyScript2Exe which can convert a ruby program to an executable program. It does this by combining ruby interpreter code and your source code files into a single executable file.
First download the RubyScript2Exe. It is a ruby program ( abut 950kb in size). Create a simple ruby program called helloworld.rb and save it to the same location where you have RubyScript2Exe.rb stored.
puts "Hello World"
From the command prompt, type the following,
ruby rubyscript2exe helloworld.rb
You will see the following output on console. Now you have a standalone executable program (helloworld.exe) which can be executed in any Windows machine! Combined with Win32API, you can create cool command line apps for Windows.
The only problem with this executable is that it contains the entire ruby VM and hence is large (helloworld.exe size is around 1.5MB). Also note that this is not really a ruby compiler. It doesn’t convert your ruby code to machine code. It only packages ruby virtual machine along with your ruby code. Hence the code is still interpreted.
RubyScript2Exe can also create executable files for Linux and Mac OS X.
If you need any other help, or you encounter any problems please PM me, or Post your problem here