Let the names begin!

April 27, 2009 at 5:59 pm (Ruby, Week 6) (, , , , , , )

I decided it’d be better if I gave more semantically meaningful titles, so that people have more of an idea of what they’re getting into when they happily decide to read about what I did at work. Today, clearly, is an exception (at least as it relates to my learning), but let’s look past that and on to a future where I’m not speaking in numbers anymore.

Eric and I worked most of the day on behind-the-scenes work for our Rails app: mostly automating the deployment with Vlad the Deployer and writing automated browser-based tests utilizing Watir. Both technologies are pretty cool. I’ve lived with Capistrano for some time, though I mostly used the outstanding Rails Machine gem as a starting point. Well, it turns out Vlad owes a lot to Capistrano and Rails Machine as well, so it wasn’t all that different. There were a few gotchas I ran across, namely some weirdness with set deploy_via, :remote_cache, but for the most part we were just re-learning how to set a deploy recipe up from scratch. Not too difficult once we found the list of Vlad variables, and it’s great to have things automated now instead of having to SSH in manually and make the changes we need.

While we’ve done our unit testing with RSpec and used Cucumber for most of our integration tests, we found that there were certain things we needed Watir for: SSL and Javascript testing, in particular. I’m pretty certain there’s a way to hook Cucumber up to Watir, but we ended up just wrapping these new Watir integration tests with RSpec, which works just fine for our current purposes. There were a few problems that required us to SSH into our staging server (which we’re running these Watir tests against), but once we figured out the syntax for multiple SSH commands on one line, we were home free (we have SSH keys set up to manage the login process, which I highly recommend for anyone managing servers):

ssh colin@jones.com 'cd /path/to/application/current/; rake do_task'

The single quotes are the key! Once again, thank you Google.

I also did a story by myself where our error page has a form to submit your email address if you have a problem and would like to hear back from the support team. Hopefully that story won’t see a lot of use, but I’m proud of it. The code is clean and will be easy to maintain, and there are good tests for it. I hope I’ll be able to say the same about my Limelight app once it’s done.

Advertisements

2 Comments

  1. Markus Gärtner said,

    You may want to use && instead of ;. This would result in an abort of execution whenever the first failing command is encountered. In Perl and Ruby this is an idiom, I think.

    • trptcolin said,

      Good point! There’s no need in this case to run the rake task if the cd didn’t work. And it’s not really more work to write it this way (one extra character), so maybe we’ll go back in and tweak that tomorrow morning.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: