Defined Type: ruby::alias

Defined in:
manifests/alias.pp

Overview

Parameters:

  • ensure (Any) (defaults to: 'installed')
  • to (Any) (defaults to: undef)
  • version (Any) (defaults to: $title)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'manifests/alias.pp', line 7

define ruby::alias(
  $ensure  = 'installed',
  $to      = undef,
  $version = $title,
) {

  require ruby

  if $to == undef {
    fail('to cannot be undefined')
  }

  if $ensure != 'absent' {
    ensure_resource('ruby::version', $to)
  }

  $file_ensure = $ensure ? {
    /^(installed|present)$/ => 'symlink',
    default                 => $ensure,
  }

  file { "/opt/rubies/${version}":
    ensure  => $file_ensure,
    force   => true,
    target  => "/opt/rubies/${to}",
    require => Ruby::Version[$to],
  }
}