The other day, while waiting for another computer reboot or something similar, I grabbed
The Pragmatic Programmer from the shelf. I already read the book, so I was just quickly browsing the
tips in the book when I found this one: "Automate Everything". (you can find it by looking for "Don't Use Manual Procedures" in the previous link).
I already do this at work, but I started thinking it would be a really good idea to start applying this principle to my home projects. Take my
sister's in law website. Here's the procedure I use to upload it to the server:
- Open googleanalytics.txt and copy the contents
- Open pageend.php and paste googleanalytics.txt content
- Open gFTP
- Open KeePassX to fetch the site's password
- Use gFTP to transfer some of the directories in the development folder (this actually counts as about 10 steps!)
- Check if I didn't make a mistake in the gFTP 10 steps!
- Open pageend.php and remove googleanalytics.txt content
Some notes on these procedures: I never did steps 1, 2 and 7. It was too much work so I never actually got
Google Analytics to work until yesterday. I'm not kidding about step 5 being about 10 steps... I actually uploaded the folders one by one to make sure I got all the right files and that the .svn folders weren't copied. This may seem rather stupid, but since I executed this procedure about once a month it wasn't really a problem, just a nuisance.
Still I decided to automate everything. I did a shell script and right now I have a one step procedure to upload the site:
- Run ./publish.sh
And what did I gain with this 2 hour or so investment?
- I learned more about bash programming
- I learned how sed works
- I learned about wput
- I got Google Analytics working on the website
- I'll be doing no more mistakes while uploading the site
- I can make small changes to the site without thinking about the dreaded upload process
- I feel like a better geek! :)
1 comment:
Have you tried rsync with ssh?
Simply send your ssh public key to the remote server, then rsync everything over:
rsync -avile 'ssh' allthisstuff/* username@removeserver.org:~
Post a Comment