TemplateRenderer can take a new root [GH-3231]

This commit is contained in:
Mitchell Hashimoto 2014-04-02 09:53:20 -07:00
parent a1d9121852
commit 3371c37162
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,6 @@
require 'ostruct'
require "pathname"
require 'erubis'
module Vagrant
@ -38,6 +40,10 @@ module Vagrant
def initialize(template, data = {})
super()
@template_root = data.delete(:template_root)
@template_root ||= Vagrant.source_root.join("templates")
@template_root = Pathname.new(@template_root)
data[:template] = template
data.each do |key, value|
send("#{key}=", value)
@ -76,7 +82,7 @@ module Vagrant
#
# @return [String]
def full_template_path
Vagrant.source_root.join('templates', "#{template}.erb").to_s.squeeze("/")
@template_root.join("#{template}.erb").to_s.squeeze("/")
end
end
end