如何使用所需的 gem 分发 Ruby 应用程序

发布于 2024-08-04 21:34:26 字数 190 浏览 3 评论 0原文

我开发了一个 Ruby 应用程序(一个小游戏),我想将它“分发”给其他人。

但是,我不知道如何处理所需的宝石。如果我只是将我的应用程序发送给安装了 ruby​​ 的人,但没有安装所需的 gem,我认为它会爆炸。我可以在本地打包宝石吗?如果是这样,如果其他人拥有不同版本的宝石,会发生冲突吗?

那么,这样做的聪明/正确/好的方法是什么?

I've developed a Ruby application (a small game), and I would like to 'distribute' it to other people.

However, I am not sure what to do about the required gems. If I just send my application to someone who have ruby installed, but not the required gems, I assume it will blow up. Can I package the gems locally? If so, would it conflict if the other person has a different version of the gem?

So, what is the smart/proper/good way of doing this?

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

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

发布评论

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

评论(4

满栀 2024-08-11 21:34:26

最好的方法可能是将您的游戏也打包为 gem,这样 ruby​​gems 将负责安装依赖项。 这里是解释如何创建自己的 gem 的文档。

The best way would probably be to just package your game as a gem as well, that way rubygems will take care of installing the dependencies. Here's the documentation explaining how to create your own gems.

趴在窗边数星星i 2024-08-11 21:34:26

如果您不想将游戏打包为 gem,您可以研究 Bundler,它将是集成到 Rails 3 中。

If you'd rather not package your game as a gem, you could investigate the Bundler, which will be integrated into Rails 3.

淡忘如思 2024-08-11 21:34:26

在您的environment.rb中,您可以表达您的gem依赖项,例如。

  config.gem "activemerchant", :lib => "active_merchant", :version => "1.4.1"

这不像 gem 依赖项那样自动,但它确实有用。用户必须 sudo rake gems:install 才能启动您的应用。

In your environment.rb you can express your gem dependencies, eg.

  config.gem "activemerchant", :lib => "active_merchant", :version => "1.4.1"

This isn't as automatic as gem dependencies, but it certainly usable. User must sudo rake gems:install to get your app to start.

墨离汐 2024-08-11 21:34:26

如果您正在寻找一种创建 OSX .dmg 和 Windows 安装程序的方法,有一个名为 releasy 的 gem将为您完成所有这些工作,并且它是专门为发布用 Ruby 编写的 GUI 应用程序而定制的。它将 Ruby 和所有 gem 依赖项捆绑到一个可执行文件中,以便您的最终用户无需安装任何额外的东西。

您需要访问 Windows/OSX 环境来制作安装程序。

If you're looking for a way to create OSX .dmg's and Windows Installers, there's a gem called releasy that will do all of that for you, and it is specifically tailored for releasing GUI apps written in Ruby. It bundles up Ruby and all your gem dependencies in to a single executable so that your end user doesn't have to install anything extra.

You will need access to a Windows/OSX environment to make the installers.

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