Enable ability to supress newlines in ERB for templates using -%>
This commit is contained in:
parent
992bd13b19
commit
b6719d00d9
|
@ -68,7 +68,7 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def render_string
|
def render_string
|
||||||
ERB.new(template).result(binding)
|
ERB.new(template, nil, "%<>-").result(binding)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the full path to the template, taking into accoun the gem directory
|
# Returns the full path to the template, taking into accoun the gem directory
|
||||||
|
|
|
@ -6,8 +6,9 @@ Vagrant::Config.run do |config|
|
||||||
# Every Vagrant virtual environment requires a box to build off of.
|
# Every Vagrant virtual environment requires a box to build off of.
|
||||||
config.vm.box = "<%= default_box %>"
|
config.vm.box = "<%= default_box %>"
|
||||||
|
|
||||||
<% if !default_box_url.nil? %>
|
<% if !default_box_url.nil? -%>
|
||||||
# The url from where the 'config.vm.box' box will be fetched
|
# The url from where the 'config.vm.box' box will be fetched if it
|
||||||
|
# doesn't already exist on the user's system
|
||||||
config.vm.box_url = "<%= default_box_url %>"
|
config.vm.box_url = "<%= default_box_url %>"
|
||||||
<% end %>
|
<% end -%>
|
||||||
end
|
end
|
||||||
|
|
|
@ -60,7 +60,7 @@ class TemplateRendererUtilTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "simply render the template as a string" do
|
should "simply render the template as a string" do
|
||||||
ERB.expects(:new).with(@r.template).returns(@erb)
|
ERB.expects(:new).with(@r.template, nil, "%<>-").returns(@erb)
|
||||||
assert_equal @result, @r.render_string
|
assert_equal @result, @r.render_string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue