public XDocument GetXml(CustomConstraints customConstraints)
        {
            ArgumentUtility.CheckNotNull ("customConstraints", customConstraints);

              var xmlForVersion = _jiraClient.GetIssuesByCustomConstraints (customConstraints);
              var keys = FindUnknownParentKeys (xmlForVersion);
              var xmlWithMissingParents = SetIssuesInvisible(_jiraClient.GetIssuesByKeys (keys));

              return MergeXml (xmlForVersion, xmlWithMissingParents);
        }
Example #2
0
        public XDocument GetXml(CustomConstraints customConstraints)
        {
            ArgumentUtility.CheckNotNull("customConstraints", customConstraints);

            var xmlForVersion         = _jiraClient.GetIssuesByCustomConstraints(customConstraints);
            var keys                  = FindUnknownParentKeys(xmlForVersion);
            var xmlWithMissingParents = SetIssuesInvisible(_jiraClient.GetIssuesByKeys(keys));

            return(MergeXml(xmlForVersion, xmlWithMissingParents));
        }
        private XDocument GetXmlWithConfigSection(CustomConstraints customConstraints, string overriddenTitle)
        {
            var issues = _jiraIssueAggregator.GetXml(customConstraints);
            var config = XDocument.Load(_configuration.ConfigFile);

            config.Root.Add(new XElement("generatedForVersion", customConstraints.Version));
            if (overriddenTitle != null)
            {
                config.Root.SetElementValue("projectTitle", overriddenTitle);
            }
            issues.Root.AddFirst(config.Elements());
            return(issues);
        }
Example #4
0
        private XDocument GetIssues(CustomConstraints customConstraints, string[] keys)
        {
            var builder = _builderFactory();

            builder.FixVersion           = customConstraints == null ? null : customConstraints.Version;
            builder.Keys                 = keys;
            builder.AdditionalConstraint = customConstraints == null ? null : customConstraints.AdditionalConstraint;

            if (builder.IsValidQuery())
            {
                var url = builder.Build();
                return(GetIssuesFromUrl(url));
            }
            else
            {
                return(CreateEmptyDocumentStructure());
            }
        }
        public int GenerateReleaseNotes(CustomConstraints customConstraints, string outputFile, string overriddenTitle)
        {
            ArgumentUtility.CheckNotNull("customConstraints", customConstraints);
            ArgumentUtility.CheckNotNull("outputFile", outputFile);

            XDocument issues;

            try
            {
                issues = GetXmlWithConfigSection(customConstraints, overriddenTitle);
            }
            catch (WebException webException)
            {
                Console.Error.Write(webException.Message);
                return(1);
            }

            var transformerExitCode = _xmlTransformer.GenerateResultFromXml(issues, outputFile);

            return(transformerExitCode);
        }
        public int GenerateReleaseNotes(CustomConstraints customConstraints, string outputFile, string overriddenTitle)
        {
            ArgumentUtility.CheckNotNull ("customConstraints", customConstraints);
              ArgumentUtility.CheckNotNull ("outputFile", outputFile);

              XDocument issues;

              try
              {
            issues = GetXmlWithConfigSection (customConstraints, overriddenTitle);
              }
              catch (WebException webException)
              {
            Console.Error.Write (webException.Message);
            return 1;
              }

              var transformerExitCode = _xmlTransformer.GenerateResultFromXml (issues, outputFile);

              return transformerExitCode;
        }
Example #7
0
        private XDocument GetIssues(CustomConstraints customConstraints, string[] keys)
        {
            var builder = _builderFactory();
              builder.FixVersion = customConstraints == null ? null : customConstraints.Version;
              builder.Keys = keys;
              builder.AdditionalConstraint = customConstraints == null ? null : customConstraints.AdditionalConstraint;

              if (builder.IsValidQuery())
              {
            var url = builder.Build();
            return GetIssuesFromUrl(url);
              }
              else
              {
            return CreateEmptyDocumentStructure();
              }
        }
Example #8
0
        public XDocument GetIssuesByCustomConstraints(CustomConstraints customConstraints)
        {
            ArgumentUtility.CheckNotNull ("customConstraints", customConstraints);

              return GetIssues (customConstraints, null);
        }
