-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathdefinition.pp
31 lines (28 loc) · 880 Bytes
/
definition.pp
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
define rbenv::definition(
$user,
$source,
$ruby = $title,
$group = $user,
$home = '',
$root = ''
) {
$home_path = $home ? { '' => "/home/${user}", default => $home }
$root_path = $root ? { '' => "${home_path}/.rbenv", default => $root }
$destination = "${root_path}/plugins/ruby-build/share/ruby-build/${ruby}"
if $source =~ /^puppet:/ {
file { "rbenv::definition-file ${user} ${ruby}":
ensure => file,
source => $source,
group => $group,
path => $destination,
require => Exec["rbenv::plugin::checkout ${user} ruby-build"],
}
} elsif $source =~ /http(s)?:/ {
exec { "rbenv::definition-file ${user} ${ruby}":
command => "wget ${source} -O ${destination}",
creates => $destination,
user => $user,
require => Exec["rbenv::plugin::checkout ${user} ruby-build"],
}
}
}