/usr/share/rubygems-integration/all/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/util/erb_template.rb is in vagrant-libvirt 0.0.43-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | require 'erubis'
module VagrantPlugins
module ProviderLibvirt
module Util
module ErbTemplate
# TODO: remove and use nokogiri builder
# TODO: might be a chance to use vagrant template system according to https://github.com/mitchellh/vagrant/issues/3231
def to_xml(template_name = nil, data = binding)
erb = template_name || self.class.to_s.split('::').last.downcase
path = File.join(File.dirname(__FILE__), '..', 'templates',
"#{erb}.xml.erb")
template = File.read(path)
# TODO: according to erubis documentation, we should rather use evaluate and forget about
# binding since the template may then change variables values
Erubis::Eruby.new(template, trim: true).result(data)
end
end
end
end
end
|