class ProxyTester::Actions::CreateOutput
Attributes
data[R]
engine[R]
name[R]
output[R]
repository[R]
Public Class Methods
new(name, output, data, engine = ErbGenerator, repository = TemplateRepository.new)
click to toggle source
# File lib/proxy_tester/actions/create_output.rb, line 11 def initialize(name, output, data, engine = ErbGenerator, repository = TemplateRepository.new) @name = name @output = output @data = data @engine = engine @repository = repository end
Public Instance Methods
run()
click to toggle source
# File lib/proxy_tester/actions/create_output.rb, line 19 def run ProxyTester.ui_logger.info "Creating example configuration:" template(name, output, data) end
Private Instance Methods
template(local_name, local_destination, local_data)
click to toggle source
# File lib/proxy_tester/actions/create_output.rb, line 26 def template(local_name, local_destination, local_data) template = repository.find(local_name) generator = engine.new(local_data) generator.compile(template, local_destination) rescue Errno::ENOENT fail Exceptions::ErbTemplateIsUnknown, JSON.dump(message: "Unknown erb template \"#{template_path}\".") end