My Schedule

Speaking

EclipseWorld

October 28 - 30 - Presenting two sessions on OSGi.

Events

JavaOne

May 6 - 9 - Attending JavaOne in San Francisco.

The opinions expressed on this site are my own, and not necessarily those of my employer.

Rake TestTask Hangs

Filed Under Ruby, Platforms, Development |  

Here’s the test task in my rake file. Works on Windows, but not on my Mac. It just hangs. What’s the problem?

Rake::TestTask.new do |t|
  t.libs << "./app;./test"
  t.test_files = FileList['test/test*.rb']
  t.verbose = true
end

Two hours later, I tell you that I need this on my Mac.

Rake::TestTask.new do |t|
  t.libs << "./app:./test"
  t.test_files = FileList['test/test*.rb']
  t.verbose = true
end

See the difference? Semi-colon…colon…Wow…

Comments

6 Responses to “Rake TestTask Hangs”

  1. Robert Fischer on August 11th, 2007 3:48 pm

    Does Rake have some kind of OS-sensitive path-maker function? That’s the kind of difficult-to-debug problem which could really use some abstraction…

  2. kirk on August 13th, 2007 2:31 am

    Obviously not that I know of…:-). I made the same mistake in Java a while back with the file separator, and quickly changed my code to use the system property instead of hardcoding the back/forward slash.

  3. Bruce Williams on August 20th, 2007 2:10 am

    IIRC, Ruby automatically converts file path separators for file operations (so using / vs \ isn’t a problem and there’s no need to use File::SEPARATOR).

    As to this problem — I’ve never seen someone try a colon/semicolon, environment variable style — I’m more surprised it worked at all (since it’s $: that’s being modified). I’d use t.libs += %w(app lib), and skip the ./s, since they’re superfluous.

  4. Bruce Williams on August 20th, 2007 2:12 am

    I meant t.libs += %w(app test), obviously ;-)

  5. kirk on August 21st, 2007 1:26 pm

    Bruce,

    I’m pretty sure I picked up the syntax from the Pickaxe book. While I enjoy Ruby, I’m no expert, so thanx for the tip on a better way of doing things.

  6. Bruce Williams on August 22nd, 2007 9:36 pm

    Kirk, np :-)

Leave a Reply