Plugin Initialization


I was curious if there was a more appropriate way to execute a “one-
time” initialization of a plugin–

Basically, I’ve created a plugin that utilizes a javascript file-- I
want to copy this j/s file into the public/javascripts/ directory
immediately upon adding it your project.

Is there a standard mechanism for doing this?

Unless someone has a better idea, my approach was going to be to write
code in init.rb that checks to see if these files already exist in the
public directory, and if not, to copy them in (from within the plugin
directory structure).

Anyone got a better idea?


IIRC, you can have install.rb in your plugin which will be run when
someone does script/plugin install

But of course, it won’t work if someone just copies the plugin or use
piston/svn directly.

On 9/17/07, John T. [email protected] wrote:

Is there a standard mechanism for doing this?


Thanks for the response. Yeah, we’re using Piston here to manage our
plugins, and that was certainly a concern of mine (no initialization,
that is).

I guess I could just do both (install.rb and init.rb)!