summaryrefslogtreecommitdiffstats
path: root/modules/package/manifests/cargo.pp
blob: 799d28e972cb258ef59c43782686650a008339ae (plain) (blame)
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
define package::cargo($package, $user, $ensure) {
  case $ensure {
    'installed': {
      exec { "cargo install $name":
        provider => "shell",
        command => "cargo install $name",
        unless => "cargo install --list | grep -q '^$name'",
        require => [
          User[$user],
          Rust::User[$user],
        ];
      }
    }
    'absent': {
      exec { "uninstall $name":
        provider => "shell",
        command => "cargo uninstall $name",
        onlyif => "cargo install --list | grep -q '^$name'",
        require => [
          User[$user],
          Rust::User[$user],
        ];
      }
    }
  }
}