Beispiel #1
0
        /// <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
            });
        }
Beispiel #2
0
        private PackageInfo ExecuteUpdate(IPackage package)
        {
            var appPath = CommonHelper.MapPath("~/");

            var logger = new NugetLogger(_logger);

            var project = new FileBasedProjectSystem(appPath)
            {
                Logger = logger
            };

            var nullRepository = new NullSourceRepository();

            var projectManager = new ProjectManager(
                nullRepository,
                new DefaultPackagePathResolver(appPath),
                project,
                nullRepository
                )
            {
                Logger = logger
            };

            // Perform the update
            projectManager.AddPackageReference(package, true, false);

            var info = new PackageInfo
            {
                Id      = package.Id,
                Name    = package.Title ?? package.Id,
                Version = package.Version.ToString(),
                Type    = "App",
                Path    = appPath
            };

            _logger.Information("Update '{0}' successfully executed.".FormatInvariant(info.Name));

            return(info);
        }
		/// <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
			};
		}
        private PackageInfo ExecuteUpdate(IPackage package)
        {
            var appPath = CommonHelper.MapPath("~/");

            var logger = new NugetLogger(_logger);

            var project = new FileBasedProjectSystem(appPath) { Logger = logger };

            var nullRepository = new NullSourceRepository();

            var projectManager = new ProjectManager(
                nullRepository,
                new DefaultPackagePathResolver(appPath),
                project,
                nullRepository
                ) { Logger = logger };

            // Perform the update
            projectManager.AddPackageReference(package, true, false);

            var info = new PackageInfo
            {
                Id = package.Id,
                Name = package.Title ?? package.Id,
                Version = package.Version.ToString(),
                Type = "App",
                Path = appPath
            };

            _logger.Information("Update '{0}' successfully executed.".FormatInvariant(info.Name));

            return info;
        }