1、下载 ocra-1.3.1.gem 文件
2、打开“start Command prompt with ruby” 命令窗口
3、输入 “gem install e:\ocra-1.3.1.gem -l”安装gem,#=>“Successfully installed ocra-1.3.1”
4、输入“d:\>ocra YouRuby.rb”开始打包, #=>”Finished building YouRuby.exe”
打包完后将在d:\根目录下生成一个红宝石图标的 “YouRuby.exe”执行文件,将这个文件发到没有ruby环境的电脑上也能执行,应为里面打包了必要的环境文件。
=== Building YouRuby.exe
=== Adding user-supplied source files
=== Adding ruby executable ruby.exe
=== Adding detected DLL C:/Ruby193/bin/libffi-6.dll
=== Adding detected DLL C:/Ruby193/bin/libyaml-0-2.dll
=== Adding detected DLL C:/Ruby193/bin/zlib1.dll
=== Adding library files
=== Compressing 8476770 bytes
=== Finished building YouRuby.exe (1773606 bytes)
时间: 2024-10-18 10:17:31