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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'manifests/version.pp', line 8
define ruby::version(
$ensure = 'installed',
$env = {},
$version = $name
) {
require ruby
require ruby::build
$alias_hash = hiera_hash('ruby::version::alias', {})
if has_key($alias_hash, $version) {
$to = $alias_hash[$version]
ruby::alias { $version:
ensure => $ensure,
to => $to,
}
} else {
case $version {
/jruby/: { require 'java' }
default: { }
}
$default_env = {
'CC' => '/usr/bin/cc',
}
if $::operatingsystem == 'Darwin' {
include homebrew::config
include boxen::config
ensure_resource('package', 'readline')
Package['readline'] -> Ruby <| |>
}
$hierdata = hiera_hash('ruby::version::env', {})
if has_key($hierdata, $::operatingsystem) {
$os_env = $hierdata[$::operatingsystem]
} else {
$os_env = {}
}
if has_key($hierdata, $version) {
$version_env = $hierdata[$version]
} else {
$version_env = {}
}
$_env = merge(merge(merge($default_env, $os_env), $version_env), $env)
if has_key($_env, 'CC') and $_env['CC'] =~ /gcc/ {
require gcc
}
ruby { $version:
ensure => $ensure,
environment => $_env,
ruby_build => "${ruby::build::prefix}/bin/ruby-build",
user => $ruby::user,
provider => rubybuild,
}
}
}
|