Tom Cloyd
1/16/2009 5:40:00 PM
Aaron Smith wrote:
Hey Tom, Thanks, that information is definitely what I'm looking for.
How would I get that info from within a ruby script. Specifically the
"GEM PATH" is what I would need. Is there a method to get that?
or rather, the "INSTALLATION DIRECTORY."
===========================
If you had any idea how paltry my knowledge of Ruby really is you would
ask me such questions! But...I got us this far, so...
I think I'd try a system call to "gem env", and put the output in a
string, then locate "INSTALLATION DIRECTORY:" with StringScanner, and
take everything after that, up to the EOL as the path you're after.
Easy, actually.
Only I'm momentarily stumped as to how to make the system call AND
capture the output. Thomas (Pickaxe 2) says it can be done using
backtics. I tried it in irb and got nothing. Still trying to figure it
out. It'd be a good trick to know.
t.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~