| 26 | type pluginReposFetcher func() []models.PluginRepo |
| 27 | |
| 28 | func NewPluginInstaller(context *Context) PluginInstaller { |
| 29 | var installer PluginInstaller |
| 30 | |
| 31 | pluginDownloader := &PluginDownloader{UI: context.UI, FileDownloader: context.FileDownloader} |
| 32 | if context.RepoName == "" { |
| 33 | installer = &pluginInstallerWithoutRepo{ |
| 34 | UI: context.UI, |
| 35 | PluginDownloader: pluginDownloader, |
| 36 | RepoName: context.RepoName, |
| 37 | } |
| 38 | } else { |
| 39 | installer = &pluginInstallerWithRepo{ |
| 40 | UI: context.UI, |
| 41 | PluginDownloader: pluginDownloader, |
| 42 | RepoName: context.RepoName, |
| 43 | Checksummer: context.Checksummer, |
| 44 | PluginRepo: context.PluginRepo, |
| 45 | GetPluginRepos: context.GetPluginRepos, |
| 46 | } |
| 47 | } |
| 48 | return installer |
| 49 | } |