Пример #1
0
// UpdatePlugins updates all the currently installed plugins to its latest version
func UpdatePlugins() {
	var failedPlugin []string
	for _, pluginInfo := range plugin.GetPluginsInfo() {
		logger.Info("Updating plugin '%s'", pluginInfo.Name)
		passed := HandleUpdateResult(InstallPlugin(pluginInfo.Name, ""), pluginInfo.Name, false)
		if !passed {
			failedPlugin = append(failedPlugin, pluginInfo.Name)
		}
		fmt.Println()
	}
	if len(failedPlugin) > 0 {
		logger.Fatalf("Failed to update '%s' plugins.", strings.Join(failedPlugin, ", "))
	}
	logger.Info("Successfully updated all the plugins.")
}
Пример #2
0
func UpdatePlugins() {
	var failedPlugin []string
	for _, pluginInfo := range plugin.GetPluginsInfo() {
		logger.Info("Updating plugin '%s'", pluginInfo.Name)
		err := downloadAndInstall(pluginInfo.Name, "", fmt.Sprintf("Successfully updated plugin => %s", pluginInfo.Name))
		if err != nil {
			logger.Error(err.Error())
			failedPlugin = append(failedPlugin, pluginInfo.Name)
		}
		fmt.Println()
	}
	if len(failedPlugin) > 0 {
		logger.Error("Failed to update '%s' plugins.", strings.Join(failedPlugin, ", "))
		os.Exit(1)
	}
	logger.Info("Successfully updated all the plugins.")
	os.Exit(0)
}