Getting Active Resource working in Edge Rails
I've wanted to have a look at Active Resource since it was announced, and now I need to look at it for work. It took me a while to get it working, so here is my learning.
Say hi to the new site
So, I've finally shipped a new version of reprocessed.org. It's essentially a prototype -- I did the least possible work to get something up and running, so there's a load of stuff missing (comments, primarily), but hopefully I've got a platform to build the fun and interesting things I've wanted to build but couldn't make Movable Type do (at least, do easily enough).
Introducing ModelMocker
While writing Rails apps, I've written several variants on the 'give me an ActiveRecord instance that can't talk to the DB' theme over the last couple of years while writing tests or specs for an app. The basic pattern is a pretty good one - it guarantees you a certain degree of test isolation for your unit tests or specs, when you need it. And, because you're make specific instances isolated, you can get to the DB if you need to.
- 12.12.2008, 19.58
- File under: Ruby, Rails, Ruby on Rails, RSpec, Mocha, Mock objects, testing, development, ModelMocker, Test-driven development, Behaviour-driven development
Introducing dpkg-tools: Ubuntu and Debian package building for Rubygems and more
Something I found myself wrestling with a lot towards the end of my time at the BBC, and something I've been thinking a lot about since, is the deployment of entire servers, not just the deployment of software onto servers. I've spent nearly ten years working with Linux distributions and their OS package management systems, primarily Red Hat and Debian-based systems (Ubuntu, lately). I've also spent a lot of time working with Python and Ruby's OS-independent packaging systems (Distutils, a tiny bit of Setuptools, and Rubygems).
dpkg-gem: Ubuntu and Debian package building for Rubygems
Well, it's been a couple more weeks than I promised (that Christmas, it gets everywhere), but here's the first follow-up from my dpkg-tools from December.
- 13.1.2009, 12.37
- File under: sysadmin, Ruby, Rubygems, packaging, deployment, package management, configuration management, development, dpkg-tools, dpkg-gem
Shared templates, context-dependent url_for, and RSpec
I have this Rails app which has a set of shared templates which are used by two actions in different controllers. Each action renders one of three shared templates, dependent on the context. This is all fine, except that I rely on the magic of url_for to generate URLs based on the current controller; and I rely on RSpec's view specs to keep things working and tidy.
Co-op online HTML bank statements to OFX
Getting your statement data out of the Co-operative Bank's online banking system in a usable form was pretty hard. You could save the HTML of a statement page, but that's about it. I use Xero for my company, Constituent Parts. It will import OFX formatted files which some banks will export for you. To get Co-operative Bank data into Xero you either need to enter the data by hand, or somehow convert it to OFX. Luke Redpath (who's great, by the way) wrote a Greasemonkey script to scrape Smile/Co-op HTML and generate OFX. It works for Current Accounts, but doesn't work with Credit Card statements, which have a slightly (but significantly) different format. So, I've written a Ruby-based screen scraper which will work with Current Accounts and Credit Cards. You can find it over on GitHub: It's called Co-op to OFX.