/// <summary> /// Executes a package installation. /// </summary> /// <param name="package">The package to install.</param> /// <param name="packageRepository">The repository for the package.</param> /// <param name="sourceLocation">The source location.</param> /// <param name="targetPath">The path where to install the package.</param> /// <returns>The package information.</returns> protected PackageInfo ExecuteInstall(IPackage package, IPackageRepository packageRepository, string sourceLocation, string targetPath) { var logger = new NugetLogger(_logger); var project = new FileBasedProjectSystem(targetPath) { Logger = logger }; IPackageRepository referenceRepository; if (package.IsTheme()) { referenceRepository = new ThemeReferenceRepository(project, packageRepository, _themeRegistry); } else { referenceRepository = new PluginReferenceRepository(project, packageRepository, _pluginFinder); } var projectManager = new ProjectManager( packageRepository, new DefaultPackagePathResolver(targetPath), project, referenceRepository ) { Logger = logger }; // add the package to the project projectManager.AddPackageReference(package, true, false); return(new PackageInfo { Id = package.Id, Name = package.Title ?? package.Id, Version = package.Version.ToString(), Type = package.IsTheme() ? "Theme" : "Plugin", Path = targetPath }); }
/// <summary> /// Executes a package installation. /// </summary> /// <param name="package">The package to install.</param> /// <param name="packageRepository">The repository for the package.</param> /// <param name="sourceLocation">The source location.</param> /// <param name="targetPath">The path where to install the package.</param> /// <returns>The package information.</returns> protected PackageInfo ExecuteInstall(IPackage package, IPackageRepository packageRepository, string sourceLocation, string targetPath) { var logger = new NugetLogger(_logger); var project = new FileBasedProjectSystem(targetPath) { Logger = logger }; IPackageRepository referenceRepository; if (package.IsTheme()) { referenceRepository = new ThemeReferenceRepository(project, packageRepository, _themeRegistry); } else { referenceRepository = new PluginReferenceRepository(project, packageRepository, _pluginFinder); } var projectManager = new ProjectManager( packageRepository, new DefaultPackagePathResolver(targetPath), project, referenceRepository ) { Logger = logger }; // add the package to the project projectManager.AddPackageReference(package, true, false); return new PackageInfo { Id = package.Id, Name = package.Title ?? package.Id, Version = package.Version.ToString(), Type = package.IsTheme() ? "Theme" : "Plugin", Path = targetPath }; }