public IResponse Execute(ICruiseRequest cruiseRequest) { if (xslFileName == null) { throw new ApplicationException("XSL File Name has not been set for XSL Report Action"); } Hashtable xsltArgs = new Hashtable(); xsltArgs["applicationPath"] = cruiseRequest.Request.ApplicationPath; string xslFile = pathProvider.GetFullPathFor(XslFileName); string statisticsDocument = farmService.GetStatisticsDocument(cruiseRequest.ProjectSpecifier, cruiseRequest.RetrieveSessionToken()); Log.Debug(statisticsDocument); string htmlFragment; try { htmlFragment = transformer.Transform(statisticsDocument, xslFile, xsltArgs); } catch (CruiseControlException) { htmlFragment = "Missing/Invalid statistics reports. Please check if you have enabled the Statistics Publisher, and statistics have been collected atleast once after that."; } return(new HtmlFragmentResponse(htmlFragment)); }
public IResponse Execute(ICruiseRequest cruiseRequest) { Hashtable xsltArgs = new Hashtable(); if (cruiseRequest.Request.ApplicationPath == "/") { xsltArgs["applicationPath"] = string.Empty; } else { xsltArgs["applicationPath"] = cruiseRequest.Request.ApplicationPath; } xsltArgs["onlyShowBuildsWithModifications"] = OnlyShowBuildsWithModifications; string HistoryDocument = farmService.GetModificationHistoryDocument(cruiseRequest.ProjectSpecifier, cruiseRequest.RetrieveSessionToken()); if (HistoryDocument.Length == 0) { return(new HtmlFragmentResponse("No history Data found, make sure you use the modificationHistory Publisher for this project")); } else { string xslFile = pathProvider.GetFullPathFor(XslFileName); return(new HtmlFragmentResponse(transformer.Transform(HistoryDocument, xslFile, xsltArgs))); } }
public IResponse Execute(ICruiseRequest cruiseRequest) { DirectoryInfo cctrayPath = new DirectoryInfo(physicalApplicationPathProvider.GetFullPathFor("cctray")); if (cctrayPath.Exists) { FileInfo[] files = cctrayPath.GetFiles("*CCTray*.*"); if (files.Length == 1) { return(new RedirectResponse("cctray/" + files[0].Name)); } else if (files.Length > 1) { StringBuilder installerList = new StringBuilder(); installerList.Append(@"<h3>Multiple CCTray installers available</h3>"); installerList.Append(@"<p>Choose one of the following CCTray installers:"); installerList.Append(@"<ul>"); for (int i = 0; i < files.Length; i++) { installerList.Append(@"<li>"); installerList.Append(@"<a href=""cctray/"); installerList.Append(files[i].Name); installerList.Append(@""">"); installerList.Append(files[i].Name); installerList.Append(@"</a>"); installerList.Append(@"</li>"); } installerList.Append(@"</ul>"); installerList.Append(@"</p>"); return(new HtmlFragmentResponse(installerList.ToString())); } } return(new HtmlFragmentResponse("<h3>Unable to locate CCTray installer at path: " + cctrayPath + "</h3>")); }
public string Transform(string transformerFileName, Hashtable transformable) { // Add a translator to all views var translations = Translations.RetrieveCurrent(); transformable.Add("translations", translations); string output = string.Empty; using (TextWriter writer = new StringWriter()) { try { if (DetermineTemplateLocation(transformerFileName) == TemplateLocation.CustomTemplates) { VelocityEngineCustom.MergeTemplate(transformerFileName, RuntimeConstants.ENCODING_DEFAULT, new VelocityContext(transformable), writer); } else { VelocityEngine.MergeTemplate(transformerFileName, RuntimeConstants.ENCODING_DEFAULT, new VelocityContext(transformable), writer); } } catch (Exception baseException) { throw new CruiseControlException(string.Format(@"Exception calling NVelocity for template: {0} Template path is {1}", transformerFileName, physicalApplicationPathProvider.GetFullPathFor("templates")), baseException); } output = writer.ToString(); } return(output); }
public string Transform(string input, string[] transformerFileNames, Hashtable xsltArgs) { var mappedFiles = new List <string>(); foreach (string transformerFileName in transformerFileNames) { mappedFiles.Add(physicalApplicationPathProvider.GetFullPathFor(transformerFileName)); } return(transformer.Transform(input, mappedFiles.ToArray(), xsltArgs)); }
public ConditionalGetFingerprint BuildFromFileNames(params string[] filenames) { DateTime newestFileDate = DateTime.MinValue; foreach (string filename in filenames) { string fullFilePath = pathProvider.GetFullPathFor(filename); DateTime fileModifiedDate = File.GetLastWriteTimeUtc(fullFilePath); if (newestFileDate < fileModifiedDate) { newestFileDate = fileModifiedDate; } } return(BuildFromDate(newestFileDate)); }