[Rubygems-developers] Getting at non-lib dirs in gem (like datadir)
TRANS
transfire at gmail.com
Wed Mar 29 21:26:11 EST 2006
Could these be added to the Gems module?
# Queries useful for getting to non-lib files in a distribution.
def active?(gemname)
@loaded_specs ||= Hash.new
@loaded_specs.key? gemname
end
def gemspec(gemname)
@loaded_specs[gemname] if active?(gemname)
end
def gempath(gemname)
@loaded_specs[gemname].full_gem_path if active?(gemname)
end
def gemdir(gemname, dir)
if active?(gemname)
File.join(gempath, dir)
end
end
The offer a solution to the data/ dir problem. I.e.
DATADIR = Gem.gemdir( 'calibre', 'data/calibre/units' )
Thanks.
More information about the Rubygems-developers
mailing list