Add an rcov c0 code coverage threshold to your cc.rb build

September 30th, 2009

Okay, you use rcov through metric_fu to measure your test code coverage. If you can’t compile it at least you know your code doesn’t throw run time syntax errors, right? All of it? Yeah… well, me neither. But I’m trying to get better and this is my technique for that.

Never take a step backwards. Fail your builds if the test coverage drops below where you’re currently at.

Here’s a rake task to fail the build if it drops out below a set threshold.

Add it to your lib/tasks folder in your rails app.

As you increase coverage update the threshold, treat that threshold like a ratchet, a notch of movement each time but always in the same direction.

I’m sure this is extensible to other metric_fu metrics too.

p.s., I’m very open to hearing a better way of doing this. I couldn’t get any joy from the metric_fu mailing list so hacked this together. Surely there must be a better way?

Git pull from github

September 26th, 2009

When you create a new git repo at github some stuff wont be set by default. The following commands help from within the new repo on your own computer.

Namely, you wont be able to pull… but that shouldn’t be a surprise for you as you’re a computer programmer. You should be used to that by now.

You’ll get a message like this:

tim@thefactory:~/Documents/Development/smarterfitter(master)$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either.  Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:

    branch.master.remote = <nickname>
    branch.master.merge = <remote-ref>
    remote.<nickname>.url = <url>
    remote.<nickname>.fetch = <refspec>

See git-config(1) for details.

To fix it use these commands:

git config --add branch.master.remote origin
git config --add branch.master.merge refs/heads/master
git pull

Hooray.

N.B., if you’ve cloned the repo. from github you’re already set up with this. It is only for when you create a repository from scratch.

Self hosted CI in an evening

September 8th, 2009

I’m going to be outsourcing some work to oDesk which means for the first time contention on the source code repository.

Last night I set up a continuous integration solution so that the other developers and I know what’s going on with the build and so we know when we break one another’s code/tests.

Basic CruiseControl.rb fronted by Apache building on Ubuntu.

Here’s how I did it:

Our code is already hosted on github.com, it is ace.

A Linode 360 VPS from Linode for USD19.95/mo.

Sign up to running server < 5min. Ubuntu 8.04 LTS.

Execute some commands:

Configure Apache:

Download the very, truly, excellent CCMenu for notification.

This is just a rough post, if you have questions on the specifics please let me know in the comments.

It really helped that I'd written down most of these steps when I first installed our production environment so I was able to match that pretty much blow for blow.

I had to install a few testing gems that we're necessary in production to get the builds working.

Next step, install metrics_fu and have cc.rb do something useful with it all.

Lightweight business infrastructure

September 2nd, 2009

Monica and I run a small (niche, if you like) website called Writer’s Residence. We’ve been at it for a bit over a year, quite part time but we manage to answer support questions very promptly and provide, I think, a very good service at a decent price.

We can do this for one simple reason, infrastructure is really damn cheap now. Here’s how we do it.

Component Monthly cost
550mb RAM VPS with offsite backup @ Rimuhosting USD37.05
Skype account w/ US and UK phone numbers & unlimited international calls to landlines GBP6.95
Github hosted source code control USD7.00
Xero online accounting software w/ automated bank and PayPal feeds GBP21.50
PayPal payment processing Expensive at 5.5-6.6% of revenue but stoopid quick and easy to set up
Google Apps for our domain Free (as in beer)
Amazing software that continually beats my expectations, MySQL, Ruby, Rails, Linux Free (as in beer and speech). Thanks!
uservoice customer feedback service (we’re trying this out) Freemium w/ a good enough free account for now

With all this stuff sitting out there in the cloud and costing us nothing up front we were able to be profitable with our first 10 paying customers. We can reinvest our profit to keep building out the service.

Of course this is really the cheap stuff compared to time and there’s no way we’ve recouped the effort that has gone into this yet but it is a fun journey and as with lots of things in life it really is about the journey rather than the destination.

A further benefit of all this virtual infrastructure is that we can live and work where ever we wish within budget so long as we have broadband internet access, and that is rather freeing.

Couch

August 23rd, 2009

Ordered, on its way. Should arrive Thursday. Very, very excited.

I’ve been longing for a sofa that I can lie down on and I’ve found it.

At a touch of 2 metres long I’ll be able to stretch out.

FC76E867-C3EC-448D-9665-8FD83BA3BD66.jpg

I like the relaxed, comfortable, slightly rumpled look. Hopefully it will deliver on this promise. I’m also hopeful that it will last us a good few decades.

