Defined Type: rbenv::plugin

Defined in:
manifests/plugin.pp

Overview

Parameters:

  • user (Any)
  • source (Any)
  • plugin_name (Any) (defaults to: $title)
  • group (Any) (defaults to: $user)
  • home (Any) (defaults to: '')
  • root (Any) (defaults to: '')
  • timeout (Any) (defaults to: 100)


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
32
33
34
35
36
37
38
39
40
# File 'manifests/plugin.pp', line 1

define rbenv::plugin(
  $user,
  $source,
  $plugin_name = $title,
  $group       = $user,
  $home        = '',
  $root        = '',
  $timeout     = 100
) {

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

  if $source !~ /^git:/ {
    fail('Only git plugins are supported')
  }

  if ! defined(File["rbenv::plugins ${user}"]) {
    file { "rbenv::plugins ${user}":
      ensure  => directory,
      path    => $plugins,
      owner   => $user,
      group   => $group,
      require => Exec["rbenv::checkout ${user}"],
    }
  }

  exec { "rbenv::plugin::checkout ${user} ${plugin_name}":
    command => "git clone ${source} ${destination}",
    user    => $user,
    group   => $group,
    creates => $destination,
    path    => ['/usr/bin', '/usr/sbin'],
    timeout => $timeout,
    cwd => $home_path,
    require => File["rbenv::plugins ${user}"],
  }
}