Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
grooverdan committed Mar 12, 2014
2 parents 7e56183 + 0ade406 commit b27e446
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 149 deletions.
14 changes: 6 additions & 8 deletions templates/vhost/vhost_footer.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ 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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}
Expand All @@ -24,4 +22,4 @@ server {
server_name www.<%= @name.gsub(/^www\./, '') %>;
rewrite ^ http://<%= @name.gsub(/^www\./, '') %>$uri permanent;
}
<% end %>
<% end -%>
11 changes: 5 additions & 6 deletions templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ 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 %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @root -%>
Expand Down
48 changes: 30 additions & 18 deletions templates/vhost/vhost_location_alias.erb
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
location <%= @location %> {
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%>
<%= value %>
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% 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 %>;
<% end %>
<% 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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%>
<%= value %>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

}
35 changes: 20 additions & 15 deletions templates/vhost/vhost_location_directory.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
<% 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 %>
<% 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 defined? @www_root -%>
Expand All @@ -43,18 +42,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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%>
<%= value %>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}
18 changes: 5 additions & 13 deletions templates/vhost/vhost_location_empty.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
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 %>
<% end %>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<%= key %> <%= subkey %> <%= subvalue %>;
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}

50 changes: 30 additions & 20 deletions templates/vhost/vhost_location_fastcgi.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
location <%= @location %> {
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%>
<%= value %>
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% 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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if defined? @www_root -%>
Expand All @@ -31,20 +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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%>
<%= value %>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

}

53 changes: 32 additions & 21 deletions templates/vhost/vhost_location_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@
<% if @location_deny -%><% @location_deny.each do |deny_rule| -%>
deny <%= deny_rule %>;
<% end -%><% end -%>
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |value| -%>
<%= value %>;
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% 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 %>
<% end %>
<%= key %> <%=subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @proxy_cache -%>
Expand All @@ -38,19 +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 %>
<% end %>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end %>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |value| -%>
<%= value %>;
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= subkey %> <%= asubvalue %>;
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |asubvalue| -%>
<%= key %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% end -%>

}

Loading

0 comments on commit b27e446

Please sign in to comment.