Sha256: c3d80aaebf04f1aef19fa214dfb9bf6db07acd010cda74cc591b5b2fd8dbbba9

Contents?: true

Size: 1.52 KB

Versions: 51

Compression:

Stored size: 1.52 KB

Contents

module Processor
  def load_tags(content, cdb)
    begin
      context = Radius::Context.new do |c|
        # map all parameters from 'content' to a tag with the same name 
        content.each do |content_param|
          c.define_tag "#{content_param.first}" do |tag|
            tag = content_param.last
          end
        end

        # include external file
        c.define_tag 'include' do |tag|
          result   = ''
          ext_file = File.join( ENV['WORKSPACE'], tag.attr['file'] )
          if File.exists?(ext_file)
            result = File.open(ext_file).read
          else
            puts "Warning: can not read static data " + ext_file
          end
          result
        end

        c.define_tag 'cdb' do |tag|
          result = ''
          if not cdb.nil? or cdb[tag.attr['key']].nil?
            result = cdb[tag.attr['key']]
          else
            puts "Warning: CDB not set for Template-Engine in tag 'cdb'"
          end
          result
        end

        c.define_tag 'feature_flag' do |tag|
          result = ''
          if not cdb.nil?
            feature = tag.attr['name']
            result  = cdb[cdb[feature]]
          else
            puts "Warning: CDB not set for Template-Engine in tag 'feature_flag'"
          end
          result
        end 

        c.define_tag "echo" do |tag|
          tag.expand
        end
      end
    rescue Exception => e
      $log.writer.error "Error in tag definition: #{e.message}"
      $log.writer.error e.backtrace
      exit 1
    end

    context
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
depengine-3.0.20 lib/depengine/processor/tags.rb
depengine-3.0.19 lib/depengine/processor/tags.rb
depengine-3.0.18 lib/depengine/processor/tags.rb
depengine-3.0.17 lib/depengine/processor/tags.rb
depengine-3.0.16 lib/depengine/processor/tags.rb
depengine-3.0.15 lib/depengine/processor/tags.rb
depengine-3.0.14 lib/depengine/processor/tags.rb
depengine-3.0.13 lib/depengine/processor/tags.rb
depengine-3.0.12 lib/depengine/processor/tags.rb
depengine-3.0.11 lib/depengine/processor/tags.rb
depengine-3.0.10 lib/depengine/processor/tags.rb
depengine-3.0.9 lib/depengine/processor/tags.rb
depengine-3.0.8 lib/depengine/processor/tags.rb
depengine-3.0.7 lib/depengine/processor/tags.rb
depengine-3.0.6 lib/depengine/processor/tags.rb
depengine-3.0.5 lib/depengine/processor/tags.rb
depengine-3.0.4 lib/depengine/processor/tags.rb
depengine-3.0.3 lib/depengine/processor/tags.rb
depengine-3.0.2 lib/depengine/processor/tags.rb
depengine-3.0.1 lib/depengine/processor/tags.rb