Update 8/9/09: the couch meets expectations, woohoo! Lounging about is the way forward.
Last night I spent a few hours on the couch setting up a continuous integration server for WIL.

Orchard Cottage…

August 15th, 2009

Fridge?

Check. And freezer.

Washer/dryer?

Check. And a very good thing too as I was running out of pants.

Dishwasher?

Check. Yay!

Bed?

Check. It is large and in charge.

Desk and drawers?

Check. I(c)kea… how I love you and loathe you in equal measures

Dining table and chairs?

Check. Still going strong and my only previous furniture.

Okay, so we’re just missing a nice couch now, oh, and a sofa bed for the office. It’s coming along.

Yes, we’re also missing a dog. I’m looking forward to Monica’s return so we can go find one at a shelter somewhere.

I don’t think we’re going to need to buy more stuff for a very, very long time. All this lot should last at least a decade.

On living life

August 15th, 2009

This little video that the South Park guys put to an audio track by some chap named Alan Watts sums up a lot of what I’m thinking about life at the moment.

Thanks to @stephenfry for reminding me of the clip.

I think Alan Watts might be worth some further investigation.

Writing is hard…

August 1st, 2009

I’ve never been very good at it and after Twittering more than blogging recently it seems I’ve got even worse.

Do bear with me and perhaps I’ll have something useful to say in the next few posts.

Paring down…

August 1st, 2009

After realising that I didn’t have a working CD or DVD player aside from my computer I got rid of my CDs. That was prior to moving.

Since the move I’ve managed to part with a bunch more things. I’ve got a bunch of books for donation, a whole pile of electronics for eBay or recycling and a set of golf clubs to sell that I use once a year on a 9 hole course if Rory and I can get our arses into gear.

There’s a stack of old hard drives I’ve been hanging on to for years thinking that I’ll probably get around to getting the data off them one day. They’re for the recycling centre too.

I’ve hauled a bunch of this crap half way around the world with me from Austin, TX where I fell headlong into consumerism for a few years and then stored, moved, stored, moved, stored and moved them around London since then. Well past time to let go.

Right now Monica and I are figuring out the purchase of more ‘forever things’ as we call them. Buying high quality stuff made of good materials that either isn’t plastic so wont break or can be serviced sensibly if something does go wrong. Finding high quality tools that help us do jobs well.

I’m hopeful that that doesn’t always mean expensive stuff. Figuring we can buy a lot of things like that second hand because the basic nature of them is that they wont have fallen apart over time and might even have grown more beautiful over time.

I’ve never really been good at buying used things so this is a challenge and a learning experience. Mostly it will challenge my patience. Usually when I want something I want it now.

Anyway, less, better, stuff and way, way less clutter and hanging on to things that I don’t use much. Off to a good start aside from the I(c)kea desk I bought today.

Also, after living for years without desk drawers I now have 5 and hope to never have more stuff around my desk than will fit in them. Lovely having camera, cables, discs, booklets, pens, pencils, necessary things put away somewhere where they can’t be seen.

Oh, yeah, got to get rid of the Mac Mini too. Then I’ll be down to a mere two computers… that will be the first time in a while.

This paring down has been underway for a few years but it really does feel like this is getting towards the end. Pretty solidly down to useful things now and there’s no value in getting rid of those.

The Country

August 1st, 2009

We’re settling in to Orchard Cottage. Very exciting to have a dishwasher. News the bed is on its way, due Wednesday. That will be lovely.

I’ve set up my new I(c)kea desk. It’s a flat space and I’m saving my money for a good chair. Monica has been doing some research on finding second hand Aeron chairs.

Lovely having a work place that isn’t the kitchen table.

I had some work done to the A(ce)stra and it sucks quite a lot less. Changing gear, for example, is no longer an epic battle of strength and will. The brakes aren’t nearly as squeaky as they were either. Enjoying driving about, it is fun on these little roads.

Switzerland next week and after that it will be head down till Christmas to get a lot done on Well Informed Limited and Writer’s Residence.

Just a few things left to find to tick off the furniture list, a sofa and a sofa bed, a couple of beside tables and a coffee table. Hopefully find some good second hand wooden products and have no idea where we’ll find the sofas…

Living in the country affords a very different pace of life. People are friendly and have time to chat. That’s quite hard to cope with after London. I have to force myself to slow down and appreciate it rather than getting impatient to be away and on to the next thing. And I think I was pretty laid back compared to most city types.

Time for sleep.