Sha256: 8d2e96c9c4214644219dd38e9c48cfc54fb79cb3ca1c89974283a316ff8479bb
Contents?: true
Size: 810 Bytes
Versions: 15
Compression:
Stored size: 810 Bytes
Contents
# Processes the ERB files and looks for comments like # # #ERB if @testvar # - "some yaml" # #ERB end # class Kubes::Compiler::Strategy::Erb class Comment extend Memoist def initialize(path) @path = path end def lines IO.readlines(@path) end memoize :lines def process? !!lines.detect { |l| l.include?('#ERB') } end def process new_lines = lines.map do |line| md = line.match(/(.*)#ERB(.*)/) if md "#{md[1]}<%#{md[2]} %>\n" else line end end content = new_lines.join('') IO.write(erb_path, content) erb_path end def clean FileUtils.rm_f(erb_path) unless ENV['KUBES_KEEP_ERB'] end def erb_path "#{@path}.erb" end end end
Version data entries
15 entries across 15 versions & 1 rubygems