0
我需要打包Ruby应用程序(一个批处理作业)并分发给其他用户。理想情况下,我不需要用户设置Ruby,并且该软件包应包含其中的所有依赖关系。打包并发布Ruby批处理应用程序
有没有简单的方法来做到这一点?我正在使用Ruby v1.9.3。
我需要打包Ruby应用程序(一个批处理作业)并分发给其他用户。理想情况下,我不需要用户设置Ruby,并且该软件包应包含其中的所有依赖关系。打包并发布Ruby批处理应用程序
有没有简单的方法来做到这一点?我正在使用Ruby v1.9.3。
你不是在你的问题清楚,所以我会承担下列条件:
鉴于此,你最好的选择可能是'ocra'宝石。有了它,您可以使用ocra <script>.rb
将脚本打包到.exe中。这将捆绑你的Ruby运行时,你的脚本使用任何宝石,和源成<script>.exe
文件,像这样:
C:\Users\Walton>cat hello.rb
puts 'Hello World!'
C:\Users\Walton>ocra hello.rb
=== Loading script to check dependencies
Hello World!
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ocra-1.3.0/bin/ocra:467: Use RbConfig instead of obsolete and deprecated Config.
=== Including 52 encoding support files (5179608 bytes, use --no-enc to exclude)
=== Building hello.exe
=== Adding user-supplied source files
=== Adding ruby executable ruby.exe
=== Adding library files
=== Compressing 14898286 bytes
=== Finished building hello.exe (3261400 bytes)
C:\Users\Walton>hello.exe
Hello World!
既然包您现有的Ruby运行时,你应该可以运行32位的Ruby确保您的可执行文件可以在32位和64位平台上运行。
如果您需要比ocra更多的东西,最好的办法就是构建一个安装程序,它将Ruby和您的应用程序打包在一起。
非常感谢! – iwan 2012-10-17 17:18:17