Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
647 views
in Technique[技术] by (71.8m points)

ruby on rails - Do I have to manually uninstall all dependent gems?

I tried to uninstall datamapper using the command gem uninstall dm-core.

But it seems that a whole bunch of dependent gems also need to be uninstalled.

C:>gem uninstall dm-core

You have requested to uninstall the gem:
        dm-core-0.9.11
dm-migrations-0.9.11 depends on [dm-core (= 0.9.11)]
dm-cli-0.9.11 depends on [dm-core (= 0.9.11)]
dm-serializer-0.9.11 depends on [dm-core (= 0.9.11)]
dm-timestamps-0.9.11 depends on [dm-core (= 0.9.11)]
dm-aggregates-0.9.11 depends on [dm-core (= 0.9.11)]
dm-types-0.9.11 depends on [dm-core (= 0.9.11)]
dm-is-tree-0.9.11 depends on [dm-core (= 0.9.11)]
dm-observer-0.9.11 depends on [dm-core (= 0.9.11)]
dm-validations-0.9.11 depends on [dm-core (= 0.9.11)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  n
ERROR:  While executing gem ... (Gem::DependencyRemovalException)
    Uninstallation aborted due to dependent gem(s)

I tried finding documentation on "gem uninstall" but there doesn't seem to be a way to uninstall the dependencies automatically:

C:>gem help uninstall
Usage: gem uninstall GEMNAME [GEMNAME ...] [options]

  Options:
    -a, --[no-]all                   Uninstall all matching versions
    -I, --[no-]ignore-dependencies   Ignore dependency requirements while
                                     uninstalling
    -x, --[no-]executables           Uninstall applicable executables with
out
                                     confirmation
    -i, --install-dir DIR            Directory to uninstall gem from
    -n, --bindir DIR                 Directory to remove binaries from
        --[no-]user-install          Uninstall from user's home directory
                                     in addition to GEM_HOME.
    -v, --version VERSION            Specify version of gem to uninstall
        --platform PLATFORM          Specify the platform of gem to uninst
all

  Common Options:
    -h, --help                       Get help on this command
    -V, --[no-]verbose               Set the verbose level of output
    -q, --quiet                      Silence commands
        --config-file FILE           Use this config file instead of defau
lt
        --backtrace                  Show stack backtrace on errors
        --debug                      Turn on Ruby debugging


  Arguments:
    GEMNAME       name of gem to uninstall

  Summary:
    Uninstall gems from the local repository

  Defaults:
    --version '>= 0' --no-force --install-dir C:/Ruby18/lib/ruby/gems/1.8
    --user-install

C:>

Am I missing something?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

gem list | cut -d" " -f1 | xargs gem uninstall -aIx deletes all installed ruby gems!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...