即使我的应用程序使用捆绑程序,我是否也需要将乘客安装为常规的宝石? [英] Do I need to install passenger as a regular gem even though my app uses bundler?

查看:39
本文介绍了即使我的应用程序使用捆绑程序,我是否也需要将乘客安装为常规的宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图设置一个新服务器来托管Rails应用程序,并且希望所有组件都进行全新安装,所以我决定使用rvm + bundler。这是我第一次设置Rails服务器。

Im trying to setup a new server to host a Rails app and want a clean installation of all the components so i decided to use rvm+bundler. Its my first time setting up a Rails server.

我以前在应用程序中使用捆绑程序,并且我了解它如何管理应用程序的依赖关系...但是自从安装Im之后乘客,因为这是托管环境的依赖项,所以我需要在包装盒上自己做一个宝石安装乘客,而不是捆绑此依赖项,对吗?还是应该将乘客放置在应用程序的Gemfile中?

I've used bundler with an app before and I understand how it manages the App's dependencies... but since Im installing Passenger and since this is the hosting environment's dependency, I need to do a 'gem install passenger' on the box itself instead of bundling this dependency, right? Or should I be putting passenger in the Gemfile of the app ?

推荐答案

应用程序本身无需安装乘客即可运行(独角兽, webrick,mongrel,thin等),因此,乘客不应真正出现在Gemfile中。在这种情况下,将乘客单独安装为gem会是正确的选择。

The application itself would run without having passenger installed (unicorn, webrick, mongrel, thin, etc.), therefore passenger shouldn't really be in the Gemfile. Installing passenger as a gem separately would be the correct choice in this instance.

将Gemfile视为应用程序正在使用的gem列表。乘客使用您的应用程序向用户提供数据,而不是使用您的应用程序。在将来,您可能会考虑使用其他应用程序服务器,并且无需更改应用程序的任何部分(包括Gemfile)即可进行更改。

Look at the Gemfile as a list of the gems that your application is using. Passenger is using your application to serve data to the user, rather than your application using it. Down the road, you may consider using another application server, and you shouldn't have to change any portion of your application, even the Gemfile, to make that change.

但是,如果您的应用程序实际上在内部使用了特定于乘客的功能或部分乘客gem,则应将其包括在内。例如,如果您使用的是在passenger中声明的类,那么您将依赖它,并将其包含在Gemfile中。

However, if your application is actually using passenger-specific features or portions of the passenger gem internally, then you should include it. For example, if you were using a class declared in passenger, then you would be depending on it, and should include it in your Gemfile.

这篇关于即使我的应用程序使用捆绑程序,我是否也需要将乘客安装为常规的宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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