class Ossy::CLI::Changelogs::Generate
Public Instance Methods
call(config_path:, output_path:, template_path:, data_path: nil)
click to toggle source
# File lib/ossy/cli/changelogs/generate.rb, line 34 def call(config_path:, output_path:, template_path:, data_path: nil) puts "Generating #{output_path} from #{config_path} using #{template_path}" ctx_data = YAML.load_file(config_path) template = Tilt.new(template_path) context = Context.new(ctx_data) if data_path key = File.basename(data_path).gsub(".yml", "") data = YAML.load_file(data_path) context.update(key => OpenStruct.new(data)) end output = template.render(context) File.write(output_path, "#{output.strip}\n") end