[英]Add gem to gemfile with bundler from command line
When using node package manager you can specify npm install --save mynodemodule
which automatically pops the module in package.json
使用节点包管理器时,您可以指定
npm install --save mynodemodule
,它会自动弹出package.json
的模块
I was wondering if there is a command for bundler that allows you to add the gem and version to the gemfile from the command line? 我想知道是否有一个Bundler命令允许你从命令行添加gem和版本到gemfile?
For example bundle install --save nokogiri
例如
bundle install --save nokogiri
If you visit this question in 2018, bundler
now has a cli to do this: bundle add <gem-name> <version>
如果您在2018年访问此问题,
bundler
现在有一个cli来执行此操作: bundle add <gem-name> <version>
Version string could be your typical gem version including >=
and ~
版本字符串可能是您典型的宝石版本,包括
>=
和~
echo 'gem "nokogiri"' >> Gemfile
as @zocoi described, you can use bundle and specify the group: 正如@zocoi所描述的,您可以使用bundle并指定组:
bundle add rails --group "development, test"
More information 更多信息
bundle add --help
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.