Question

I'm considering developing aspects of a website as Rails plugins for reuse. My question is about the development process. Since each of these plugins will provide a "slice" of functionality, should I develop each "slice" as it's own application and then extract the code from each application into a plugin? Or, should I write them as plugins right in an application? Ultimately I will be linking to these plugins from each site to keep it DRY.

I guess the main question is what would be the development process for creating multiple "Engine" type plugins?

Thanks in advance for any help.

Was it helpful?

Solution

Either approach is valid.

When writing a basic plugin I usually find it easier to write it in tandem with the application that will use it. Because I find it easier to design/test around something that already exists.

However, when it comes to Engine plugins, I prefer to develop them as a separate application and then rip out all the unnecessary bits when I move it into a plugin. They are in essence mini applications, and they should be completely functional when installed on a freshly created rails project.

By designing them as their own application I'm ensuring proper compartmentalization. This ensures that I'm not accidentally referring to code models/controllers/views/helpers that are not a part of the engine I'm developing.

If you're developing multiple engine type plugins this way, you might want to condense a few of the steps with a utility script. Such as one that streamlines the process of turning an application into an Engine plugin.

It should restructure your app as necessary and populate the files that plugins should have, such as init.rb.

OTHER TIPS

You might want to give a look to Desert framework as well .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top