$:.unshift File.join(File.dirname(__FILE__), '..') require 'template_runner' module BuildMaster class When def initialize(site_spec, expression_evaluator) @site_spec = site_spec @evaluator = expression_evaluator end def process(target, template, source) eval = template.attribute_value!('test') if (not @evaluator.respond_to?(eval)) raise TemplateError, "#{@evaluator.class} cannot evaluate expression #{eval}" end if (@evaluator.send(eval, source.path)) runner = TemplateRunner.new(target, template, source) runner.templatelets = @site_spec.load_templatelets runner.process end end end end