feat(dependency): Add git andd handle dependency th cannot be installed by the app

This commit is contained in:
Matthieu 'JP' DERASSE
2022-07-16 15:46:09 +00:00
parent 7c9cc568ab
commit ce433832f7
18 changed files with 148 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd
@ -7,6 +7,7 @@ package cmd
import (
"os"
"git.home.m-and-m.ovh/mderasse/boot/helpers/dependencies"
"github.com/spf13/cobra"
log "github.com/sirupsen/logrus"
@ -14,6 +15,11 @@ import (
var verbose = false
var acceptAll = false
var dependencyList = []dependencies.Dependency{
dependencies.Git{},
dependencies.Golang{},
dependencies.Swagger{},
}
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd

View File

@ -1,5 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
Copyright © 2022 Matthieu Derasse <git@derasse.fr>
*/
package cmd
@ -8,7 +8,6 @@ import (
"github.com/spf13/cobra"
"git.home.m-and-m.ovh/mderasse/boot/helpers"
"git.home.m-and-m.ovh/mderasse/boot/helpers/dependencies"
log "github.com/sirupsen/logrus"
)
@ -31,12 +30,9 @@ func init() {
func runUpgradeAction(cmd *cobra.Command, args []string) {
dependencies := []dependencies.Dependency{
dependencies.Golang{},
dependencies.Swagger{},
}
log.Debug("Starting Upgrade command")
for _, dependency := range dependencies {
for _, dependency := range dependencyList {
log.Debugf("Checking if dependency %s is supported", dependency.GetName())
@ -53,6 +49,11 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
log.Infof("Your %s is not supported.", dependency.GetName())
if !dependency.CanBeInstalled() {
log.Warnf("%s cannot be installed by Goguik. Please install it by yourself !", dependency.GetName())
continue
}
if !acceptAll {
log.Infof("Do you want to install the following version: %s", dependency.GetMinimumVersion())