Sha256: 8c4ab2de836967082381453722e857c9fa0b5d6758b979cd21d345027de11cbc

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 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 TemplateException, "#{@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.8.0 lib/buildmaster/templatelets/when.rb
BuildMaster-0.8.1 lib/buildmaster/templatelets/when.rb