Posted on 7/8/06 by Felix Geisendörfer
The authors of this post have marked it as deprecated. This means the information displayed is most likely outdated, inaccurate, boring or a combination of all three.
Policy: We never delete deprecated posts, but they are not listed in our categories or show up in the search anymore.
I'm currently reading The Pragmatic Programmer (shame on me for not having that done earlier). One of the many advices in the book includes to make more use of the console if possible. Now I'm on Windows - there is no console one would really want to use - so I got myself a fresh copy of cygwin and started playing around with it.
I have to admit, I'm very impressed so far. I've never really gotten into *nix systems, not because I wasn't interested, but because I was already very familiar with Windows and hated not being able to do all the things I already knew how to do on Win32 in Linux.
Anyway, now that my bash scripting skills are slowly building up, I'm very exited about the cool things I could do with it from now on. Especially when it comes to automate the most annoying taks in my coding cycle. This especially includes keeping my development and production enviornments in sync (ftp, mysql, etc.), updating existing projects to the latest cakephp version, validating xhtml/css, running unit/integrational tests, and so on.
What totally amazes me, is how much of that can actually be automated and done better then I usally do it by hand. Let's just take updating CakePHP for example: I usally go to cakephp.org and download a nightly. Then I unpack the nightly, and take all files except the /app folder out of it, and overwrite my current project. Doesn't take too long, but it's really the very same process over and over and over again. And in case something in the /app folder changed, I'll have to manually find out what. Now imagine the same thing to work like this:
/$ project develco
Looking for Project "develco" ... Project found in: /www/develco - develco is now your active Project
Checking for newer version Latest CakePHP Version is: 3382 Project develco's Version is: 3275 Do you want to (u)pdate, (s)ee the changelog, or (c)ancel?
Applying diff Patch, please wait ... Update complete.
Now the fun part is, that coding this, is actually not that difficult, and you even get a patch from svn instead of lousy file replacement. And things like finding the current CakePHP version from the SVN repository can be done in one line of code:
echo p | svn info https://svn.cakephp.org/repo/branches/1.1.x.x | grep "Last Changed Rev: ([0-9].+)" -oP | grep "[0-9]+" -oP
(the echo p | is used to (p)ermantly accept the uncertified session you get when connecting to cakephp's svn server).
But to be honest, it's not really the time savings I'm after. Writing all of those scripts will probably take up several hours (some of it is already done). But what it will do, is to take away all those annoying tasks I have to do over and over again, which I hope will improve my behaviors. Just take testing for example. It's like cleaning up your desk, you should be doing it, things will get lost / go wrong if you don't, and you'll have a better feeling after you did it. Now cleaning up your desk will always remain a little annoyance, but what you want, is to get as little resistance in between you, and cleaning up your desk. Which means: Make testing as easy an comfortable as possible.
Alright, enough enthusiasm: What do you guys think? Does it makes sense to automate all this tasks I mentioned? What kind of tasks have you automated so far? I'm interested in hearing it all ; ).
--Felix Geisendörfer aka the_undefined
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.