捆绑机如何工作(一般)? [英] How does bundler work (in general)?

查看:103
本文介绍了捆绑机如何工作(一般)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Ruby / Rails很新,但是我正在看捆绑器,并想知道它是如何工作的。你是否安装了一套完整的gem,像普通的 gem install XYZ ,然后使用Gemfile来获取这些宝石的某个子集,以便与特定的应用程序一起使用?或者您是否不再正常安装gem,只需将它们包含在Gemfile中,然后执行 bundle install 将它们全部包含在随后与您的应用程序一起使用的包中?



非常感谢您抽出宝贵时间回答这个问题,我对捆绑程序的功能完全不知所措。



- MAP

解决方案

将bundler视为一个包管理工具。

bundle help 命令:
$ b bundle install code>#将当前环境安装到系统中
$ b

bundle package #锁定并缓存所有gem into vendor / cache

因此 bundle install 命令会将所有gem安装到 system strong>在Gemfile中列出以及它们的依赖关系。如果以前没有安装宝石,它会从gemcutter repo中抓取宝石。 bundle package 会将.gem文件缓存到您的应用供应商/缓存目录中。



不需要先运行 gem install


I'm pretty new to Ruby/Rails but I was taking a look at bundler and was wondering how it works exactly. Do you install a full set of gems like normal gem install XYZand then use the Gemfile to pull a certain subset of those gems for use with a specific application? Or do you not install gems normally anymore and just include them in the Gemfile and then do a bundle install to include them all in a bundle that is then used with your application?

Thank you so much for taking the time to answer this, I'm just a little confused on what bundler's functionality is exactly.

-- MAP

解决方案

Think of bundler as a package management tool.

From bundle help command:

bundle install # Install the current environment to the system

bundle package # Locks and then caches all of the gems into vendor/cache

So bundle install command will install all gems to the system that are listed in Gemfile as well as their dependencies. If the gem was not previously installed it will grab it from the gemcutter repo. bundle package will cache the .gem files into your apps vendor/cache directory.

No need to run gem install first.

这篇关于捆绑机如何工作(一般)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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