docs: provide installation guidelines for installing missing tools (#2481)

pull/2484/head
Clément Michaud 2021-10-09 20:41:02 +02:00 committed by GitHub
parent 75e2167c19
commit 1f28bc9b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -73,13 +73,18 @@ func runCommand(cmd string, args ...string) {
}
}
func checkCommandExist(cmd string) {
func checkCommandExist(cmd string, resolutionHint string) {
fmt.Print("Checking if '" + cmd + "' command is installed...")
command := exec.Command("bash", "-c", "command -v "+cmd) //nolint:gosec // Used only in development.
err := command.Run()
if err != nil {
log.Fatal("[ERROR] You must install " + cmd + " on your machine.")
msg := "[ERROR] You must install " + cmd + " on your machine."
if resolutionHint != "" {
msg += fmt.Sprintf(" %s", resolutionHint)
}
log.Fatal(msg)
}
fmt.Println(" OK")
@ -199,10 +204,10 @@ func readVersions() {
// Bootstrap bootstrap authelia dev environment.
func Bootstrap(cobraCmd *cobra.Command, args []string) {
bootstrapPrintln("Checking command installation...")
checkCommandExist("node")
checkCommandExist("pnpm")
checkCommandExist("docker")
checkCommandExist("docker-compose")
checkCommandExist("node", "Follow installation guidelines from https://nodejs.org/en/download/package-manager/ or download installer from https://nodejs.org/en/download/")
checkCommandExist("pnpm", "Follow installation guidelines from https://pnpm.io/installation")
checkCommandExist("docker", "Follow installation guidelines from https://docs.docker.com/get-docker/")
checkCommandExist("docker-compose", "Follow installation guidelines from https://docs.docker.com/compose/install/")
bootstrapPrintln("Getting versions of tools")
readVersions()