ios 在 iPad 上运行 Ruby 解释器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2602697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 17:07:26  来源:igfitidea点击:

Running a Ruby interpreter on iPad

iphoneiosrubyipad

提问by slothbear

I'll be taking a trip soon with my iPad, without my laptop. I'd like to continue to tinker with Ruby while I'm on the road. I have an iPhone developer program membership, and I'm notinterested in submitting this stuff to the app store.

我很快就会带着 iPad 去旅行,而不用带笔记本电脑。我想在旅途中继续修补 Ruby。我拥有 iPhone 开发者计划会员资格,我对向应用商店提交这些内容感兴趣。

I found the shinycocosproject, which appears to embed a Ruby interpreter in an app. But I can't get it to run, and it seems pretty customized for running cocos2d stuff.

我找到了Shinycocos项目,它似乎在应用程序中嵌入了 Ruby 解释器。但是我无法让它运行,而且它似乎非常适合运行 cocos2d 的东西。

My first goal is to run an interactive command line like Try Ruby!. After that, I'd like to enter small programs in a UITextView and run them. I'd appreciate any clues, tips, or existing projects you might know of.

我的第一个目标是运行一个交互式命令行,比如Try Ruby!. 在那之后,我想在一个UITextView进入小程序并运行它们。我很感激您可能知道的任何线索、技巧或现有项目。

采纳答案by slothbear

I'm now using mruby-web-irb, which meets the requirements stated.

我现在正在使用mruby-web-irb,它符合规定的要求。

The project provides a Ruby interpreter in Safari (or Chrome) by compiling mrubyinto Javascript via emscripten. That sounds like a lot of complexity, but it just works.

该项目通过emscriptenmruby编译成 Javascript,在 Safari(或 Chrome)中提供了一个 Ruby 解释器。这听起来很复杂,但它确实有效

If you like this kind of thing, definitely check out the emscripten demos. Especially repl.it, an Online REPL for 15+ languages, including Ruby, Python, Lua, Scheme, Forth, and Basic.

如果你喜欢这种事情,肯定检查出emscripten演示。特别是repl.it,一个适用于 15 种以上语言在线 REPL,包括 Ruby、Python、Lua、Scheme、Forth 和 Basic。

回答by J?rg W Mittag

The Rhodes Frameworkcontains a working Ruby implementation for the iPhone. You could try just writing your own simple IRB clone with Rhodes and see how that goes. You won't be able to get it through the App Store, of course, but you don't care about that, anyway.

罗德框架包含了工作的Ruby实现的iPhone。你可以尝试只写与罗德自己的简单克隆IRB并看到如何继续下去。当然,您将无法通过 App Store 获得它,但无论如何您都不关心它。

As a next step, you could steal their build recipesand compile your own.

下一步,您可以窃取他们的构建配方并编译自己的。

In the future, it will probably be possible to use MacRuby, but for the time being, everybody who works on MacRuby either works for Apple or has signed an NDA, so they aren't saying anything. However, the MacRuby lead developer once said that MacRuby's ahead-of-time compiler couldin the future be used to "run Ruby on resource-constrained small-size mobile internet devices" without ever mentioning the i-word.

将来,可能会使用MacRuby,但目前,在 MacRuby 上工作的每个人要么为 Apple 工作,要么签署了 NDA,所以他们什么都不说。然而,一旦说MacRuby的主要开发人员是MacRuby的名列前茅的即时编译器可能在将来用于“在资源受限的小型移动互联网设备运行Ruby”而没有提我字。

[Note that this will probably notallow you to run an interpreter on the device, rather you would statically compile your code natively and then upload it to the device. And the compiler does not support eval, which is crucial for running something like IRB or even a full IDE on the device.]

[注意,这可能不会让你的设备上运行一个解释,而你将静态编译代码本身,然后将其上传到设备中。并且编译器不支持eval,这对于在设备上运行 IRB 甚至完整 IDE 之类的东西至关重要。]

At the moment, your best bet for a mobile Ruby IDE is probably Android.

目前,移动 Ruby IDE 的最佳选择可能是 Android。

回答by Pegolon

There is an iPhone project which embeds a Ruby interpreter and provides a basic command line at https://github.com/takuma104/iphone-irb. I compiled it and could install in on an iPad without problems. Unfortunately the project seems to be abandoned, but a good starting point.

有一个 iPhone 项目,它嵌入了 Ruby 解释器并在https://github.com/takuma104/iphone-irb提供了一个基本的命令行。我编译了它,可以毫无问题地安装在 iPad 上。不幸的是,该项目似乎被放弃了,但这是一个很好的起点。

回答by Bu2

I would recommend - Textastics as code editor (it includes sync features - ftp, webdav... - and a web browser to test your web page) - jailbreak + openssh - iSSH for remote but also localhost connection. Provides a nice shell directly on the iPad - jailbreak + ruby 1.9 from Cydia (not fully working, I would try to build it myself) - then you create your application on desktop computer, install all gems that you need - rake gem:freeze (if I remenber well) to embbed all rails dependencies in the app folder - then put the whole on your iPad and see...

我会推荐 - Textastics 作为代码编辑器(它包括同步功能 - ftp、webdav... - 和一个用于测试你的网页的网络浏览器) - 越狱 + openssh - iSSH 用于远程和本地主机连接。直接在 iPad 上提供了一个漂亮的外壳——来自 Cydia 的越狱 + ruby​​ 1.9(不能完全工作,我会尝试自己构建它)——然后你在台式计算机上创建你的应用程序,安装你需要的所有宝石——rake gem:freeze(如果我记得很好)将所有 Rails 依赖项嵌入到应用程序文件夹中 - 然后将整个文件放在您的 iPad 上并查看...

then you are a Rails developer in the wild :-D

那么你就是一名野外的 Rails 开发人员 :-D

回答by TechZen

You'll probably be best off setting up a little server on your home machine to accept uploads of ruby code, run it on the server and return the results via the browser. I think there are some rails implementations out there that will do this for you.

你可能最好在你的家用机器上设置一个小服务器来接受 ruby​​ 代码的上传,在服务器上运行它并通过浏览器返回结果。我认为有一些 Rails 实现可以为您做到这一点。

回答by captain

iSSH to your unix server shell, and use "vim" to code and "ruby " to execute. It's no IDE , but it works as long as you have reliable Internet. CCK, Camera Connector Kit, will allow you to use most keyboards, but test first! Some draw too much power, including Apple's own keyboard! :-P. Apple wireless keyboard works fine though, and is very portable. ;-)

iSSH 连接到您的 unix 服务器外壳,并使用“vim”编码和“ruby”执行。它不是 IDE,但只要您有可靠的互联网,它就可以工作。CCK,相机连接器套件,可让您使用大多数键盘,但请先进行测试!有些耗电太大,包括苹果自己的键盘!:-P。苹果无线键盘虽然很好用,而且非常便携。;-)