This is a pretty big topic, and I haven't found a good all-in-one
resource either, but after a few days of poking around and re-reading
articles, I've just started to componentize core libs I use in my apps
as well.
First, as for the path overrides, no need to inject paths yourself.
Rails will look in certain places if you provide those places. You tried
using /lib, but the correct place is in /vendor/plugins. Rails will look
inside all /vendor/plugins/{WHATEVER}/app/views folders. So you were
close. Don't bother with the path shift business.
Making a plugin is as simple as using the rails generator, but making
engines requires a slightly different organization of the files. This is
a good place to start, but there's some out of date info. The /rails
folder inside the plugin that the article suggests making is obsolete.
http://guides.rubyonrails.org/plugins.html#organize-your-files
As for creating proper Rails3 engines, these are the links that I went
round and round with until it started to make sense:
https://gist.github.com/e139fa787aa882c0aa9c
http://www.themodestrubyist.com/2010/03/01/rails-3-plugins---part-1---the-big-picture/
http://www.themodestrubyist.com/2010/03/05/rails-3-plugins---part-2---writing-an-engine/
http://github.com/krschacht/rails_3_engine_demo
After that you start making your engines and plugins into gem, and they
become even easierto use in multiple projects.
Hope that gives you a some help.
-- gw
--
Posted via http://www.ruby-forum.com/.
The one advantage I found of putting your shared resource into a plugin
and storing in vendor/plugins is that while you're editing the project
it's easy to peek into that directory to figure out what view you want
to override. It's really part of the same codebase whereas when it's
packaged in a gem, it's usually a whole separate project (and separate
repo) so it can be an extra step in your workflow to reference the
resource's code.
But that advantage is also it's disadvantage. By packaging your plugin
into a full engine and packaging up as a gem, you get two advantages:
gems are easier to share across projects, it's easier to manage versions
(you can specify the exact gem version you want in your gemfile), and
they're easier to distribute if you want to share them with others.
-Keith
--
Posted via http://www.ruby-forum.com/.