使用命令行中的bundler将gem添加到gemfile中

时间:2021-11-19 00:18:47

When using node package manager you can specify npm install --save mynodemodule which automatically pops the module in package.json

使用节点包管理器时,可以指定npm安装——保存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

例如,捆绑安装——保存nokogiri

3 个解决方案

#1


6  

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

Version string could be your typical gem version including >= and ~

版本字符串可以是典型的gem版本,包括>=和~

#2


45  

Just wrote Gemrat to do this.

就写给Gemrat来做这个。

    $ gem install gemrat 
    $ gemrat nokogiri

    #=> gem 'nokogiri', '1.6.0' added to your Gemfile.
    #=> Bundling...

#3


23  

echo 'gem "nokogiri"' >> Gemfile

#1


6  

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

Version string could be your typical gem version including >= and ~

版本字符串可以是典型的gem版本,包括>=和~

#2


45  

Just wrote Gemrat to do this.

就写给Gemrat来做这个。

    $ gem install gemrat 
    $ gemrat nokogiri

    #=> gem 'nokogiri', '1.6.0' added to your Gemfile.
    #=> Bundling...

#3


23  

echo 'gem "nokogiri"' >> Gemfile