What's up with the lib folder?

I noticed I have a structure like this…

…/plugins/my_engine/lib/my_engine

Inside of …/lib I also have a my_engine.rb

What’s the purpose of this? I can’t find anything on the wiki about it.

Thanks.

The structure you have is very general, since it’s most likely from
the generator. The thought is that you have a single point of
inclusion for your engine libraries, so you can simply do

require ‘my_engine’

which will load the file “my_engine/lib/my_engine.rb”. To keep things
tidy, any library code that you define should be placed in
my_engine/lib/my_engine/, but equally you might have other libraries
in my_engine/lib/whatever.

Of course, it’s totally up to you what you place in lib, and what
structure you use - the only thing that is even semi-expected is that
you have an init_engine.rb (and that’s not even necessary).

Sorry if that explanation isn’t clear, it’s quite late :slight_smile:

  • james