Is it a way to distribute compound Ruby scripts like PHAR in PHP/JAR in Java/EGG in Python?
In my work it's often to distribute scripts to other departments in a company, contractors etc. If a script is a single .rb / .php / .jar / .py file it's easy: all i need is to somehow supply this file to a person and he just double clicks it to execute. But if script is complex (big), writing it as a single file is not very good from programmer's point of view - so complex scripts are created as a number of files with something like "main" file that starts a script. And where is a problem with distributing such scripts to non-programmers: they need to copy an entire folder containing all files, locate the main file and double click it. This is much harder to non-programmers than just double clicking a single file :(. Really.
PHP, Java and Python offers a solution for such distribution problems. I can just pack all files into ".phar", ".jar" or ".egg" file and push this file to end users - double clicking it will execute a script (or entering it's name in a console开发者_开发问答 if script is command-line). Same simplicity as with single script file.
Does something like this exists for Ruby? I have checked the 'gem' mechanics that seems to me very common to python 'egg' - but it seems that 'gems' are not suited to be executed as a 'script', they are for installation only :(.
Any hints or ideas?
You could use JRuby in combination with Rawr:
http://rawr.rubyforge.org/
To quote the docs: "With Rawr, a simple, pre-generated configuration file turns your code into an executable jar, a .exe for Windows, and a .app for OS X."
精彩评论