예제 #1
0
        string PerformTest(string sampleFile, VariableDictionary variables)
        {
            var temp = Path.GetTempFileName();

            using (new TemporaryFile(temp))
            {
                var substituter = new FileSubstituter();
                substituter.PerformSubstitution(MapSamplePath(sampleFile), variables, temp);
                return(File.ReadAllText(temp));
            }
        }
예제 #2
0
        private void SubstituteVariablesInScript(string scriptFileName, CalamariVariableDictionary variables)
        {
            if (!File.Exists(scriptFileName))
            {
                throw new CommandException("Could not find script file: " + scriptFileName);
            }

            var substituter = new FileSubstituter(CalamariPhysicalFileSystem.GetPhysicalFileSystem());

            substituter.PerformSubstitution(scriptFileName, variables);
        }
예제 #3
0
        private void SubstituteVariablesInScript(CalamariVariableDictionary variables)
        {
            if (!substituteVariables)
            {
                return;
            }

            Log.Info("Substituting variables in: " + scriptFile);

            var validatedScriptFilePath = AssertScriptFileExists();
            var substituter             = new FileSubstituter(CalamariPhysicalFileSystem.GetPhysicalFileSystem());

            substituter.PerformSubstitution(validatedScriptFilePath, variables);
        }
예제 #4
0
        dynamic PerformTest(string sampleFile, VariableDictionary variables)
        {
            var temp = Path.GetTempFileName();

            using (new TemporaryFile(temp))
            {
                var substituter = new FileSubstituter(FileSystem);
                substituter.PerformSubstitution(sampleFile, variables, temp);
                return(new {
                    Text = FileSystem.ReadFile(temp),
                    Encoding = FileSystem.GetFileEncoding(temp)
                });
            }
        }
예제 #5
0
        private void SubstituteVariablesInScript(CalamariVariableDictionary variables)
        {
            if (!substituteVariables)
            {
                return;
            }

            Log.Info("Substituting variables in: " + scriptFile);

            var validatedScriptFilePath = AssertScriptFileExists();
            var substituter             = new FileSubstituter(CalamariPhysicalFileSystem.GetPhysicalFileSystem());

            substituter.PerformSubstitution(validatedScriptFilePath, variables);

            // Replace variables on any other files that may have been extracted with the package
            new SubstituteInFilesConvention(CalamariPhysicalFileSystem.GetPhysicalFileSystem(), substituter)
            .Install(deployment);
        }