bundle exec杂记

bundle是gem管理工具

通过Gem.bin_path来查找
bundle exec修改系统环境变量

bundle exec

bundle exec -使用bundle的上下文中执行命令

bundle exec [--keep-file-descriptors] command

描述

使用bundle exec运行命令时,默认会将gemfile文件中指定的gem加载到ruby程序中。
例如运行rspec spec/my_spec.rb时,如果想要使用Gemfile中指定的,并且通过bundle install安装的gem来执行该测试,就需要执行bundle exec rspec spec/my_spec.rb.

注意:bundle exec并不需要对$PATH进行配置。

选项

--keep-file-descriptors

在Ruby2.0之后废弃了非标准的文件描述符。设置该选项时,exec将遵循Ruby1.9的行为,将所有的文件描述符传给进程。

你可能感兴趣的:(bundle exec杂记)