LEFT | RIGHT |
1 # == Class: ruby | 1 # == Class: ruby |
2 # | 2 # |
3 # Perform a custom Ruby installation based on the ruby-install script, | 3 # Perform a custom Ruby installation based on the ruby-install script, |
4 # using /usr/local as installation prefix. | 4 # using /usr/local as installation prefix. |
5 # | 5 # |
6 # === Parameters: | 6 # === Parameters: |
7 # | 7 # |
8 # [*version*] | 8 # [*version*] |
9 # The Ruby version to build and install. | 9 # The Ruby version to build and install. |
10 # | 10 # |
| 11 # [*logoutput*] |
| 12 # Whether and when to log the output of Exec resources; see |
| 13 # https://docs.puppetlabs.com/references/latest/type.html#exec-attribute-logou
tput |
| 14 # |
11 # === Examples: | 15 # === Examples: |
12 # | 16 # |
13 # class {'ruby': | 17 # class {'ruby': |
14 # version => '2.2.0', | 18 # version => '2.2.0', |
| 19 # logoutput => true, |
15 # } | 20 # } |
16 # | 21 # |
17 class ruby( | 22 class ruby( |
18 $version = '2.1.5', | 23 $version = '2.1.5', |
| 24 $logoutput = 'on_failure', |
19 ) { | 25 ) { |
20 | 26 |
21 $install_src_url = 'https://github.com/postmodern/ruby-install.git' | 27 $install_src_url = 'https://github.com/postmodern/ruby-install.git' |
22 $install_src_dir = '/root/ruby-install' | 28 $install_src_dir = '/root/ruby-install' |
23 $install_command = "$install_src_dir/bin/ruby-install" | 29 $install_command = "$install_src_dir/bin/ruby-install" |
24 | 30 |
25 Exec { | 31 Exec { |
26 logoutput => true, | 32 logoutput => true, |
27 path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', | 33 path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', |
28 } | 34 } |
29 | 35 |
30 if !defined(Package['git']) { | 36 if !defined(Package['git']) { |
31 | 37 |
32 package {'git': | 38 package {'git': |
33 ensure => 'installed', | 39 ensure => 'installed', |
34 } | 40 } |
35 } | 41 } |
36 | 42 |
37 exec {'ruby-clone-ruby-install': | 43 exec {'ruby-clone-ruby-install': |
38 command => shellquote('git', 'clone', $install_src_url, $install_src_dir), | 44 command => shellquote('git', 'clone', $install_src_url, $install_src_dir), |
39 creates => $install_src_dir, | 45 creates => $install_src_dir, |
| 46 logoutput => $logoutput, |
40 require => Package['git'], | 47 require => Package['git'], |
41 } | 48 } |
42 -> | 49 -> |
43 exec {'ruby-execute-ruby-install': | 50 exec {'ruby-execute-ruby-install': |
44 command => shellquote($install_command, '--system', 'ruby', $version), | 51 command => shellquote($install_command, '--system', 'ruby', $version), |
45 creates => '/usr/local/bin/ruby', | 52 creates => '/usr/local/bin/ruby', |
| 53 logoutput => $logoutput, |
46 } | 54 } |
47 } | 55 } |
LEFT | RIGHT |