Beispiel #1
0
        public ActionResult Execute(string id)
        {
            var deployment = deploymentRepository.GetAll().Where(a => a.Id == id).FirstOrDefault();

            var batch = textTemplateBatchContext.GetAll().Where(a => a.Id == deployment.TextTemplateBatchId).FirstOrDefault();

            t4StateContext.SetState(deployment.StateXml);

            var zipFilePath = getWorkingFolderPath.GetPathToWorkingFolder() + "TextTemplateBatchFileUploads" + Path.DirectorySeparatorChar + batch.Id + Path.DirectorySeparatorChar + batch.ZipFilename;
            var outputPath  = getWorkingFolderPath.GetPathToWorkingFolder() + "T4Output" + Path.DirectorySeparatorChar + deployment.Id + Path.DirectorySeparatorChar;

            if (fileSystem.DirectoryExists(outputPath))
            {
                fileSystem.DeleteDirectory(outputPath);
            }

            var errors = textTemplateZipProcessor.ProcessZip(zipFilePath, outputPath);

            if (deployment.DeployToGitRepository)
            {
                deployToBranchService.Deploy(new GitDeploymentTarget()
                {
                    BranchName    = deployment.BranchName,
                    RepositoryUrl = deployment.RepositoryUrl
                }, outputPath);
            }

            return(View("Execute", new ExecuteViewModel()
            {
                OutputPath = outputPath,
                Errors = errors,
            }));
        }
Beispiel #2
0
        public string ProcessBatch(TextTemplateBatch textTemplateBatch)
        {
            var pathToExtractZipTo = getWorkingFolderPath.GetPathToWorkingFolder() +
                                     TextTemplateBatchManagerSettings.TextTemplateBatchProcessTemporaryFolderName +
                                     Path.DirectorySeparatorChar +
                                     guidGetter.GetGuid();

            fileSystem.CreateFolder(pathToExtractZipTo);

            var pathToZip = getWorkingFolderPath.GetPathToWorkingFolder() +
                            TextTemplateBatchManagerSettings.TextTemplateBatchFileUploadFolderName +
                            Path.DirectorySeparatorChar +
                            textTemplateBatch.Id +
                            Path.DirectorySeparatorChar + textTemplateBatch.ZipFilename;

            textTemplateZipProcessor.ProcessZip(pathToZip, pathToExtractZipTo);

            return(pathToExtractZipTo);
        }