Plugins, Generators and Updates


#1

Hi all,

I am writing a plugin that we plan to use on some future websites we are
building. My question is more of a poll of everyone’s preferences on
the deployment of a plugin. I am at the point now where I have to
decide if this plugin should use a generator to copy all the necessary
files into the rails application (models, migrations, etc.) or if I
should keep all the plugin files contained in the plugin folder.

I am leaning towards the generator approach, like acts_as_authenticated,
but I can’t find any information as to what happens when I update the
plugin. If all the files have been copied over to the application what
is the best way to update those files? Do I use the generator to copy
the new files and overwrite the existing? For the models this seems
fine, but what about migrations? How would i know which migrations need
to be copied over and which don’t?

I have been having trouble finding a lot of information to this topic so
any help would be appreciated. Thanks.

Peer


#2

Peer A. wrote:

I am leaning towards the generator approach, like acts_as_authenticated,
but I can’t find any information as to what happens when I update the
plugin. If all the files have been copied over to the application what
is the best way to update those files? Do I use the generator to copy
the new files and overwrite the existing? For the models this seems
fine, but what about migrations? How would i know which migrations need
to be copied over and which don’t?

Take a look at the “engine” plugin. It provides a higher-level interface
than the base plugin system provides handling issues of mixin
functionality between plugin and application, copying of resources and
migrations.

You can always do it yourself with the base plugin system but why spend
the time. The “engine” plugin gives you a higher-level interface
allowing you to focus on the functionality of your plugin instead of
low-level mechanics.

Eric