After I posted my last entry I was chatting with Louie about it and he helped me realize it might be a good job for a generator. Having never created a plugin nor a generator before, I had some learnin’ to do. Well, that learnin’ happened. You can reap the benefits via

./script/plugin install http://briantcooke.com/svn/plugins/uptime_generator/

Then run:

./script/generate uptime_controller

Your app should now respond to /success.txt.

At this point you could deploy and point your favorite uptime svc at that URL, or you could open uptime_controller.rb and make the ‘success’ method more robust.

Enjoy!


Useful resources:

Explanation on creating a generator: http://wiki.rubyonrails.org/rails/pages/UnderstandingGenerators

Example generator: http://topfunky.net/svn/plugins/topfunky_power_tools/

I also peeked at the scaffold_resource generator from rails proper.

Leave a Reply