Example #9
0
        public static int Main(string[] args)
        {
            var argumentCheckResult = CheckArguments (args);
              if (argumentCheckResult != 0)
            return (argumentCheckResult);

              var version = args[0];
              var outputDirectory = Path.GetFullPath (args[1]);
              var outputFile = Path.Combine (outputDirectory, "ReleaseNotes_v" + version + ".html");;
              string customJQuery = null;
              string title = null;

              if (args.Length == 4)
              {
            title = args[2].Substring(2);
            customJQuery = Uri.EscapeDataString(args[3]);
              }
              else if (args.Length == 3)
              {
            if (args[2].StartsWith ("t:"))
            {
              title = args[2].Substring (2);
            }
            else
            {
              customJQuery = Uri.EscapeDataString(args[2]);
            }
              }

              var customConstraints = new CustomConstraints (version, customJQuery);

              Console.Out.WriteLine ("Starting Remotion.BuildTools for version " + version);

              var webClient = new NtlmAuthenticatedWebClient ();
              webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
              var requestUrlBuilder = new JiraRequestUrlBuilder (s_Configuration);
              var jiraClient = new JiraClient (webClient, () => requestUrlBuilder);
              var jiraIssueAggregator = new JiraIssueAggregator (jiraClient);
              var xmlTransformer = new XmlTransformer (s_Configuration.XsltStyleSheetPath, s_Configuration.XsltProcessorPath);
              var releaseNoteGenerator = new ReleaseNoteGenerator (s_Configuration, jiraIssueAggregator, xmlTransformer);

              var exitCode = releaseNoteGenerator.GenerateReleaseNotes (customConstraints, outputFile, title);

              if (exitCode == WebServiceError)
            return 3;

              if (exitCode == XmlTransformerError)
            return 4;

              Console.Out.WriteLine ("Creation of ReleaseNotes for version {0} was successful.", version);

              return 0;
        }
Example #10
0
        public XDocument GetIssuesByCustomConstraints(CustomConstraints customConstraints)
        {
            ArgumentUtility.CheckNotNull("customConstraints", customConstraints);

            return(GetIssues(customConstraints, null));
        }
 private XDocument GetXmlWithConfigSection(CustomConstraints customConstraints, string overriddenTitle)
 {
     var issues = _jiraIssueAggregator.GetXml (customConstraints);
       var config = XDocument.Load (_configuration.ConfigFile);
       config.Root.Add (new XElement ("generatedForVersion", customConstraints.Version));
       if (overriddenTitle != null)
       {
     config.Root.SetElementValue ("projectTitle", overriddenTitle);
       }
       issues.Root.AddFirst (config.Elements());
       return issues;
 }
Example #12
0
        public static int Main(string[] args)
        {
            var argumentCheckResult = CheckArguments(args);

            if (argumentCheckResult != 0)
            {
                return(argumentCheckResult);
            }


            var    version         = args[0];
            var    outputDirectory = Path.GetFullPath(args[1]);
            var    outputFile      = Path.Combine(outputDirectory, "ReleaseNotes_v" + version + ".html");;
            string customJQuery    = null;
            string title           = null;

            if (args.Length == 4)
            {
                title        = args[2].Substring(2);
                customJQuery = Uri.EscapeDataString(args[3]);
            }
            else if (args.Length == 3)
            {
                if (args[2].StartsWith("t:"))
                {
                    title = args[2].Substring(2);
                }
                else
                {
                    customJQuery = Uri.EscapeDataString(args[2]);
                }
            }

            var customConstraints = new CustomConstraints(version, customJQuery);

            Console.Out.WriteLine("Starting Remotion.BuildTools for version " + version);

            var webClient = new NtlmAuthenticatedWebClient();

            webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
            var requestUrlBuilder    = new JiraRequestUrlBuilder(s_Configuration);
            var jiraClient           = new JiraClient(webClient, () => requestUrlBuilder);
            var jiraIssueAggregator  = new JiraIssueAggregator(jiraClient);
            var xmlTransformer       = new XmlTransformer(s_Configuration.XsltStyleSheetPath, s_Configuration.XsltProcessorPath);
            var releaseNoteGenerator = new ReleaseNoteGenerator(s_Configuration, jiraIssueAggregator, xmlTransformer);

            var exitCode = releaseNoteGenerator.GenerateReleaseNotes(customConstraints, outputFile, title);

            if (exitCode == WebServiceError)
            {
                return(3);
            }

            if (exitCode == XmlTransformerError)
            {
                return(4);
            }

            Console.Out.WriteLine("Creation of ReleaseNotes for version {0} was successful.", version);

            return(0);
        }