Enable ability to supress newlines in ERB for templates using -%>

This commit is contained in:
Mitchell Hashimoto 2010-08-01 17:26:37 -07:00
parent 992bd13b19
commit b6719d00d9
4 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -191,7 +191,7 @@
Unknown provisioner type: <%= provisioner %> Unknown provisioner type: <%= provisioner %>
:rootfile_already_exists: |- :rootfile_already_exists: |-
It looks like this directory is already setup for vagrant! (A <%= Vagrant::Environment::ROOTFILE_NAME %> It looks like this directory is already setup for vagrant! (A <%= Vagrant::Environment::ROOTFILE_NAME %>
already exists.) already exists.)
:rootfile_not_found: |- :rootfile_not_found: |-
A `<%= Vagrant::Environment::ROOTFILE_NAME %>` was not found! This file is required for vagrant to run A `<%= Vagrant::Environment::ROOTFILE_NAME %>` was not found! This file is required for vagrant to run
since it describes the expected environment that vagrant is supposed since it describes the expected environment that vagrant is supposed

View File

@ -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