summaryrefslogtreecommitdiffstats
path: root/modules/package/manifests/cargo.pp
blob: 9a5af1ca6964d69552dc7ecf872d7d79f56cadd4 (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($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],
        ];
      }
    }
  }
}