How to uninstall all gems installed using `bundle install`

后端 未结 10 1862
情歌与酒
情歌与酒 2020-12-23 17:09

How can I remove all the gems installed using bundle install in a particular RoR project. I don\'t want to uninstall gems that are used by other projects.

10条回答
  •  时光说笑
    2020-12-23 18:01

    Since we're using ruby you could do something like this I guess:

    bundle list | ruby -e 'ARGF.readlines[1..-1].each {|l| g = l.split(" ");  puts "Removing #{g[1]}"; `gem uninstall --force #{g[1]} -v #{g[2].gsub(/\(|\)/, "")}`; }'
    

    NOTE: Only lightly tested.

提交回复
热议问题