开发者

How to check if a RubyGem is installed already?

开发者 https://www.devze.com 2023-02-22 02:56 出处:网络
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?

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开发者_JAVA百科?


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.

0

精彩评论

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