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