user142019
user142019

Reputation:

How to check if a RubyGem is installed already?

I am writing an application for Mac OS X. It is a Cocoa application. Can I check if a specific RubyGem is installed from Cocoa, do I need to use NSTask or should I use the Ruby framework?

What is the best way to check this?

Upvotes: 4

Views: 1122

Answers (1)

Chris Cherry
Chris Cherry

Reputation: 28554

Depending what the reason is for checking for the gem, it seems like it might be a good idea to shell out to a script you bundle with your application. Then have that script check for you. That way you can be sure to access the gem environment in a way that is as close as possible (or even identical) to the way the user will.

Using code like what Has Engel posted in that other SO thread looks like a good way to do it once you are out in the shell.

Upvotes: 1

Related Questions