Automatically Restart script/server For Easier Plugin Development with FSEvents

When developing a Rails plugin, you are required to restart the server so that your plugin will be reloaded. You’ll notice that after a while this becomes a rather tedious process, especially if you are working on a hot-off-the-press new plugin.

Following suit on my autotest with FSEvents, I opted to listen for any changes to the vendor/plugins and lib directories to restart the server as required. Thus freeing me of the horrible grunt work of restarting the server.

Note: This is Mac OS X 10.5 Leopard specific.

The Incantation

Create the required file script/autorestart_server, and put this beauty in it.

For an easy to copy dump, click “view plain“.

Note: Don’t forget to make it executable! chmod u+x script/autorestart_server Terminal

Automatically Restarting script/server

Now feel free to execute script/autorestart_server Terminal

Wondering where else I can inject FSEvents into, its quite a handy little tool…

1 Comment »

  1. Mr eel said,

    December 18, 2007 @ 10:44 am

    You can actually just use the require_dependency method within one of your own source files. For example at the top of your controller. The specified plugin will then also be reloaded along with the controller.

    for example:

    require_dependency ‘acts_as_ferret’

RSS feed for comments on this post · TrackBack URI

Leave a Comment