Adding to the default Rake task

You have a Rails app with a Rakefile. When you type rake, it runs all the tests (or specs if you prefer). You want it to do something else as well: let’s say you want to run RuboCop on your codebase.

Don’t do this:

task(:default).clear
task default: [:spec, :rubocop]

Do this instead:

task(:default).prerequisites << task(:rubocop)

With the first pattern, you need to collect together all the tasks in one place, and it’s easy to accidentally redefine the prerequisites so that something that you thought was running isn’t any longer.

With the second pattern, however, you can configure each additional task in a self-contained file in lib/tasks/[name].rake, and they won’t step on each other.

Keep Ruby Weird

My talk proposal for Keep Ruby Weird was accepted, so I’ll be in Austin, Texas at the end of October, speaking about (human language) writing systems. More…

First they came for our vacuum cleaners …

The evil, domineering, nanny-state EU wants to BAN powerful vacuum cleaners! Cue shock, horror, xenophobic outrage etc. More…

A proposal for renaming Greenland pier

Greenland pier is confusingly named, but I think there’s a reasonable alternative with historical provenance. More…

Lithium-ion

As if keeping modern mobile phones charged wasn’t hard enough already, it’s about to get a whole lot more annoying.

For ‘security’, passengers flying to the US will now be required to demonstrate that their electrical devices turn on, and gadgets with flat batteries won’t be allowed on the plane. This is, apparently, so that al-Qaeda can’t replace the batteries with something even more explosive than lithium-ion batteries.

However, I see a problem: More…

Older entries can be found in the diary section.