Remove Arrays as keys in templates

This commit is contained in:
eSe 2014-03-11 16:09:59 +01:00
parent 7614bceec1
commit 0ade406a89
11 changed files with 101 additions and 171 deletions

View file

@ -46,7 +46,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_prepend',
:value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1;',
@ -54,8 +54,7 @@ describe 'nginx::resource::location' do
' test2 test value 2b;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -99,7 +98,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_append',
:value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1a;',
@ -107,8 +106,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -173,7 +171,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_prepend',
:value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1a;',
@ -181,8 +179,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -196,7 +193,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_append',
:value => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'allow' => ['test value 3a', 'test value 3b', 'test value 3c'],
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3a;',
' allow test value 3b;',
@ -205,8 +202,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
].each do |param|
@ -239,7 +235,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_prepend',
:value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1;',
@ -247,8 +243,7 @@ describe 'nginx::resource::location' do
' test2 test value 2b;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -256,7 +251,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_append',
:value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1;',
@ -264,8 +259,7 @@ describe 'nginx::resource::location' do
' test2 test value 2b;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
].each do |param|
@ -298,7 +292,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_prepend',
:value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1a;',
@ -306,8 +300,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -351,7 +344,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_append',
:value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1;',
@ -359,8 +352,7 @@ describe 'nginx::resource::location' do
' test2 test value 2b;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
].each do |param|
@ -405,7 +397,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_prepend',
:value => { 'test1' => 'test value 1', 'test2' => ['test value 2a', 'test value 2b'], 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1;',
@ -413,8 +405,7 @@ describe 'nginx::resource::location' do
' test2 test value 2b;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -452,7 +443,7 @@ describe 'nginx::resource::location' do
:attr => 'location_cfg_append',
:value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1a;',
@ -460,8 +451,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
{
@ -514,7 +504,7 @@ describe 'nginx::resource::location' do
:attr => 'location_custom_cfg',
:value => { 'test1' => ['test value 1a', 'test value 1b'], 'test2' => 'test value 2', 'allow' => 'test value 3',
'test4' => { 'subtest1' => ['"sub test value1a"', '"sub test value 1b"'],
['subtest2a', 'subtest2b'] => '"sub test value2"' } },
'subtest2' => '"sub test value2"' } },
:match => [
' allow test value 3;',
' test1 test value 1a;',
@ -522,8 +512,7 @@ describe 'nginx::resource::location' do
' test2 test value 2;',
' test4 subtest1 "sub test value1a";',
' test4 subtest1 "sub test value1b";',
' test4 subtest2a "sub test value2";',
' test4 subtest2b "sub test value2";',
' test4 subtest2 "sub test value2";',
],
},
].each do |param|

View file

@ -6,14 +6,12 @@ include <%= file %>;
<%# sorted so that the ordering is stable. -%>
<% if @vhost_cfg_append -%><% @vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

View file

@ -19,14 +19,12 @@ server {
<%# sorted so that the ordering is stable. -%>
<% if @vhost_cfg_prepend -%><% @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

View file

@ -1,56 +1,47 @@
location <%= @location %> {
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
alias <%= @location_alias %>;
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}

View file

@ -10,14 +10,12 @@
<% end -%><% end -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
@ -44,27 +42,23 @@
<% end -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

View file

@ -1,14 +1,12 @@
location <%= @location %> {
<% if @location_custom_cfg -%><% @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

View file

@ -1,27 +1,23 @@
location <%= @location %> {
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
@ -41,30 +37,24 @@
<% end -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}

View file

@ -7,27 +7,23 @@
<% end -%><% end -%>
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.each do |key,value| -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%=subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
@ -48,30 +44,24 @@
<% end -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}

View file

@ -1,57 +1,47 @@
location <%= @location %> {
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
stub_status on;
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}

View file

@ -3,27 +3,23 @@ include <%= file %>;
<% end -%><% end -%>
<% if @vhost_cfg_append -%><% @vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

View file

@ -50,27 +50,23 @@ server {
<% if @vhost_cfg_prepend -%><% @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @vhost_cfg_ssl_prepend -%><% @vhost_cfg_ssl_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>