Wednesday, August 27, 2008

Web Coding - Fun with Subversion

WINDOWS Subversion usage for casual Web-Coding team environment

Okay. This is going to be a terse walkthrough in how to set up a version-control
work environment for the web design/coding&UI teams.

Setting: Usually nowadays the trend is that there is a design team and a coding team, not to mention a web-dev team.

Normally, the workflow starts from the PM (P stands for what I dunno.. production? project?)s that think of what needs to be developed. Designers get sent the raw material and the design barebone layout and start working their magic to turn something with lines to something with graphics.

The UI/Code team gets this and implements the actual HTML version of the normally graphic
format of PSD files.

A couple revisions at this step, and the coded page is worthy of passing on the developers, where it actually gets implemented into Internet-ready pages.

Problem: Too many versions of the same thing.

Let me explain how our company's workflow is:
  1. They give me the design. I code.
  2. I put the finished code for review into the networked drive. So, I have to manage 2 copies.
  3. Then again, some things are different for the actual deploy version of the code. So I copy again into another folder. 3 copies.
  4. If the developers put them on the servers, that also is counted, so 4 copies.
If changes need to be made, I have to change my source code for testing, overwrite the copies on the networked drives for other members to test, AND update it to the server.
Do you know how long this takes? 40 minutes.
Do you know how many points of access where I can stupidly delete stuff? ALOT.

So, I decided to try Subversion. Now, I won't explain what Subversion is because that is
documented so well in their site as well as good portion of Google search results.

What I want to describe is exactly how I used scripts and programs to create a easy-learning, transparent, version-controlled work environment.

Here are what each quality means:
  1. Easy learning: virtually the implementation speaks for itself.
  2. Transparent: I don't add another layer of access for version control - the codes are what is seen, the version-control parts are really non-visible and non-intrusive.
  3. Version-controlled: I'll just say that equals to less than 10 minute maintaining versions and the other free 30 minutes divulging into more fun stuff(er, activities) @ work.
So let's get down to it!

  1. First, follow this link and do EXACTLY what it says. You'll be installing Subversion, Apache Server, and TortoiseSVN(a GUI client for Subversion). Come back when you are done!
....
Good! Okay. Now there can be 2 problems that might occur with this configuration. First, TortoiseSVN uses a different Subversion client than the Subversion installed with Apache. Meaning, Subversion 1.5.X and 1.4.X are NOT compatible!! Just keep it mind that

At the Tigris Subversion site, the package for Windows for Apache Server comes with 1.4.6 of Subversion, and TortoiseSVN is packed with Subversion 1.5.X

.. which would cause problem for those that has this occured.

Eventually the Subversion 1.5.X installing would make this problem go away.

Anyways, you've checked in your codes, and you feel good.
But how should you deal with making a copy on the networked drive?
Sure, checkout another copy over there too. But.. don't you feel like you'd what it to
automate the update process of the copy on the networked drives?

So you won't have to do the couple clickings of the mouse just to get the codes updated?
Well, onto the next step:

2. Synchronizing via Scheduling Task Manager

It's really simple.
Map the networked folder to a drive. For this example, it'll be W:
Make a batch file (XXXX.bat).
Inside the batch file, type:


W:
cd Folder1
cd Folder_THAT_HAS_VERSION_CONTROLLING
svn up

That's it! Save and double click. You'll see that the networked folders are updated. Voila~

But don't you think the black command shell box is a bit intrusive? What doesn't need to know, doesn't need to show.

Make a YYYY.vbs file, inside the folder that has the .bat file for simplicity.

Inside, write:



CreateObject("Wscript.Shell").Run """XXXX.bat""", 0, False


Yep. Double click that, and the same batch file would run, but it would run in the background. No black windows!

3. Scheduling.

Start->Programs->Accessories->System Tools has the 'Schedule Tasks' program. Click it.
You know how to manage adding a new schedule right? If you want extra description, ask, I'll do it.
Add a schedule to run, like every 30 minutes. The program to run is the YYYY.vbs file.


4. Done!

I just implemented this workflow with this project I'm working on, and I am totally psyched about it. Now, I don't need to figure out which file to update, which file to leave, which file to copy over, which to just get some code lines from it... NO! I have Subversion and my scripts to do that for me!!

WOOT

No comments: