[Rubygems-developers] Getting at non-lib dirs in gem (like datadir)

TRANS transfire at gmail.com
Thu Mar 30 19:18:14 EST 2006


On 3/29/06, TRANS <transfire at gmail.com> wrote:
> 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

ASctually, that last one should be:

     def gemdir(gemname, dir)
       if active?(gemname)
         File.join(gempath(gemname), dir)
        end
     end

T.



More information about the Rubygems-developers mailing list