Skip to content

Commit

Permalink
Add compose prerequisite
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Jun 17, 2024
1 parent df6b2f3 commit 1a96a6d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions zk_toolbox/crates/common/src/prerequisites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const PREREQUISITES: [Prerequisite; 5] = [
},
];

const DOCKER_COMPOSE_PREREQUISITE: Prerequisite = Prerequisite {
name: "docker compose",
download_link: "https://docs.docker.com/compose/install/",
};

struct Prerequisite {
name: &'static str,
download_link: &'static str,
Expand All @@ -39,6 +44,10 @@ pub fn check_prerequisites(shell: &Shell) {
}
}

if !check_docker_compose_prerequisite(shell) {
missing_prerequisites.push(&DOCKER_COMPOSE_PREREQUISITE);
}

if !missing_prerequisites.is_empty() {
logger::error("Prerequisite check has failed");
logger::error_note(
Expand All @@ -59,3 +68,9 @@ pub fn check_prerequisites(shell: &Shell) {
fn check_prerequisite(shell: &Shell, name: &str) -> bool {
Cmd::new(cmd!(shell, "which {name}")).run().is_ok()
}

fn check_docker_compose_prerequisite(shell: &Shell) -> bool {
Cmd::new(cmd!(shell, "docker compose version"))
.run()
.is_ok()
}

0 comments on commit 1a96a6d

Please sign in to comment.