Ranch and the CVS Tango

Extra Extra - New Theme Created for Drupal Contributions Repository!

Ok maybe it is not a big deal to most people, but because it was my first Drupal project, it really is big news for me. So big that I am still riding high on my pink Drupal drop shaped cloud. See, yesterday I officially released a new theme for Drupal 5 (soon to make it 6 as well) called Ranch, and put it out there for all to download and use.

Ranch started out life based on a theme that I had put together using NiftyCorners for a client of ours, which I had built upon Zen. It is nothing like the former site, aside from being valid and clean, and very rounded. It is pretty nice, with a very clean CSS based layout, 2 columns with a Mission Statement area, primary and secondary links, breadcrumbs, as well as sidebar for whatever your heart desires.

I chose to use Zen mostly because everyone was talking about it, and because it was supposed to be easier to create a theme from than by doing it from scratch. I don’t really agree with that last part, though I do like how Zen does many things, especially their CSS where they lay out most of the selectors so that when you are using FireBug to change or fix something, you can actually alter it (using the empty CSS tag that is provided) right there, quickly and easily. Very nice.

I think for my next theme however, that I will borrow the CSS, and do the rest from scratch. In the end I deleted hundreds of lines of code that I was never going to use and just sort of seemed like bloat.

Giving it to Drupal

Yesterday I finished (ok, stopped) cleaning, tweaking, and perfecting my theme. I might be a little bit... “particular” about things being just right, so it is sometimes a challenge for me to say something is good enough. Anyhow, after finishing up Ranch, it was time to create a new project for it on Drupal.org, and to create a release so that others could easily download and use it.

This is easier said than done. Here is a breakdown of what needed to be done, and a little of the mistakes I made trying to do it.

CVS Account on Drupal.org

The very first thing I needed to do was to request CVS access so that I could contribute to Drupal.org. I did this by going to drupal.org/cvs-application and filing out the application as well as I could. I have it on good authority that if you have a good theme that doesn’t look like crap, that you could probably lorem ipsum your application with a link to the theme and you may actually get approved :) Ok, lorem ipsum might not go over, but you might be able to get away with Dr. Suessing it. Haiku would be going to far.

Read a LOT - Export - Login - Add - CVS is FUN!

Next thing I had to do was find a bunch of information on Drupal.org on how to correctly CVS, make releases, branch, tag, etc. Luckily this is all very well documented and I had in person help from Josh Brauer, but it was still a bit of work. What it all boils down to are the next several lines of bash history:

mkdir ~/Sites/contrib
cd ~/Sites/contrib/
export CVSROOT=:pserver:mycvsusername@cvs.drupal.org:/cvs/drupal-contrib
cvs login
cvs checkout -l contributions/themes

WARNING - Don't use cvs checkout -l contributions/modules

Right here I was led astray by another document, and accidentally used contributions/modules instead of contributions/themes. This of course is a theme, so this didn't work. So I edited it back to where I removed everything, and started over with the contributions/themes. Also, make note in this next section that the -l is REALLY important

cd contributions/themes/
cp -R /Library/WebServer/Documents/client/drupal-5.7/sites/default/themes/ranch ranch
cd ranch/
ls -al

Yep, everything is there (including a couple of things that I don’t want there, which tosses me a few issues later)

cd ..
cvs add ranch
cvs add ranch/*
cvs commit -m "Initial commit of the Ranch theme, a standards compliant CSS theme with easy to change color."

This is the initial commit, which created the “HEAD” of my project. Neat! Too bad it’s screwed up at this point, but we fix it later. Next is were we create a branch called DRUPAL-5 - can’t have a project release without this!

cd ..
cvs tag -b DRUPAL-5 themes/ranch
cd themes/ranch/
cvs update -dP -r DRUPAL-5

Here is where I was saying it was screwed up. See, CVS isn’t recursive, BUT it will add directories that are in the current directory. So, what ended up happening is that it added my images directory, and my sourcefiles directories. So here is me fumbling around trying to make it right. Actually, suffice to say that I remove, cvs delete, recreate, re-checkout, start from scratch, do all sorts of crap until I figure out that this is what I have to do:

cd ../../..
rm -Rf contributions/
cvs checkout -d ranch contributions/themes/ranch
cd ranch
cvs delete images
cvs delete sourcefiles
cvs commit -m "removing unused directories"
cvs status

As Josh says “CVS Status is your BFF!”

cd ..
rm -Rf ranch/
cvs checkout -r DRUPAL-5 -d ranch contributions/themes/ranch/
cd ranch/
cvs tag DRUPAL-5--1-0

This is where I made my first release tag - This makes the whole package thing possible. Done with CVS for now, YAY!

Make The Project

Now that I had gotten so much pleasure (not to mention knowledge) from my CVS time with Drupal, it was time to actually create my Ranch project. I did this by going to Drupal.org, logging in, clicking on Create Content on the right sidebar, and selecting Project.

Before I got too far on that though, I needed to make a good screenshot for my project page. I followed these guidelines: http://drupal.org/node/11637

After making the nifty screenshot, I finished filling out my Project page, then I went and created a release, which you do by going to the link in the right sidebar called My projects, finding my project amongst the very long list of one, and clicking on “Add release” under the Project links.

From there I selected the DRUPAL-5--1-0 CVS Identifier (I think, I don’t have a history on this part and being an old fart, my addled brain doesn’t remember exactly) and hit Next.

It was pretty self explanatory after that. Then, after waiting just a minute, I checked, and voila my project page was complete. That’s about the time I was starting to say things like Woot! a whole lot, and dancing and basically making a spectacle of myself. It wasn’t pretty. At least I was happy though.

And that is how I made my first Drupal project.

Pat Teglia - CrashTest_