Defined Type: asdf::plugin

Defined in:
manifests/plugin.pp

Overview

Define plugin type for asdf

Parameters:

  • repo (String[1])
  • ensure (Enum['present', 'absent', 'latest']) (defaults to: 'latest')
  • shortname (String[1]) (defaults to: $title)
  • versions (Variant[Undef, Array[String[1]]]) (defaults to: undef)


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
# File 'manifests/plugin.pp', line 2

define asdf::plugin (
  String[1] $repo,
  Enum['present', 'absent', 'latest'] $ensure = 'latest',
  String[1] $shortname = $title,
  Variant[Undef, Array[String[1]]] $versions = undef
) {
  if $shortname == undef {
    $_shortname = split($repo, '-')[-1]
  } else {
    $_shortname = $shortname
  }

  $plugin_path = "${asdf::path}/plugins/${_shortname}"
  $version_path = "${asdf::path}/installs/${_shortname}"

  vcsrepo { $plugin_path:
    ensure   => $ensure,
    provider => git,
    source   => $repo,
    owner    => $asdf::owner,
    group    => $asdf::group,
    require  => Vcsrepo[$asdf::path]
  }

  if $ensure == 'absent' {
    file { $version_path:
      ensure => absent,
      force  => true
    }
  }
}