MacRuby:如何编写生成本机 Mac 应用程序的应用程序/脚本?

发布于 2024-12-20 06:55:40 字数 497 浏览 4 评论 0原文

所以我基本上试图重新创建这个应用程序:Fluid,已经做了。我想编写一个 Ruby 脚本或 MacRuby 应用程序,它接受一些参数并可以生成一个简单的本机应用程序。

由于他们的代码不是开源的,我看不到他们是如何做到的。我不知道如何开始完成这样的事情。

另外,我希望这个脚本在 Windows 上运行(并不是说用户可以安装生成的应用程序,而是可以将该应用程序分发给 Mac 用户)。

我怎么能做这样的事呢?

解决方案:

这是一个与我想做的事情完全相同的项目。它需要一个应用程序包并对包中的某些文件进行一些字符串替换。我将用它作为例子来模仿。

https://github.com/maccman/macgap-rb

So I'm basically trying to recreate what this app: Fluid, already does. I want to write a Ruby script, or MacRuby app that accepts a few parameters and can generate a simple native app.

Since their code is not open-sourced, I can't see how they do it. And I don't know how I would begin to accomplish something like this.

Also, I would like this script to be run on Windows (not that the user could install the generated app, but so the app could be distributed to Mac users).

How could I do something like this?

Solution:

Here is a project that does exactly the same thing that I'm trying to do. It takes an app bundle and does some string replacing on some files in the bundle. I'm going to use it as an example to imitate.

https://github.com/maccman/macgap-rb

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

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

发布评论

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

评论(2

Hello爱情风 2024-12-27 06:55:40

MacRuby 已经可以在 OS X 上创建本机应用程序包(它是编译器也是解释器),因此从某种意义上说,这里没有问题需要回答。如果您想在 MacRuby 或 Objective-C for OS X 中编写应用程序,体验本质上是相同的(当然,MacRuby 有不同的命令行标志来生成最终结果,在本例中是 MacRuby 的 -deploy 标志)与 ObjC 的某些链接器调用)。也就是说,您在 MacRuby 中编写的任何内容都无法在 Windows 中本机运行。根据您想要的应用程序的复杂性,您可能需要使用一些跨平台解决方案(例如 Unity)。

MacRuby can already create native app bundles on OS X (it's a compiler as well as an interpreter), so in a sense there's no question to be answered here. If you want to write an app in MacRuby or Objective-C for OS X, the experience is essentially the same (though, of course, MacRuby has different command line flags for generating the final result, in this case the -deploy flag to MacRuby vs some linker invocation for ObjC). That said, nothing you write in MacRuby will run natively in Windows. Depending on the complexity of the app you have in mind, you may have to go to some cross-platform solution (like Unity) for that.

〃温暖了心ぐ 2024-12-27 06:55:40

请查看 Prism。它不是 Ruby,但它完全符合您的描述,并且是开源的。您要做的一件事是将网络浏览器嵌入到窗口中,因此请寻找可以执行此操作的库。我假设您将使用 Cocoa 作为 GUI,因为您使用的是 MacRuby。最后,最简单的方法就是有一个带有网络浏览器的窗口。

Check out Prism. It's not Ruby, but it does exactly what you describe and is open-source. One thing you'll to do is embed a web browser into a window, so look for libraries that do that. I'm assuming you'll use Cocoa for GUI since you're using MacRuby. In the end, the simplest way would be just have a window with web browser in it.

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