public void ModifiesFolders()
            {
                // Given
                FileSystem fileSystem = new FileSystem
                {
                    RootPath = @"C:/A",
                    OutputPath = "C"
                };
                fileSystem.InputPaths.Add("B");
                PackagesCollection packages = new PackagesCollection(fileSystem);
                AssemblyCollection assemblies = new AssemblyCollection();
                string setup = @"
                FileSystem.RootPath = @""C:\X"";
                FileSystem.InputPaths.Add(""Y"");
                FileSystem.OutputPath = ""Z"";
                ";
                SetupScript setupScript = new SetupScript(setup);
                setupScript.Compile();

                // When
                setupScript.Invoke(packages, assemblies, fileSystem);

                // Then
                Assert.AreEqual(@"C:/X", fileSystem.RootPath.FullPath);
                Assert.AreEqual(@"Z", fileSystem.OutputPath.FullPath);
                CollectionAssert.AreEquivalent(new[] { "input", "B", "Y" }, fileSystem.InputPaths.Select(x => x.FullPath));
            }
Exemple #2
0
        private void Setup(ConfigParts configParts, bool updatePackages)
        {
            try
            {
                // Compile and evaluate the script
                using (Trace.WithIndent().Verbose("Evaluating setup script"))
                {
                    SetupScript setupScript = new SetupScript(configParts.Setup);
                    OutputScript(SetupScript.AssemblyName, setupScript.Code);
                    setupScript.Compile();
                    setupScript.Invoke(_packages, _assemblyCollection, _fileSystem);
                }

                // Install packages
                using (Trace.WithIndent().Verbose("Installing packages"))
                {
                    _packages.InstallPackages(updatePackages);
                }
            }
            catch (Exception ex)
            {
                Trace.Error("Unexpected error during setup: {0}", ex.Message);
                throw;
            }
        }
Exemple #3
0
        private void Setup(ConfigParts configParts, bool updatePackages)
        {
            try
            {
                // Compile and evaluate the script
                using (Trace.WithIndent().Verbose("Evaluating setup script"))
                {
                    SetupScript setupScript = new SetupScript(configParts.Setup);
                    OutputScript(SetupScript.AssemblyName, setupScript.Code);
                    setupScript.Compile();
                    setupScript.Invoke(_packages, _assemblyCollection, _fileSystem);
                }

                // Install packages
                using (Trace.WithIndent().Verbose("Installing packages"))
                {
                    _packages.InstallPackages(updatePackages);
                }
            }
            catch (Exception ex)
            {
                Trace.Error("Unexpected error during setup: {0}", ex.Message);
                throw;
            }
        }