How does bundler work (in general)?

六眼飞鱼酱① 提交于 2019-12-10 00:51:19

问题


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


回答1:


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.




回答2:


These two links explain everything about bundler.

  • How does bundler bundle

  • How does bundle require gems



来源:https://stackoverflow.com/questions/3058286/how-does-bundler-work-in-general

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!