The power of the command line

I’ve got a rather interesting task to accomplish. We have a staging web server where multiple web editors are making changes to static files. There is also a web publisher that has to sort through all of the changes and then commit the proper changes to cvs so that they can be pushed to the live site. The problem is that the web publisher’s skill level is not quite up to managing command line cvs with large scale diffs and tagging. So, the proposed answer was to pull the htdocs dir from the server down to his laptop to so that he can use the graphical cvs tools from eclipse to manage tagging and committing changes.

At first glance it’s pretty simple to set up a project in eclipse and just use rsync to pull the dir down to local and then manage with cvs. The first pass at the command to accomplish this was:

rsync -zva –delete -e ssh server:/htdocs /localDir

This worked great at first until I noticed that after the initial checkin the CVS dirs were getting deleted. A quick check of the man page showed a very helpful param -C that tells rsync to ignore anything that cvs would ignore. So now the command was:

rsync -zvaC –delete -e ssh server:/htdocs /localDir

This worked better as all of the cvs dirs were left untouched. A new problem became apparent though in that all of the timestamps, users, and permissions were getting changed because of the -a param. This isn’t the behavior that we wanted so the next try was:

rsync -zvCrl –delete -e ssh server:/htdocs /localDir

This didn’t completely solve the timestamp issues since rsync was still updating the timestamps locally even though the files hadn’t changed. There is a way to get around this. With eclipse’s cvs tool to Synchronize there is an option to Clean Timestamps which will set things right again, but it requires a complete compare of the cvs repository which can take awhile on a slow connection. So another version of the rsync command is:

rsync -zvCrl –size-only –delete -e ssh server:/htdocs /localDir

This only updates files if their sizes are different which will work for most html edits. We’re going to have to test if this is sufficient to catch the changes or if we have to go back to the previous option and Clean Timestamps.

What’s really amazing though is how specific you can get with this incredibly efficient method of syncing files with only a few command line parameters. I’m not aware of any other utilities that could handle the sync this easily, just a reading of the manpage and a little trial and error to get it right.

How much documentation?

Working for a startup, there has been some pull back and forth on how much documentation is the right amount.

Over documentation is often a problem with large companies. So much process is required to get the most basic things done that it’s next to impossible to get anything out of the ordinary accomplished. This slows the pace of development and creativity. The company I work for is not a big company and there just aren’t enough resources to thouroughly document everything even if we wanted to. Even if we had the resources over documentation would be the beginning of a slow and painful death for the company.

The other end of the spectrum is complete seat of the pants no documentation. This is more often the case with a startup, there just isn’t time to write everything down. Why bother when you could be doing instead of writing about doing. This can lead to confusion and chaos though if there isn’t strong leadership to keep everyone moving in the same direction.

My theory on the matter I’ll call the “One Week Meeting Rule”. The requirement is that a group should be able to sit down and discuss plans for work and have everyone come to agreement. Then one week later sit down and test whether everyone still agrees on the same things. This isn’t about whether changes have been made and agreed to in the interim, but whether what everyone thought they had agreed to is still in sync after a set period of time. As people go about their business during the week and things are discussed, is everyone still moving in the same direction at the end of the week or is it more of a brownian motion effect?

The makeup of the group will have a very large impact in determining how much documentation is required. Without this simple little test it’s almost impossible for people to work together. If the basics can’t be agreed upon then documentation is required to cement what those agreements were and reinforce the decisions made.