1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
define cgit::filter (
String $filtername = $name,
Optional[String] $source = undef,
Optional[String] $content = undef,
Hash $file_props = {},
Enum['lua', 'exec'] $type = stdlib::extname($source) ? {
'.lua' => 'lua',
default => 'exec',
}
) {
include ::cgit::filter_setup
$valid_filters = [
'about',
'auth',
'commit',
'email',
'owner',
'source',
]
if ! member($valid_filters, $filtername) {
crit("${filtername} not a valid cgit filter")
}
$dest = "${cgit::filterpath}/${filtername}-filter"
file { $dest:
ensure => file,
mode => $type ? {
'lua' => '0444',
'exec' => '0555',
},
source => $source,
content => $content,
* => $file_props,
}
concat::fragment { "cgit config filter ${filtername}":
target => $::cgit::cgitrc,
content => "${filtername}-filter=${type}:${dest}\n",
}
}
|