Useful methods for RubyGems

T

Trans

Please, could these be added to the next version of Gems?

module Gem

# Is gem active?
def active?(gemname)
@loaded_specs ||= Hash.new
@loaded_specs.key? gemname
end

# Return gemspec of active gem
def gemspec(gemname)
@loaded_specs[gemname] if active?(gemname)
end

# Return path of active gem
def gempath(gemname)
@loaded_specs[gemname].full_gem_path if active?(gemname)
end

end

I use this to get data files like so:

DATADIR = File.join(Gem.gempath('calibre'), 'data', 'calibre',
'units')

Thanks,
T.
 
J

Jeffrey Dik

Wouldn't this be better off sent to the rubygems-developers mailing
list?

Hope that helps,
Jeff
 
T

Trans

True. True. I just don't want to subscribe to the list. But maybe a
message will get thru w/o me subscribing. I'll try that.

Thanks,
T.
 
A

Austin Ziegler

T24gMy8xNC8wNiwgVHJhbnMgPHRyYW5zZmlyZUBnbWFpbC5jb20+IHdyb3RlOgo+IFBsZWFzZSwg
Y291bGQgdGhlc2UgYmUgYWRkZWQgdG8gdGhlIG5leHQgdmVyc2lvbiBvZiBHZW1zPwoKV2h5IG5v
dCBzdWJtaXQgYSBmZWF0dXJlIHJlcXVlc3Qgb24gUnVieUZvcmdlPwoKLWF1c3RpbgotLQpBdXN0
aW4gWmllZ2xlciAqIGhhbG9zdGF0dWVAZ21haWwuY29tCiAgICAgICAgICAgICAgICogQWx0ZXJu
YXRlOiBhdXN0aW5AaGFsb3N0YXR1ZS5jYQo=
 
T

Trans

Thanks Austin.

Unfortunately, from the looks of it, there's absolutely no follow-up to
those postings. Of course, so far, there seems to absolutely no follow
up. Well, I'll try to be patient and hopefully hear back eventually.

Thanks,
T.

(hmm... maybe Gems could use a boost of spirit. Here's a thought. Might
Gems ultimately morph into a general purpose package manager, suitable
to any project no matter the language involved? Maybe one of those
other killer apps Ruby needs.)
 
P

Paul Robinson

(hmm... maybe Gems could use a boost of spirit. Here's a thought.
Might
Gems ultimately morph into a general purpose package manager, suitable
to any project no matter the language involved? Maybe one of those
other killer apps Ruby needs.)

Well, FreeBSD has /usr/ports and that gets really useful if you run
portupgrade from time to time. Wonder what that is written in... oh
yeah, Ruby! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top