Merge branch 'master' into alerting

This commit is contained in:
Torkel Ödegaard
2016-06-25 09:56:57 -04:00
23 changed files with 286 additions and 87 deletions
+4 -7
View File
@@ -48,13 +48,10 @@ var pluginCommands = []cli.Command{
Usage: "list all installed plugins",
Action: runCommand(lsCommand),
}, {
Name: "uninstall",
Usage: "uninstall <plugin id>",
Action: runCommand(removeCommand),
}, {
Name: "remove",
Usage: "remove <plugin id>",
Action: runCommand(removeCommand),
Name: "uninstall",
Aliases: []string{"remove"},
Usage: "uninstall <plugin id>",
Action: runCommand(removeCommand),
},
}
+15 -3
View File
@@ -33,11 +33,23 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
}
func ReadPlugin(pluginDir, pluginName string) (m.InstalledPlugin, error) {
pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json")
pluginData, _ := IoHelper.ReadFile(pluginDataPath)
distPluginDataPath := path.Join(pluginDir, pluginName, "dist", "plugin.json")
var data []byte
var err error
data, err = IoHelper.ReadFile(distPluginDataPath)
if err != nil {
pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json")
data, err = IoHelper.ReadFile(pluginDataPath)
if err != nil {
return m.InstalledPlugin{}, errors.New("Could not find dist/plugin.json or plugin.json on " + pluginName + " in " + pluginDir)
}
}
res := m.InstalledPlugin{}
json.Unmarshal(pluginData, &res)
json.Unmarshal(data, &res)
if res.Info.Version == "" {
res.Info.Version = "0.0.0"