On Dec 20, 6:28 pm, Josh
<josh.m.sha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I would like to get a list of the paths of configured gems.
>
> A list of gem dependencies can be found by:
>
> Rails.configuration.gems
>
> ...which returns a bunch of Rails::GemDependency but I can''t
figure
> out how to get a path to the root of the gem.
If you''ve got a Rails::GemDependency object, you can grab the
specification and get the path you''re looking for:
@gem_dep.specification.full_gem_path
This will work on both vendor and system gems.
> For what it''s worth, I''m trying to hack something that
will auto-load
> rake tasks from configured gems.
Note that this is a consistent issue with the 2.x gem loader; there
are a number of tickets along the same lines:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/59
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2728
The ultimate problem is that Rake doesn''t (by default) actually load
the Rails environment (tasks can, by specifying a dependency on
the :environment task). So the gems aren''t "configured" by
default.
The same problem pops up when trying to load generators from vendor/
gems.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.