Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DeploymentConfiguration()
 {
     ProductConfigurationSource = new ProductConfigurationSource();
     PackageConfigurationSource = new PackageConfigurationSource();
     DeploymentStrategySource   = new DeploymentStrategySource();
     TransactionSource          = new DeploymentTransactionSource();
     PackageDeployer            = new PackageDeployer();
     PackageDiscoverer          = new PackageDiscoverer();
 }
Esempio n. 2
0
        public IDeploymentEngine CreatEngine(string productPath, string framework)
        {
            var packageConfigurationProvider = PackageConfigurationSource.GetPackageConfigurationProvider();
            var productConfigurationProvider = ProductConfigurationSource.GetProductConfigurationProvider(productPath);
            var deploymentContext            = new DefaultDeploymentContext(productPath, framework, packageConfigurationProvider,
                                                                            productConfigurationProvider);

            return(CreatEngine(deploymentContext));
        }
Esempio n. 3
0
        /// <summary>
        /// Creates IRuntimeEngine for the defined configuration
        /// </summary>
        /// <param name="runtimeContext">Custom runtime context</param>
        /// <returns>Configured runtime engine</returns>
        public IRuntimeEngine CreateEngine(RuntimeContext runtimeContext)
        {
            foreach (var serviceFactory in ServiceFactories)
            {
                runtimeContext.RegisterHostService(serviceFactory.Key, serviceFactory.Value);
            }

            return(new RuntimeEngine(runtimeContext,
                                     ProductConfigurationSource.GetProductConfigurationProvider(runtimeContext.ProductPath)));
        }
Esempio n. 4
0
        public async Task IntegratedTest()
        {
            using (var helper = new TestDeploymentHelper().WithConfiguration().AndNuGetSource())
            {
                var options = new UninstallationOptions {
                    RemoveDependencies = false
                };

                var engine = helper.CreatEngine();
                await engine.InstallPackages(
                    new[] { new PackageId("Newtonsoft.Json/8.0.3"), new PackageId("bootstrap/3.3.7") },
                    new InstallationOptions { AllowDowngrades = false, UpdatePackages = false });

                var source        = new ProductConfigurationSource();
                var productConfig = source.GetProductConfigurationProvider(helper.InstallPath);
                var packageConfig = productConfig.GetPackageConfiguration(new PackageId("bootstrap/3.3.7"));
                var metadata      = packageConfig.GetPackageMetadata();
                metadata.Title.Should().Be("Bootstrap CSS");

                var files = Directory.GetFiles(helper.InstallPath);
                files.Length.Should().Be(3);

                var dirs = Directory.GetDirectories(helper.InstallPath);
                dirs.Length.Should().Be(3);

                engine = helper.CreatEngine();
                await engine.InstallPackages(new[] { new PackageId("Newtonsoft.Json/9.0.1") },
                                             new InstallationOptions { AllowDowngrades = false, UpdatePackages = true });

                engine = helper.CreatEngine();
                await engine.UninstallPackages(new[] { new PackageId("Newtonsoft.Json/9.0.1") }, options);

                files = Directory.GetFiles(helper.InstallPath);
                files.Length.Should().Be(1, "because Newtonsoft.Json is uninstalled");

                engine = helper.CreatEngine();
                await engine.UninstallPackages(new[] { new PackageId("bootstrap/3.3.7") }, options);

                dirs = Directory.GetDirectories(helper.InstallPath);
                dirs.Length.Should().Be(1);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DeploymentConfiguration()
 {
     ProductConfigurationSource = new ProductConfigurationSource();
     PackageConfigurationSource = new PackageConfigurationSource();
     DeploymentStrategySource   = new DeploymentStrategySource();
 }