Add OCaml package manager (OPAM) (#62)

This adds support for the OCaml package manager (OPAM).

The command line `opam update` first performs a self-update if
necessary. Then it updates its package list.
Finally, `opam upgrade` upgrades all locally installed packages.
This commit is contained in:
Claudia
2018-09-03 13:45:01 +02:00
committed by Roey Darwish Dror
parent c0ac3e483e
commit c5ea22bac3
3 changed files with 22 additions and 0 deletions

View File

@@ -94,6 +94,23 @@ pub fn run_rustup(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool)
None
}
#[must_use]
pub fn run_opam_update(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> {
if let Some(opam) = utils::which("opam") {
terminal.print_separator("OCaml Package Manager");
let success = || -> Result<(), Error> {
Executor::new(&opam, dry_run).arg("update").spawn()?.wait()?.check()?;
Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?;
Ok(())
}().is_ok();
return Some(("OPAM", success));
}
None
}
#[must_use]
pub fn run_custom_command(name: &str, command: &str, terminal: &mut Terminal, dry_run: bool) -> Result<(), Error> {
terminal.print_separator(name);