diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 51 | ||||
-rw-r--r-- | manifests/params.pp | 47 |
2 files changed, 43 insertions, 55 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 6a62838..2b9b265 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,19 +19,54 @@ # To install a specific version of ruby, simply do: # # class { 'ruby': -# version => '1.8.7', +# ruby_version => '1.8.7', # } # -# Supported version: 1.8, 1.8.7, 1.9, 1.9.1, 1.9.3 +# Supported versions: 1.8, 1.8.7, 1.9, 1.9.1, 1.9.3 +# +# To install the development files, you can do: +# +# class { 'ruby': install_dev => true } class ruby ( - $version = $ruby::params::version, - $ruby_dev = $ruby::params::ruby_dev, - $ruby_package = $ruby::params::ruby_package -) inherits ruby::params { + $ruby_version = '', + $version = 'installed', + $install_dev = false +) +{ + + case $::osfamily { + 'redhat', 'suse': { + $ruby_package='ruby' + $ruby_dev='ruby-devel' + } + 'debian': { + case $ruby_version { + '1.8', '1.8.7': { + $ruby_package = 'ruby1.8' + $ruby_dev = [ 'ruby1.8-dev', 'rake' ] + } + '1.9.1': { + $ruby_package = 'ruby1.9.1' + $ruby_dev = [ 'ruby1.9.1-dev', 'rake' ] + } + '1.9', '1.9.3': { + $ruby_package = 'ruby1.9.3' + $ruby_dev = [ 'ruby-dev', 'rake' ] + } + default: { + $ruby_package = 'ruby' + $ruby_dev = [ 'ruby-dev', 'rake' ] + } + } + } + } - package{ 'ruby': + package{ $ruby_package: ensure => $version, - name => $ruby_package + } + + if $install_dev { + package { $ruby_dev: ensure => installed } } } diff --git a/manifests/params.pp b/manifests/params.pp deleted file mode 100644 index e0ae681..0000000 --- a/manifests/params.pp +++ /dev/null @@ -1,47 +0,0 @@ -# Class: ruby::params -# -# This class handles the Ruby module parameters -# -# Parameters: -# $ruby_dev = the name of the Ruby development libraries -# -# Actions: -# -# Requires: -# -# Sample Usage: -# -class ruby::params { - - $version = 'installed' - - case $::osfamily { - 'redhat', 'suse': { - $ruby_dev='ruby-devel' - } - 'debian': { - case $version { - '1.8', '1.8.7': { - $ruby_package = 'ruby1.8' - $ruby_dev = [ 'ruby1.8-dev', 'rake' ] - } - '1.9.1': { - $ruby_package = 'ruby1.9.1' - $ruby_dev = [ 'ruby1.9.1-dev', 'rake' ] - } - '1.9', '1.9.3': { - $ruby_package = 'ruby1.9' - $ruby_dev = [ 'ruby-dev', 'rake' ] - } - default: { - $ruby_package = 'ruby' - $ruby_dev = [ 'ruby-dev', 'rake' ] - } - } - } - default: { - fail("Unsupported OS family: ${::osfamily}") - } - } -} - |