Ruby 使用本机工具包进行跨平台开发的可行性?

发布于 2024-08-11 05:52:20 字数 550 浏览 8 评论 0原文

假设我正在编写一个闭源商业软件,该软件将在以下情况下部署:基于 .Net 构建的 Windows 桌面应用程序、ActiveX 控件、Windows Netscape 插件、基于 Cocoa 构建的 Mac 桌面应用程序、Mac Netscape 插件、Java小程序托管在浏览器中。在代码共享方面,在共享 Ruby 源文件中编写模型和控制器类并使用 MacRuby、IronRuby 和 JRuby 集成到各种运行时中是否可行?我的视图类大概会被编写为在 Windows 上使用 WPF、在 Mac 上使用 Cocoa 以及任何适合 Java(SWT?)的东西。

从我的角度来看,这里最重要的是代码库的长期维护,并且 Ruby 似乎在我必须瞄准的三个平台上接近成为一流语言:.Net、Cocoa 和 Java,与任何语言一样。我在这方面有错吗?

其次重要的是避免对我们的代码提出任何病毒式许可证要求。我看到 JRuby 在哪里以各种许可证发布;我可以正确地假设我可以分发二进制文件,并且许可证不适用于我为自己的应用程序编写的任何 Ruby 文件(而不是对其框架的修改)。Ruby

是否已在任何众所周知的桌面应用程序中使用?这以前做过吗?

Let's say that I was writing a closed sourced commercial piece of software which was to be deployed in the following situations: Windows Desktop App built on .Net, ActiveX control, Windows Netscape plugin, Mac Desktop App built on Cocoa, Mac Netscape plugin, Java applet hosted in browser. Would it be viable in terms of code sharing to write my model and controller classes in shared Ruby source files and use MacRuby, IronRuby and JRuby to integrate into the various runtimes? My view classes would presumably be written to use WPF on Windows, Cocoa on the Mac and whatever was appropriate on Java (SWT?).

From my point of view, the most important thing here is long term maintenance of the codebase, and it seems as though Ruby is as close to being a first class language on the three platforms I have to target: .Net, Cocoa and Java, as any language. Am I mistaken in this?

Second in importance is to avoid any viral license requirements on our code. I see where JRuby is released under various licenses; am I right to assume I can distribute binaries and the licenses do not apply to any Ruby files I write for my own application (as opposed to modifications of their framework.)

Has Ruby been used in any well known desktop applications? Has this been done before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

月棠 2024-08-18 05:52:20

嗯......如果问题是“如何使用 Ruby 创建可维护的产品并使其可用于所有这些端点(Web、桌面和基于 Java 的移动设备)?”

然后以我的拙见,使用 ruby​​ 和三种风格(jRuby、IronRuby 和 MacRuby)会导致更多的维护问题。您必须了解或至少雇用所有三个平台上经验丰富的开发人员,并且您将花费大量时间创建真正抽象的代码,除非您打算仅使用 ruby​​ 进行数据库访问。

您可能最好坚持使用其中一种平台(Java 和 jRuby 可能是最便携的选项)并使用其各种打包选项来分发产品。

Hmmm....if the question is "How can I create a maintainable product using Ruby and make it available to all of these end points (web, desktop, and java-based mobile)?"

Then in my humble opinion, using ruby AND the three flavors (jRuby, IronRuby and MacRuby) would result in many more maintenance problems than not. You'd have to understand or at least employ experienced developers on all three platforms, and you'd spend a lot of time creating really abstract code, unless you plan to use ruby just for database access.

You're probably better off sticking with one of the platforms (Java & jRuby is probably the most portable option) and using its various packaging options to distribute the product.

一笔一画续写前缘 2024-08-18 05:52:20

这是可能的,尽管我对您概述的方法有点警惕:例如,IronRuby 还不是 1.0。

您是否期望除 UI 之外还有更多特定于操作系统的工作?如果没有,那么我会首先查看 WxRuby,这是一个(相当薄的) ) 跨平台 WxWidgets 库的包装器。不要太努力地寻找 Ruby 包装器的良好文档,顺便说一句 - 痛苦的经历教会了我查看示例代码,它实际上非常全面。

其他平台特定的东西可能应该被抽象/封装在某种包装器/外观/api/代理后面(选择你的模式)。

您说“闭源”——您在 Ruby 环境中对此有策略吗?虽然我至少见过一些工具(ruby2exe 和 RubyScript2exe) ,我不知道你的 Ruby 代码实际上有多隐藏。它是否需要是一个独立的、部署的可执行文件,或者它可以是基于浏览器的吗?这将解决所有跨平台问题(尽管您可能会直接运行跨浏览器问题)。

