'捆绑安装'是否将我所有计算机上的所有宝石永久安装? [英] Does 'bundle install' install all the required gems on my computer permanently?

查看:135
本文介绍了'捆绑安装'是否将我所有计算机上的所有宝石永久安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Rails新手,正在学习捆绑器。我知道 bundle install 会安装gemfile中指定的所有gem,但是它将它们安装到哪里?



它将它们永久安装在我的电脑上,以便它们可以被任何未来的项目使用?



如果是这样,那么这意味着我的电脑会被填充随机宝石版本和gem安装,我需要一个示例项目但可能永远不会再使用它?

解决方案

默认情况下, bundle install 将在根目录级别安装,电脑可以访问宝石。所以'是'它是永久性的(至少与您的应用程序无关,您可以随时删除它们)。



请查看手册页捆绑。在这里,你会注意到你可以指定安装到本地目录。


将您的依赖关系,甚至是已经安装到系统宝石中的gem安装到系统的gem
仓库以外的位置。在这种情况下,将它们安装到供应商/软件包。

$ bundle install --path vendor / bundle

进一步的Bundle命令或调用Bundler.setup或Bundler.require
将会记住这个位置。

这会让你安装将宝石移动到您的应用程序中的位置。因此,当您删除示例应用程序时,您也会删除关联的宝石。

另外,如果您想查看特定gem的安装位置(例如您想查看其源代码),请键入 bundle show < gemname> 。这将吐出通往那颗宝石的路径。


I am new to rails and am learning about bundler. I understand that bundle install installs all the gems specified in the gemfile but where does it install them to?

Does it install them on my computer permanently so that they can be used by any future project?

If so doesnt this mean my computer gets filled with random gem versions and gem installs that I needed for one example project but may never use again?

解决方案

By default, bundle install is going to install at the root level so all users on a computer could have access to the gems. So 'yes' it is permanent (at least not tied to your application, you can remove them whenever you want).

Take a look at the man pages for bundler. In here, you'll notice that you can specify to install to a local directory.

Install your dependencies, even gems that are already installed to your system gems, to a location other than your system's gem repository. In this case, install them to vendor/bundle.

$ bundle install --path vendor/bundle

Further bundle commands or calls to Bundler.setup or Bundler.require will remember this location.

This will let you install the gems to a location inside your application. So when you delete the example app, you also delete the associated gems.

Also, if you would like to see where a specific gem is installed (say you want to look at its source code), type bundle show <gemname>. This will spit out the path to that gem.

这篇关于'捆绑安装'是否将我所有计算机上的所有宝石永久安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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