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
|
# File 'manifests/plugin.pp', line 1
define rbenv::plugin(
$user,
$source,
$plugin_name = $title,
$group = $user,
$home = '',
$root = '',
$timeout = 100
) {
$home_path = $home ? { '' => "/home/${user}", default => $home }
$root_path = $root ? { '' => "${home_path}/.rbenv", default => $root }
$plugins = "${root_path}/plugins"
$destination = "${plugins}/${plugin_name}"
if $source !~ /^git:/ {
fail('Only git plugins are supported')
}
if ! defined(File["rbenv::plugins ${user}"]) {
file { "rbenv::plugins ${user}":
ensure => directory,
path => $plugins,
owner => $user,
group => $group,
require => Exec["rbenv::checkout ${user}"],
}
}
exec { "rbenv::plugin::checkout ${user} ${plugin_name}":
command => "git clone ${source} ${destination}",
user => $user,
group => $group,
creates => $destination,
path => ['/usr/bin', '/usr/sbin'],
timeout => $timeout,
cwd => $home_path,
require => File["rbenv::plugins ${user}"],
}
}
|