We need to execute any code that plugins will need to hook into before the Rails initialize block in config/environment.rb (at the top of the file).
Ansuz::PluginManager will have an attr_accessor :plugins, and each Ansuz plugin will need to register itself.
A plugin will provide modules. Each Frontend module will need an associated Backend module. For instance, a ContentSection will have a base Frontend module that just renders the ContentSection on the page, and an associated Backend module that allows one to modify the content.
A plugin’s registration in init.rb could look something like this:
# this registers a page_plugin, not a great method name Ansuz::PluginManager.register_plugin(Ansuz::Plugins::JAdams::ContentSection) # this registers a nav entry in the user-facing ansuz menu. This will change, to # registering a potential 'special' entry in the ansuz menu system. Ansuz::PluginManagerInstance.register_plugin_nav('Blog', '/articles') # this registers an entry in the 'Content' menu in the admin, to handle the blog # administration Ansuz::PluginManagerInstance.register_admin_menu_entry( 'Content', 'Blog > All Posts', '/admin/blog_posts' ) # this adds an entry to create a new post from the admin menu Ansuz::PluginManagerInstance.register_admin_menu_entry( 'Content', 'Blog > New Post', '/admin/blog_posts/new' )
…where Ansuz::Plugins::JAdams::ContentSection defines its Frontend modules and their related Backend modules.