Why should I use bundle exec <command> instead of just running the command? [duplicate]

可紊 提交于 2019-12-11 02:45:06

问题


Its a well known best practice to use run executables using bundle exec <command> and not just the command. But it seems like nobody could explain why its better to run executebles via bundle exec. So I ask yo why,...?


回答1:


If you are using bundle exec instead of just executing command, bundler makes some changes to your environment variable, so all gems listed in your Gemfile can be accessed successfully. You can see http://gembundler.com/man/bundle-exec.1.html . Also, bundler can install gems into custom path instead of system location and then they still will be accessible for require if you are using bundle exec. See also http://gembundler.com/man/bundle-install.1.html

So in general answer is: to isolate your set of gems from system gems and to make them available for you application in case of custom gem location.



来源:https://stackoverflow.com/questions/8890994/why-should-i-use-bundle-exec-command-instead-of-just-running-the-command

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