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,
            }));
        }
 public IndexViewModel BuildViewModel()
 {
     return(new IndexViewModel()
     {
         Deployments = deploymentRepository.GetAll(),
     });
 }