Sha256: 7501c1f6ad64267b9adaeef3e2767ffc1fb7775d0cc4e31691c34af54ebf69f8

Contents?: true

Size: 399 Bytes

Versions: 3

Compression:

Stored size: 399 Bytes

Contents

require 'itamae'
require 'erb'
require 'tempfile'

module Itamae
  module Resource
    class Template < File
      define_attribute :source, type: String, required: true

      def pre_action
        src = ::File.expand_path(attributes.source, ::File.dirname(@recipe.path))
        attributes.content = ERB.new(::File.read(src), nil, '-').result(binding)

        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itamae-1.0.0.beta44 lib/itamae/resource/template.rb
itamae-1.0.0.beta43 lib/itamae/resource/template.rb
itamae-1.0.0.beta42 lib/itamae/resource/template.rb