Skip to content

Commit

Permalink
Added the ability to define the IndexStyleSheet setting for a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
genebean committed May 27, 2015
1 parent aff0c2b commit 53a0d73
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1924,9 +1924,10 @@ Allows configuration settings for [directory indexing](http://httpd.apache.org/d
apache::vhost { 'sample.example.net':
docroot => '/path/to/directory',
directories => [
{ path => '/path/to/directory',
options => ['Indexes','FollowSymLinks','MultiViews'],
index_options => ['IgnoreCase', 'FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'DescriptionWidth=*', 'SuppressHTMLPreamble'],
{ path => '/path/to/directory',
directoryindex => 'disabled', # this is needed on Apache 2.4 or mod_autoindex doesn't work
options => ['Indexes','FollowSymLinks','MultiViews'],
index_options => ['IgnoreCase', 'FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'DescriptionWidth=*', 'SuppressHTMLPreamble'],
},
],
}
Expand All @@ -1948,6 +1949,23 @@ Sets the [default ordering](http://httpd.apache.org/docs/current/mod/mod_autoind
}
```

######`index_style_sheet`

Sets the [IndexStyleSheet](http://httpd.apache.org/docs/current/mod/mod_autoindex.html#indexstylesheet) which adds a CSS stylesheet to the directory index.

```puppet
apache::vhost { 'sample.example.net':
docroot => '/path/to/directory',
directories => [
{ path => '/path/to/directory',
options => ['Indexes','FollowSymLinks','MultiViews'],
index_options => ['FancyIndexing'],
index_style_sheet => '/styles/style.css',
},
],
}
```

######`options`

Lists the [Options](http://httpd.apache.org/docs/current/mod/core.html#options) for the given Directory block.
Expand Down
14 changes: 14 additions & 0 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@
'provider' => 'files',
'require' => 'all granted',
},
{ 'path' => '/var/www/files/indexed_directory',
'directoryindex' => 'disabled',
'options' => ['Indexes','FollowSymLinks','MultiViews'],
'index_options' => ['FancyIndexing'],
'index_style_sheet' => '/styles/style.css',
},
],
'error_log' => false,
'error_log_file' => 'httpd_error_log',
Expand Down Expand Up @@ -360,6 +366,14 @@
:content => /^\s+Require all denied$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+Require all granted$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+Options\sIndexes\sFollowSymLinks\sMultiViews$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+IndexOptions\sFancyIndexing$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+IndexStyleSheet\s'\/styles\/style\.css'$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-directories').with(
:content => /^\s+DirectoryIndex\sdisabled$/ ) }
it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') }
it { is_expected.to contain_concat__fragment('rspec.example.com-logging') }
it { is_expected.to contain_concat__fragment('rspec.example.com-serversignature') }
Expand Down
3 changes: 3 additions & 0 deletions templates/vhost/_directories.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<%- end -%>
<%- if directory['index_order_default'] -%>
IndexOrderDefault <%= Array(directory['index_order_default']).join(' ') %>
<%- end -%>
<%- if directory['index_style_sheet'] -%>
IndexStyleSheet '<%= directory['index_style_sheet'] %>'
<%- end -%>
<%- if directory['allow_override'] -%>
AllowOverride <%= Array(directory['allow_override']).join(' ') %>
Expand Down

0 comments on commit 53a0d73

Please sign in to comment.