为什么需要“要求'捆绑器/设置'”? [英] Why do you need "require 'bundler/setup'"?

查看:57
本文介绍了为什么需要“要求'捆绑器/设置'”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我所看到的几乎每个Sinatra示例中,尽管它做了什么,但始终具有以下两行:

In almost every Sinatra example I've seen, despite what it does, it always has the following two lines:

require 'rubygems'
require 'bundler/setup'

在大多数示例中,删除 bundler / setup'require似乎没有破坏性的作用,所以我对何时/何地需要包含此内容感到困惑。

In most examples, removing the 'bundler/setup' require seems to have no breaking effect, so I'm confused about when/where I need to include this.

我讨厌使用东西,而并不完全知道它在那里的原因,所以我希望有人能解释为什么我同时需要这两行以及它们需要做什么?

I hate using things without knowing exactly the reason for it being there, so I was hoping someone could explain why I need both lines and what they do?

推荐答案

您正在加载Gemfile定义的gem。请在此处 https://bundler.io/v1.12/bundler_setup中查看文档。 html

It ensures you're loading Gemfile defined gems. Please have a look at the documentation here https://bundler.io/v1.12/bundler_setup.html

这篇关于为什么需要“要求'捆绑器/设置'”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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