feat(dependencies): Add postinstall process and swagger dependency

This commit is contained in:
Matthieu 'JP' DERASSE
2022-07-15 22:16:59 +00:00
parent f04f5513ab
commit 7c9cc568ab
8 changed files with 430 additions and 22 deletions

View File

@ -31,7 +31,10 @@ func init() {
func runUpgradeAction(cmd *cobra.Command, args []string) {
dependencies := []dependencies.Dependency{dependencies.Golang{}}
dependencies := []dependencies.Dependency{
dependencies.Golang{},
dependencies.Swagger{},
}
for _, dependency := range dependencies {
@ -95,7 +98,7 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
installDirectory = helpers.IsValidPathInput()
}
log.Infof("The following command will be executed:\n%s", dependency.DescribeInstall(installDirectory))
log.Infof("%s", dependency.DescribeInstall(installDirectory))
log.Info("Do you want to continue ?")
answer := helpers.YesOrNoInput()
if !answer {
@ -111,6 +114,21 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
return
}
log.Infof("%s", dependency.DescribePostInstall(installDirectory))
log.Info("Do you want to continue ?")
answer = helpers.YesOrNoInput()
if !answer {
log.Warnf("Skipping post installation of %s. Some part of the application might not be able to work correctly!", dependency.GetName())
continue
}
log.Debug("Launching post install")
err = dependency.PostInstall(installDirectory)
if err != nil {
log.Errorf("Fail to execute post install of %s. The following error happen: %s", dependency.GetName(), err.Error())
return
}
log.Infof("%s successfully installed", dependency.GetName())
}
}