diff options
Diffstat (limited to 'modules/package/manifests/cargo.pp')
-rw-r--r-- | modules/package/manifests/cargo.pp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/package/manifests/cargo.pp b/modules/package/manifests/cargo.pp new file mode 100644 index 0000000..9a5af1c --- /dev/null +++ b/modules/package/manifests/cargo.pp @@ -0,0 +1,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], + ]; + } + } + } +} |