Saturday, June 13, 2009

project's webpage updates automation

Currently I'm reading "The Pragmatic Programmer: From Journeyman to Master" book. And while its contents seem quite obvious and natural to me, by repeating "DRY/automate things" stuff again and again it forces my mind to re-think about possible ways of automation of various aspects of my activity.

I have a number of small projects, which are not very popular, but I prefer to keep a page for them just in case if they will be useful for somebody. However, I never liked updating web-sites because it's boring (like: ftp or ssh, edit files, re-check, edit again, you know). So after reading this book I decided to try to automate that too. Recently I moved my small pymgsrc project - a command line client for photo hosting - to github and wrote a simple script for the website update. The way it works is:

- Build a release distfile
- Load template for website (single html) page, replace %%VERSION%% with actual version (in order to update download links and info about the latest version available) and replace %%CHANGELOG%% with HTMLfied (using simple sed expression) ChangeLog entires
- scp resulting distfile and webpage to the hosting
- Viola, all done! Using only one command.

I'm very pleased with the script and that I don't have to bother with HTML editing anymore, at least while I didn't decide to alter template.

I guess the hardest part of the automation is to find pieces of work which could be automated, because sometimes you do stuff and don't understand that it could be automated, but when you finally automated it it starts to look pretty natural and you wonder why you haven't noticed it earlier.

No comments:

Post a Comment