Sha256: fca437e3e31431f8ddf4b3ca468521b2f5d5e5cc9b49e952ea61cfbde986dbef

Contents?: true

Size: 376 Bytes

Versions: 37

Compression:

Stored size: 376 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(source, ::File.dirname(@recipe.path))
        content(ERB.new(::File.read(src), nil, '-').result(binding))

        super
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
itamae-1.0.0.beta21 lib/itamae/resource/template.rb
itamae-1.0.0.beta20 lib/itamae/resource/template.rb
itamae-1.0.0.beta19 lib/itamae/resource/template.rb
itamae-1.0.0.beta18 lib/itamae/resource/template.rb
itamae-1.0.0.beta17 lib/itamae/resource/template.rb
itamae-1.0.0.beta16 lib/itamae/resource/template.rb
itamae-1.0.0.beta15 lib/itamae/resource/template.rb
itamae-1.0.0.beta14 lib/itamae/resource/template.rb
itamae-1.0.0.beta13 lib/itamae/resource/template.rb
itamae-1.0.0.beta12 lib/itamae/resource/template.rb
itamae-1.0.0.beta11 lib/itamae/resource/template.rb
itamae-1.0.0.beta10 lib/itamae/resource/template.rb
itamae-1.0.0.beta9 lib/itamae/resource/template.rb
itamae-1.0.0.beta8 lib/itamae/resource/template.rb
itamae-1.0.0.beta7 lib/itamae/resource/template.rb
itamae-1.0.0.beta6 lib/itamae/resource/template.rb
itamae-1.0.0.beta5 lib/itamae/resource/template.rb