简体   繁体   English

Ruby - 如何在 gemfile 上使用捆绑器来创建环境?

[英]Ruby - how to use bundler on a gemfile to create an environement?

I am joining a Ruby project and I was given a GitHub url for the gemfile.我正在加入一个 Ruby 项目,我得到了 gemfile 的 GitHub url。 I copied and pasted the gemfile to the root of my ruby setup.我将 gemfile 复制并粘贴到我的 ruby 安装程序的根目录中。

What I wasn't sure about was what the extension of the gemfile should be.我不确定的是 gemfile 的扩展名应该是什么。 Should it be "name.rb"?应该是“name.rb”吗?

And also what I am confused about is the command I should use.而且我感到困惑的是我应该使用的命令。 I googled around for the right syntax, but got confused what the syntax should be to use the bundler to create the application from the gemfile that I have.我在谷歌上搜索了正确的语法,但对使用捆绑器从我拥有的 gemfile 创建应用程序的语法应该是什么感到困惑。

Advice much appreciated!非常感谢您的建议!

The Gemfile should be saved without an extension. Gemfile 应该在没有扩展名的情况下保存。

Bundler has many different commands you can use, but it sounds like you are interested in how to get Bundler to install all of the project dependencies. Bundler 有许多不同的命令可供您使用,但您似乎对如何让 Bundler 安装所有项目依赖项感兴趣。 From the Bundler documentation :来自 Bundler文档

bundle install

Install the gems specified by the Gemfile or Gemfile.lock安装由GemfileGemfile.lock指定的 gem

Since a Gemfile is evaluated as Ruby code it is possible to save it with an extension of .rb .由于 Gemfile 被评估为 Ruby 代码,因此可以将其保存为扩展名.rb However, Bundler will not automatically find it if you do.但是,如果您这样做,Bundler 不会自动找到它。 If for some reason you do need to save it with a .rb extension this answer shows how it is possible.如果出于某种原因您确实需要使用.rb扩展名保存它, 此答案将说明如何实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过捆绑程序安装的Ruby Gem和Gemfile无法加载 - Ruby Gem installed through bundler and Gemfile not loading 如何使用特定版本的捆绑器捆绑安装 gemfile - How to bundle install gemfile with specific version of bundler Bundler 正在从 Gemfile.lock 中删除 RUBY VERSION - Bundler is removing RUBY VERSION from Gemfile.lock Ruby on Rails Bundler:在Gemfile指定的不同路径中安装gem吗? - Ruby on Rails Bundler: install gems in different paths specified by Gemfile? Bundler :: RubyVersionMismatch:您的Ruby版本是2.3.1,但是您的Gemfile指定了2.1.8 - Bundler::RubyVersionMismatch: Your Ruby version is 2.3.1, but your Gemfile specified 2.1.8 Bundler :: RubyVersionMismatch:您的Ruby版本是1.9.3,但您的Gemfile指定为2.0.0 - Bundler::RubyVersionMismatch: Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 如何在Gemfile中使用条件 - How to use conditionals in Gemfile Bundler如何利用Gemfile.lock加载宝石? - How does Bundler utilize Gemfile.lock to load gems? 当您的 Gemfile 需要旧版本的捆绑器时,如何“捆绑安装”? - How to `bundle install` when your Gemfile requires an older version of bundler? 如何在协作上下文中处理bundler更新(Gemfile.lock)? - How to deal with bundler updates (Gemfile.lock) in collaborative context?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM