class Awestruct::CLI::Manifest::TemplateFile
Public Class Methods
new(path, input_path, state = {})
click to toggle source
# File lib/awestruct/cli/manifest.rb, line 226 def initialize(path, input_path, state = {}) @path = path @input_path = input_path @state = state end
Public Instance Methods
perform(dir)
click to toggle source
# File lib/awestruct/cli/manifest.rb, line 232 def perform(dir) begin rendered = ERB.new(File.read(@input_path), trim_mode: '<>').result( OpenStruct.new(@state).instance_eval { binding }) rescue => e $LOG.debug "::DEBUG:: #{e.message} state - #{@state}" end p = File.join(dir, @path) $LOG.info "Create file: #{p}" if $LOG.info? File.open(p, 'w') { |f| f.write(rendered) } end
unperform(dir)
click to toggle source
# File lib/awestruct/cli/manifest.rb, line 246 def unperform(dir) # nothing end