How to check if RubyGem is already installed?

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

What is the best way to test this?

+4
source share
1 answer

Depending on the reason for checking for the gem, it seems that it would be nice to lay out a package with your application on the script. Then check the script. Thus, you can be sure that access to the gem environment will be as close as possible (or even identical) to the user's method.

Using code similar to what Engel posted on this other SO thread seems like a good way to do this when you are in a shell.

+1
source

Source: https://habr.com/ru/post/1346576/


All Articles