Hello,
Why do we have to put "rails/init.rb" into a gem and not simply
"init.rb" in main dir of a gem to make it behave like a plugin? Are
there some special reasons for that?
It would be cool to have one codebase which can be packaged as a gem
or used as a classic plugin.
On the other hand, some say (and I agree) plugins will perish in favor
of gems - maybe we just should wait, or speed this process up by
converting plugins into gems and not allowing to use them in old way
by leaving only "rails/init.rb" and deleting "init.rb" from main dir?
Cheers,
Jacek
One reason would be to provide some namespacing of the init hook for
gems that work with multiple frameworks, or have a purpose outside the
context of Rails.
-- Chad
One reason would be to provide some namespacing of the init hook for
gems that work with multiple frameworks, or have a purpose outside the
context of Rails.
-- Chad
One reason would be to provide some namespacing of the init hook for
gems that work with multiple frameworks, or have a purpose outside the
context of Rails.
Is init.rb in the main gem directory ever used by gems infrastucture?
I couldn't find any reference of that but I agree - it's more
aesthetic in rails dir and better in case of multiple frameworks.
My conclusion is to keep init.rb in both dirs: main and rails, and
make sure that only "rails/init.rb" is mentioned in gemspec, so the
generated gem will be as clean as possible.
Or make Rails look for it in either place in plugins, and only have it
in rails/init.rb for gems. I thought this was already the case, but
maybe it was just discussed and not implemented yet.
-- Chad
Or make Rails look for it in either place in plugins, and only have it
in rails/init.rb for gems. I thought this was already the case, but
maybe it was just discussed and not implemented yet.
It's the case - it was not implemented, but I had a spare moment so I
created a patch:
http://rails.lighthouseapp.com/projects/8994/tickets/272-make-plugins-also-initialize-form-rails-init-rb#ticket-272-1
You are most welcome to look at it and maybe +1 