Commit af1c8dc5 by bergquist

feat(cli): adds support for dist/plugin.json location for plugins

ref #5410
parent 2123fbdf
...@@ -33,11 +33,23 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) { ...@@ -33,11 +33,23 @@ func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
} }
func ReadPlugin(pluginDir, pluginName string) (m.InstalledPlugin, error) { func ReadPlugin(pluginDir, pluginName string) (m.InstalledPlugin, error) {
pluginDataPath := path.Join(pluginDir, pluginName, "plugin.json") distPluginDataPath := path.Join(pluginDir, pluginName, "dist", "plugin.json")
pluginData, _ := IoHelper.ReadFile(pluginDataPath)
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{} res := m.InstalledPlugin{}
json.Unmarshal(pluginData, &res) json.Unmarshal(data, &res)
if res.Info.Version == "" { if res.Info.Version == "" {
res.Info.Version = "0.0.0" res.Info.Version = "0.0.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment