Sha256: 50caf1b7c2c33c1282381a1ed8f514730a77156376b8d9c9bc6647dd07b8b478

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

$:.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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.9.0 lib/buildmaster/templatelets/when.rb
BuildMaster-0.9.1 lib/buildmaster/templatelets/when.rb