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..ce6031c89082a4159844933ff1bce71660143b07 |
--- /dev/null |
+++ b/modules/ruby/manifests/init.pp |
@@ -0,0 +1,47 @@ |
+# == 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 build and install. |
+# |
+# === Examples: |
+# |
+# class {'ruby': |
+# version => '2.2.0', |
+# } |
+# |
+class ruby( |
+ $version = '2.1.5', |
+) { |
+ |
+ $install_src_url = 'https://github.com/postmodern/ruby-install.git' |
+ $install_src_dir = '/root/ruby-install' |
+ $install_command = "$install_src_dir/bin/ruby-install" |
+ |
+ Exec { |
+ logoutput => true, |
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', |
+ } |
+ |
+ if !defined(Package['git']) { |
+ |
+ package {'git': |
+ ensure => 'installed', |
+ } |
+ } |
+ |
+ exec {'ruby-clone-ruby-install': |
+ command => shellquote('git', 'clone', $install_src_url, $install_src_dir), |
+ creates => $install_src_dir, |
+ require => Package['git'], |
+ } |
+ -> |
+ exec {'ruby-execute-ruby-install': |
+ command => shellquote($install_command, '--system', 'ruby', $version), |
+ creates => '/usr/local/bin/ruby', |
+ } |
+} |