你如何打包一个 ruby​​ 应用程序以供离线安装? [英] How do you package a ruby application for offline installation?

查看:49
本文介绍了你如何打包一个 ruby​​ 应用程序以供离线安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个无法访问 Internet 的 Intranet 服务器,我需要在其上部署 RoR 应用程序.

I have an intranet server with no internet access that I need to deploy a RoR application on it.

我的过程将是下载 Ruby、安装它、下载 Rails、安装它等等.但是我的 Gemfile 中有多个我想安装的 gem.如何在 Intranet 服务器上获取这些?是不是需要单独下载,还是有办法打包?

My process will be to download Ruby, install it, download Rails, install it, etc. But I have multiple gems in my Gemfile I'd like to install. How can I get these on the intranet server? Do I have to download them all separately, or is there there a way to package them up?

推荐答案

您可以通过运行以下命令告诉 bundler 供应商您的应用程序所需的所有 gem:

You can tell bundler to vendor all the gems needed for your app, by running:

bundle install --deployment

这将在您的应用程序的根目录中创建一个 vendor 目录.确保在将应用程序移动到独立服务器时包含此目录.您仍然需要安装 Ruby、RubyGems 和 bundler gem.

That will create a vendor directory in the root of your application. Make sure you include this directory when moving the app to the standalone server. You will still need to install Ruby, RubyGems, and the bundler gem.

对于 Ruby 和 RubyGems,您可以下载它们各自的安装程序.您可以使用 gem fetch

For Ruby and RubyGems you can download their respective installers. You can download a copy of the bundler with gem fetch

gem fetch bundler

这将下载一个类似于 bundler-1.6.5.gem 的 gem 文件,您可以使用以下命令将其安装在独立服务器上:

This will download a gem file like bundler-1.6.5.gem, which you can install on the standalone server with:

gem install bundler-1.6.5.gem

这篇关于你如何打包一个 ruby​​ 应用程序以供离线安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