YOUR WEEK 3 HOMEWORK!

This week, your homework will be to write a program similar to Rake. Your program must deal with tasks and dependencies.

Here are the Phase 1 requirements:

  • tasks - take a block and can execute it
    • run outputs task execution including nesting of dependencies
    • tasks are executed via tests/code. cmdline interface extra credit.
  • dependencies amongst tasks - deps must run first
    • dependencies are intellegently run, they won’t re-execute if met.
    • declaration order doesn’t matter - aka resolve dependencies late.
    • architect this so it can be made multithreaded later
  • This will be TDD from the ground up with good coverage.

Here is an example task recipe w/ the basic public API needed:

require 'worker_bee'

WorkerBee.recipe do work :sammich, :meat, :bread do puts "** sammich!" end

work :meat, :clean do puts "** meat" end

work :bread, :clean do puts "** bread" end

work :clean do puts "** cleaning!" end end

WorkerBee.run :sammich

Executing this should output:

running sammich
  running meat
    running clean
** cleaning!
** meat
  running bread
    not running clean - already met depnedency
** bread
** sammich!

When building your project use “sow”. Just execute:

$ sow WorkerBee

Fill out the project with tests, and make it go.

Leave a Reply