开发者

How to use RVM to uninstall all gem inside a gemset except rails?

How to uninstall all gem inside 开发者_运维知识库a gemset expect rails?


Doing this would be a bad idea.
Rails depends on several gems (it is, in fact, several gems itself).
Therefore, you're going to remove rails' dependencies and won't be able to run it anymore (and as rubygems is smart, it'll remove rails at the same time than the dependencies).

The best way would therefore to remove the gemset.

rvm gemset delete <your gemset>

Then to recreate it and install rails

rvm gemset create <your gemset>
gem install rails


Maybe you can use something like this. Use your gemset rvm use 1.9.2@gemset Then enter this code.

gem list | grep -v rails | awk '{print $1}' | xargs echo

It will print every gem installed. If it is ok then you can replace 'echo' with the gem uninstall comment. I did not tested it, so be carefull.

But it is better to uninstall all gems and install rails again, because of the dependencies. With this code, the dependencies are broken.


If you go into Gemfile.lock you can get a definitive list of which gems the Rails system relies on. You have to be very careful doing this but you should be able to remove the ones that aren't nested under the main Rails gem.

Please note two things: going this direction may result in significant things being missing. I use 3.0.3 so I don't know if my response carries over to 3.1 or even things before 3.0.

I agree with the other posters that the best way to go is clean house and just reinstall Rails. It's not that painful. A clean rvm gemset is likely the best approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