Пример #1
0
func upgradeAllCommand(c CommandLine) error {
	pluginsDir := c.PluginDirectory()

	localPlugins := s.GetLocalPlugins(pluginsDir)

	remotePlugins, err := s.ListAllPlugins(c.GlobalString("repo"))

	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 {
		logger.Infof("Updating %v \n", p.Id)

		s.RemoveInstalledPlugin(pluginsDir, p.Id)
		InstallPlugin(p.Id, "", c)
	}

	return nil
}
Пример #2
0
func upgradeCommand(c CommandLine) error {
	pluginsDir := c.GlobalString("pluginsDir")
	pluginName := c.Args().First()

	localPlugin, err := s.ReadPlugin(pluginsDir, pluginName)

	if err != nil {
		return err
	}

	remotePlugins, err2 := s.ListAllPlugins(c.GlobalString("repo"))

	if err2 != nil {
		return err2
	}

	for _, v := range remotePlugins.Plugins {
		if localPlugin.Id == v.Id {
			if ShouldUpgrade(localPlugin.Info.Version, v) {
				s.RemoveInstalledPlugin(pluginsDir, pluginName)
				return InstallPlugin(localPlugin.Id, "", c)
			}
		}
	}

	return nil
}
Пример #3
0
func listremoteCommand(c CommandLine) error {
	plugin, err := s.ListAllPlugins()

	if err != nil {
		return err
	}

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

	return nil
}
Пример #4
0
func listremoteCommand(c CommandLine) error {
	plugin, err := s.ListAllPlugins(c.GlobalString("repo"))

	if err != nil {
		return err
	}

	for _, i := range plugin.Plugins {
		pluginVersion := ""
		if len(i.Versions) > 0 {
			pluginVersion = i.Versions[0].Version
		}

		log.Infof("id: %v version: %s\n", i.Id, pluginVersion)
	}

	return nil
}