feat(cli): make repo url a parameter

this is a quick hack to support repo url as parameter. Will refactor
later
This commit is contained in:
bergquist
2016-03-07 13:29:45 +01:00
parent 3d2d8f2d86
commit f6c5242a93
6 changed files with 20 additions and 15 deletions
@@ -45,11 +45,11 @@ func installCommand(c CommandLine) error {
log.Infof("version: %v\n", version)
return InstallPlugin(pluginToInstall, pluginFolder, version)
return InstallPlugin(pluginToInstall, pluginFolder, version, c.GlobalString("repo"))
}
func InstallPlugin(pluginName, pluginFolder, version string) error {
plugin, err := s.GetPlugin(pluginName)
func InstallPlugin(pluginName, pluginFolder, version, repoUrl string) error {
plugin, err := s.GetPlugin(pluginName, repoUrl)
if err != nil {
return err
}
@@ -77,7 +77,7 @@ func InstallPlugin(pluginName, pluginFolder, version string) error {
res, _ := s.ReadPlugin(pluginFolder, pluginName)
for _, v := range res.Dependency.Plugins {
InstallPlugin(v.Id, pluginFolder, "")
InstallPlugin(v.Id, pluginFolder, "", repoUrl)
log.Infof("Installed Dependency: %v ✔\n", v.Id)
}
@@ -6,7 +6,7 @@ import (
)
func listremoteCommand(c CommandLine) error {
plugin, err := s.ListAllPlugins()
plugin, err := s.ListAllPlugins(c.GlobalString("repo"))
if err != nil {
return err
@@ -32,7 +32,7 @@ func upgradeAllCommand(c CommandLine) error {
localPlugins := s.GetLocalPlugins(pluginDir)
remotePlugins, err := s.ListAllPlugins()
remotePlugins, err := s.ListAllPlugins(c.GlobalString("repo"))
if err != nil {
return err
@@ -54,7 +54,7 @@ func upgradeAllCommand(c CommandLine) error {
log.Infof("Upgrading %v \n", p.Id)
s.RemoveInstalledPlugin(pluginDir, p.Id)
InstallPlugin(p.Id, pluginDir, "")
InstallPlugin(p.Id, pluginDir, "", c.GlobalString("repo"))
}
return nil
@@ -14,7 +14,7 @@ func upgradeCommand(c CommandLine) error {
return err
}
remotePlugins, err2 := s.ListAllPlugins()
remotePlugins, err2 := s.ListAllPlugins(c.GlobalString("repo"))
if err2 != nil {
return err2
@@ -24,7 +24,7 @@ func upgradeCommand(c CommandLine) error {
if localPlugin.Id == v.Id {
if ShouldUpgrade(localPlugin.Info.Version, v) {
s.RemoveInstalledPlugin(pluginDir, pluginName)
return InstallPlugin(localPlugin.Id, pluginDir, "")
return InstallPlugin(localPlugin.Id, pluginDir, "", c.GlobalString("repo"))
}
}
}