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.beta41 lib/itamae/resource/template.rb
itamae-1.0.0.beta40 lib/itamae/resource/template.rb
itamae-1.0.0.beta39 lib/itamae/resource/template.rb
itamae-1.0.0.beta38 lib/itamae/resource/template.rb
itamae-1.0.0.beta37 lib/itamae/resource/template.rb
itamae-1.0.0.beta36 lib/itamae/resource/template.rb
itamae-1.0.0.beta35 lib/itamae/resource/template.rb
itamae-1.0.0.beta34 lib/itamae/resource/template.rb
itamae-1.0.0.beta33 lib/itamae/resource/template.rb
itamae-1.0.0.beta32 lib/itamae/resource/template.rb
itamae-1.0.0.beta31 lib/itamae/resource/template.rb
itamae-1.0.0.beta30 lib/itamae/resource/template.rb
itamae-1.0.0.beta29 lib/itamae/resource/template.rb
itamae-1.0.0.beta28 lib/itamae/resource/template.rb
itamae-1.0.0.beta27 lib/itamae/resource/template.rb
itamae-1.0.0.beta26 lib/itamae/resource/template.rb
itamae-1.0.0.beta25 lib/itamae/resource/template.rb
itamae-1.0.0.beta24 lib/itamae/resource/template.rb
itamae-1.0.0.beta23 lib/itamae/resource/template.rb
itamae-1.0.0.beta22 lib/itamae/resource/template.rb