blob: 1524de31eae7526381a028b0f814e58d276a7707 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Class bundler::install
#
# Installs bundler Ruby gem manager
#
# == Parameters
#
# [*install_method*]
# How to install bundler, 'rvm' is the default
# [*ruby_version*]
# Ruby version that bundler will use.
#
# == Examples
#
#
# == Requires:
#
# If use_rvm = 'true':
# include rvm
#
class bundler::install (
$ruby_version = undef,
$ensure = 'present',
$install_method = 'rvm',
$use_rvm = '',
) inherits bundler::params {
# deprecation warning
if $use_rvm != '' {
warning('$use_rvm is deprecated, please use $install_method instead')
}
if ( $install_method == undef ) or ( $install_method == 'package' ) {
$provider_method = undef
}
else {
# backwards compatibility
if $use_rvm == false {
$provider_method = gem
}
else {
$provider_method = $bundler::params::install_method
}
}
if $provider_method == 'rvm' {
if $ruby_version == undef {
fail('When using rvm, you must pass a ruby_version')
}
else {
#Install bundler with correct RVM
rvm_gem { 'bundler':
ensure => $ensure,
ruby_version => $ruby_version,
}
}
}
else {
package { 'bundler':
ensure => $ensure,
provider => $provider_method,
}
}
}
|