Run ruby program on computers without ruby installed

孤者浪人 提交于 2019-12-06 14:17:26

问题


Im new to programming in ruby and actually wrote an program that I would like to
distribute to people that have windows computers and no ruby installed. I heard something about exerb but I'm not sure if this is the right thing for my issues or if there is something easier. Is there something I can use so that my ruby code can be run like an exe file?


回答1:


You can use ocra to create an exe.

This exe-file is a self-extracting ruby interpreter with you code.

After installing ocra, you can start:

ocra my_application.rb

There are some restrictions/pitfalls:

  • You may not depend on additional dll (see e.g. Bundling RMagick with Ocra )
  • No conditioned requires (all packages must be called by the initial ocra call.).

You can check questions tagged ocra to see some details about ocra.




回答2:


Ruby is not machine code, but interpreted code, so you need an interpreter. So if the target platform doesn't have an interpreter, the code cannot run.

If you want your Ruby code to run without installing a Ruby interpreter on the host system, you will have to write and compile Windows software that bundles a Ruby interpreter and executes your Ruby software.




回答3:


http://exerb.sourceforge.jp/index.en.html

Exerb is located here. It contains a ruby interpreter so it doesnt need one to be previously installed.



来源:https://stackoverflow.com/questions/18752249/run-ruby-program-on-computers-without-ruby-installed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!