Defined Type: rbenv::definition

Defined in:
manifests/definition.pp

Overview

Parameters:

  • user (Any)
  • source (Any)
  • ruby (Any) (defaults to: $title)
  • group (Any) (defaults to: $user)
  • home (Any) (defaults to: '')
  • root (Any) (defaults to: '')


1
2
3
4
5
6
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
# File 'manifests/definition.pp', line 1

define rbenv::definition(
  $user,
  $source,
  $ruby  = $title,
  $group = $user,
  $home  = '',
  $root  = ''
) {

  $home_path = $home ? { '' => "/home/${user}",       default => $home }
  $root_path = $root ? { '' => "${home_path}/.rbenv", default => $root }

  $destination = "${root_path}/plugins/ruby-build/share/ruby-build/${ruby}"

  if $source =~ /^puppet:/ {
    file { "rbenv::definition-file ${user} ${ruby}":
      ensure  => file,
      source  => $source,
      group   => $group,
      path    => $destination,
      require => Exec["rbenv::plugin::checkout ${user} ruby-build"],
    }
  } elsif $source =~ /http(s)?:/ {
    exec { "rbenv::definition-file ${user} ${ruby}":
      command => "wget ${source} -O ${destination}",
      creates => $destination,
      user    => $user,
      require => Exec["rbenv::plugin::checkout ${user} ruby-build"],
    }
  }
}