문제

I must be missing something because last night I was astonished to find that googling for check gem dependencies and similar didn't reveal the answer for this.

I'm basically after a rough equivalent of rpm -V - a command that will go through some or all my installed gems and make sure that their dependencies are also installed. Since gem install by default installs any dependent gems, normally this is not necessary; however, if you gem uninstall a gem and tell it to proceed with the uninstall even though other gems depend on the one being uninstalled, then obviously you will end up with broken dependencies. The question is, how do you then list those broken dependencies without installing / uninstalling / updating any gems?

N.B. answers which involve Bundler are not much use to me, since I'm still stuck on Rails 2.x for various reasons.

도움이 되었습니까?

해결책

I know you said you weren't interested in answers about Bundler, but…

Bundler will handle gem dependency resolution for you and is compatible with Rails 2.3. I've used Bundler with a number of Rails 2 apps and not had any problems with it.

There are instructions for installing Bundler on Rails 2.3 here: http://gembundler.com/rails23.html

다른 팁

in the bash shell:

gem list --no-version > list
gem dependency --pipe > depends
grep -v -f list depends > failed.txt
rm list
rm depends

failed.txt will now have a list of all dependencies that are not installed.

Have you tried running gem update? That will run all the dependency tests for all of your gems. You can run this to install into a separate directory.

[edit] Also, what happens when you run gem check? gem dependency will list all gem dependencies. I'm pretty sure that if it doesn't tell you whether something is installed, you could pipe the output to a command like check to see if those gems are installed. [/edit]

I definitely agree with switching to Bundler for applications. If you happen to be looking explicitly for a way to quickly identify unsatisfied gem dependencies for installed gems on a system (like I was), then you might give this script a try.

https://gist.github.com/1124953

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top