예제 #1
0
func upgradeAllCommand(c CommandLine) error {
	pluginDir := c.GlobalString("path")

	localPlugins := services.GetLocalPlugins(pluginDir)

	remotePlugins, err := services.ListAllPlugins()

	if err != nil {
		return err
	}

	pluginsToUpgrade := make([]m.InstalledPlugin, 0)

	for _, localPlugin := range localPlugins {
		for _, remotePlugin := range remotePlugins.Plugins {
			if localPlugin.Id == remotePlugin.Id {
				if ShouldUpgrade(localPlugin.Info.Version, remotePlugin) {
					pluginsToUpgrade = append(pluginsToUpgrade, localPlugin)
				}
			}
		}
	}

	for _, p := range pluginsToUpgrade {
		log.Infof("lets upgrade %v \n", p)

		services.RemoveInstalledPlugin(pluginDir, p.Id)
		InstallPlugin(p.Id, pluginDir, "")
	}

	return nil
}
예제 #2
0
func listremoteCommand(c CommandLine) error {
	plugin, err := services.ListAllPlugins()

	if err != nil {
		return err
	}

	for _, i := range plugin.Plugins {
		log.Infof("id: %v version:\n", i.Id)
	}

	return nil
}