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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'manifests/plugin.pp', line 12
define redmine::plugin (
Enum['installed', 'latest', 'absent'] $ensure = present,
Optional[String] $source = undef,
Optional[String] $version = undef,
Enum['git','svn'] $provider = 'git',
) {
$install_dir = "${redmine::install_dir}/plugins/${name}"
if $ensure == absent {
exec { "rake redmine:plugins:migrate NAME=${name} VERSION=0":
notify => Class['apache::service'],
path => ['/bin','/usr/bin', '/usr/local/bin'],
environment => ['HOME=/root','RAILS_ENV=production','REDMINE_LANG=en'],
provider => 'shell',
cwd => $redmine::install_dir,
before => Vcsrepo[$install_dir],
require => Exec['bundle_update'],
onlyif => "test -d ${install_dir}",
}
$notify = undef
} else {
$notify = Exec['bundle_update']
}
if $source == undef {
fail("no source specified for redmine plugin '${name}'")
}
validate_string($source)
case $provider {
'svn' : {
$provider_package = 'subversion'
}
'hg': {
$provider_package = 'mercurial'
}
default: {
$provider_package = $provider
}
}
ensure_packages($provider_package)
vcsrepo { $install_dir:
ensure => $ensure,
revision => $version,
source => $source,
provider => $provider,
notify => $notify,
require => [Package[$provider_package]
, Exec['bundle_redmine']],
}
}
|