| Index: modules/ruby/manifests/init.pp |
| diff --git a/modules/ruby/manifests/init.pp b/modules/ruby/manifests/init.pp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2f28e1a2f729cd25374c5b97d6e2f086e1826731 |
| --- /dev/null |
| +++ b/modules/ruby/manifests/init.pp |
| @@ -0,0 +1,48 @@ |
| +# == Class: ruby |
| +# |
| +# Perform a custom Ruby installation based on the ruby-install script, |
| +# using /usr/local as installation prefix. |
| +# |
| +# === Parameters: |
| +# |
| +# [*version*] |
| +# The Ruby version to clone and build. |
| +# |
| +# === Examples: |
| +# |
| +# class {'ruby': |
| +# version => '2.2.0', |
| +# } |
| +# |
| +class ruby( |
| + $version = '2.1.5', |
| +) { |
| + |
| + $ruby_install_source_url = 'https://github.com/postmodern/ruby-install.git' |
| + $ruby_install_source_dir = "/root/ruby-install" |
| + |
| + Package { |
| + ensure => 'installed', |
| + } |
| + |
| + Exec { |
| + logoutput => true, |
| + path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', |
| + } |
| + |
| + if !defined(Package['git']) { |
| + package {'git': } |
| + } |
| + |
| + exec {'ruby-clone-ruby-install': |
| + command => shellquote('git', 'clone', $ruby_install_source_url, $ruby_install_source_dir), |
| + creates => $ruby_install_source_dir, |
| + } |
| + -> |
| + exec {'ruby-execute-ruby-install': |
| + command => shellquote("$ruby_install_source_dir/bin/ruby-install", '--system', 'ruby', $ruby_version), |
| + creates => "/usr/local/bin/ruby", |
| + } |
| + |
| + Exec['ruby-clone-ruby-install'] <- Package['git'] |
| +} |