[英]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
orGemfile.lock
安装由Gemfile
或Gemfile.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.