func installPlugins(plugins ...string) error { for _, plugin := range plugins { lockfile := updateLockPath + "." + plugin LogIfError(golock.Lock(lockfile)) } err := gode.InstallPackage(plugins...) for _, plugin := range plugins { lockfile := updateLockPath + "." + plugin LogIfError(golock.Unlock(lockfile)) } return err }
func installPlugins(names ...string) error { for _, name := range names { lockfile := updateLockPath + "." + name LogIfError(golock.Lock(lockfile)) } err := gode.InstallPackage(names...) plugins := make([]*Plugin, 0, len(names)) for _, name := range names { plugins = append(plugins, getPlugin(name, true)) } AddPluginsToCache(plugins...) for _, name := range names { lockfile := updateLockPath + "." + name LogIfError(golock.Unlock(lockfile)) } return err }
func updatePlugins() { plugins := PluginNamesNotSymlinked() if len(plugins) == 0 { return } Err("Updating plugins... ") packages, err := gode.OutdatedPackages(plugins...) PrintError(err) if len(packages) > 0 { for name, version := range packages { lockfile := updateLockPath + "." + name LogIfError(golock.Lock(lockfile)) err := gode.InstallPackage(name + "@" + version) PrintError(err) AddPluginsToCache(getPlugin(name, true)) LogIfError(golock.Unlock(lockfile)) } Errf("done. Updated %d %s.\n", len(packages), plural("package", len(packages))) } else { Errln("no plugins to update.") } }