Uninstall Rails 3 with dependencies?

2019-03-19 06:42发布

I like that Rails 3 is so easy to install: gem install rails --pre, and all of the dependencies are automatically installed for you. But, what about uninstalling it? If I just do gem uninstall rails, I still have

actionmailer (3.0.0.beta3)
actionpack (3.0.0.beta3)
activemodel (3.0.0.beta3)
activerecord (3.0.0.beta3)
activeresource (3.0.0.beta3)
activesupport (3.0.0.beta3)

which I want to get rid of. What's the easiest way to do so?

4条回答
甜甜的少女心
2楼-- · 2019-03-19 06:54

Look at deps(optional):

gem dependency rails -v=3.0.9

Then uninstall all components of the version specified:

gem uninstall actionmailer actionpack activerecord activesupport acriveresource rails -v=3.0.9
查看更多
欢心
3楼-- · 2019-03-19 07:01

Check your currently installed version(s):

gem list -d rails

Then uninstall the version(s) you don't want:

sudo gem uninstall rails -v 3.0.0.beta3
sudo gem uninstall actionmailer -v 3.0.0.beta3

etc.

I'm still trying to figure out how to completely remove rails 3.0.0.beta3 and all its deps.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-03-19 07:04

if you're planning to upgrade to a newer version of rails, you can do:

sudo gem clean

or in newer versions

sudo gem cleanup

after the newer version has been installed, this uninstall All older versions of All your gems leaving only the latest version in your system.

Note: these days I use RVM gemset and/or bundler to manage my gems, if you're using RVM I find it's a lot simpler this way. For example you can create a new gemset for each project:

rvm gemset create project_name
rvm gemset use project_name
bundle install

anything goes wrong you can just delete the gemset and start again

rvm gemset delete project_name
查看更多
三岁会撩人
5楼-- · 2019-03-19 07:11

I found this excellent post on removing all Ruby Gems by Ken Nordquist: http://geekystuff.net/2009/01/14/remove-all-ruby-gems/

The command uses pipes to iteratively push a gem list to the uninstall utility. Here is the command:

'gem list | cut -d" " -f1 | xargs gem uninstall -aIx'

It successfully removed all gems except the following which appear to be permanent fixtures on my Mac:

minitest (1.6.0) rake (0.8.7) rdoc (2.5.8)

查看更多
登录 后发表回答