MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Update

Method Update

pkg/devspace/plugin/plugin.go:174–203  ·  view source on GitHub ↗
(name, version string)

Source from the content-addressed store, hash-verified

172}
173
174func (c *client) Update(name, version string) (*Metadata, error) {
175 path, metadata, err := c.GetByName(name)
176 if err != nil {
177 return nil, err
178 } else if metadata == nil {
179 return nil, fmt.Errorf("couldn't find plugin %s", name)
180 }
181
182 oldVersion, err := c.parseVersion(metadata.Version)
183 if err != nil {
184 return nil, errors.Wrap(err, "parse old version")
185 }
186
187 newMetadata, err := c.installer.DownloadMetadata(path, version)
188 if err != nil {
189 return nil, err
190 }
191
192 newVersion, err := c.parseVersion(newMetadata.Version)
193 if err != nil {
194 return nil, errors.Wrap(err, "parse new version")
195 }
196
197 if oldVersion.EQ(newVersion) {
198 return nil, &NewestVersionError{newVersion.String()}
199 }
200
201 c.log.Infof("Updating plugin %s to version %s", name, newMetadata.Version)
202 return c.install(path, version)
203}
204
205func (c *client) parseVersion(version string) (semver.Version, error) {
206 if len(version) == 0 {

Callers

nothing calls this directly

Calls 7

GetByNameMethod · 0.95
parseVersionMethod · 0.95
installMethod · 0.95
DownloadMetadataMethod · 0.65
ErrorfMethod · 0.45
StringMethod · 0.45
InfofMethod · 0.45

Tested by

no test coverage detected