这个问题中有更多讨论(包括Python,这是另一种选择)

It's possible, although I'd be a little wary of the approach you've outlined: IronRuby isn't 1.0 yet, for example.

Are you expecting much OS-specific work beyond the UI? If not then I'd start by looking at WxRuby, which is a (fairly thin) wrapper of the cross-platform WxWidgets library. Don't work too hard looking for good documentation of the Ruby wrapper, btw - painful experience has taught me to look at the example code, which is actually very comprehensive.

Other platform specific stuff should probably be abstracted/encapsulated away behind some sort of wrapper/facade/api/proxy (pick your pattern).

You say "closed source" - did you have a strategy for that in a Ruby context? While there are at least a couple of tools (ruby2exe and RubyScript2exe) that I've seen, I don't know how hidden your Ruby code will actually be. Does it need to be a standalone, deployed executable at all, or could it be browser-based? That would solve all the cross-platform issues (although you might be running face-first into cross-browser ones instead).

There's some more discussion (including Python, which is another alternative) in this SO question

泪痕残 2024-08-18 05:52:20

就代码而言是否可行
分享编写我的模型和
共享 Ruby 中的控制器类
源文件并使用 MacRuby、IronRuby
和 JRuby 集成到
各种运行时?

您将能够在三个不同的实现之间共享 Ruby 代码;它们都是非常兼容的 Ruby 实现。请记住,JRuby 和 IronRuby 针对 Ruby 1.8.6 功能,JRuby 也开始支持 1.9 功能,而 MacRuby 仅支持 1.9。

您需要在三个实现之间不共享的特定于平台的部分,因为只有 JRuby 可以与 SWT、IronRuby 与 WPF 等通信。

看起来 Ruby 很接近
是世界上的一流语言
我必须瞄准三个平台:
.Net、Cocoa 和 Java,以及任何语言

这三种 Ruby 实现都很成熟,受到不断增长的社区的支持,并得到成熟公司的支持。虽然 Ruby 不是任何平台上的主要推动语言,但所有实现都没有导致无法使用 Ruby 的重大限制,尽管在某些情况下您可能需要求助于少量 C#/Java/Objective-C 。

我是否可以假设我可以分发
二进制文件和许可证不适用
到我自己编写的任何 Ruby 文件
应用程序(相对于
修改其框架。)

那么,您需要自己阅读许可证才能做出决定,或者询问您认识的律师。话虽这么说,只要没有任何许可证是“病毒式”的,例如 GPL,您就应该可以自由地分发您的应用程序,并保留完整的 Ruby 实现的二进制文件和许可证,并决定您的应用程序将使用的许可证,如下所示以及是否收费。但同样,如果您担心合法性,请咨询律师。

Ruby 是否被用于任何众所周知的领域?
桌面应用程序?这已经是
以前做过吗?

我不知道有哪些广泛使用的桌面应用程序使用 Ruby,但我知道有几个在 Windows 上使用 IronPython 的应用程序,例如 BlazeResolver One;他们的部署方法与 IronRuby 相同。

Would it be viable in terms of code
sharing to write my model and
controller classes in shared Ruby
source files and use MacRuby, IronRuby
and JRuby to integrate into the
various runtimes?

You would be able to share Ruby code between the three different implementations; they all are very-compatible Ruby implementations. Keep in mind that JRuby and IronRuby target Ruby 1.8.6 features, JRuby also is beginning to work on 1.9 features, and MacRuby only support 1.9.

You'd need platform-specific pieces that are not shared between the three implementations, since only JRuby can talk to SWT, IronRuby to WPF, etc.

seems as though Ruby is as close to
being a first class language on the
three platforms I have to target:
.Net, Cocoa and Java, as any language

The three Ruby implementations are well-established, supported by a ever-growing community, and backed by well-established companies. While Ruby isn't the primary-pushed language on any of the platforms, none of the implementations have major limitations that make using Ruby impossible, though you may need to resort to a small amount of C#/Java/Objective-C for some things.

am I right to assume I can distribute
binaries and the licenses do not apply
to any Ruby files I write for my own
application (as opposed to
modifications of their framework.)

Well, you need to read the licenses yourself to make that decision, or ask a lawyer you know. That being said, as long as none of the licenses are "viral", like GPL, you should be free to distribute your application with the binaries and licenses of the Ruby implementations in-tact, and decide whatever license you application will use, as well as whether or not you charge money. But again, if you're concerned about the legality, ask a lawyer.

Has Ruby been used in any well known
desktop applications? Has this been
done before?

I don't know of any widely-used desktop applications that use Ruby, but I do know of a couple applications which use IronPython on Windows, such as Blaze and Resolver One; their methods for deploying would be the same for IronRuby.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文