diff --git a/.gitignore b/.gitignore index 73722a7..3d77490 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ changelog* target lib credentials.properties +!/src/net/foxopen/jira/changelog/ +!/test/net/foxopen/jira/changelog/ \ No newline at end of file diff --git a/src/net/foxopen/jira/changelog/Changelog.java b/src/net/foxopen/jira/changelog/Changelog.java index a553bd3..d544f56 100644 --- a/src/net/foxopen/jira/changelog/Changelog.java +++ b/src/net/foxopen/jira/changelog/Changelog.java @@ -87,6 +87,9 @@ public static void main(String[] args) System.exit(2); } Logger.log("--changelog-file-name found. Using " + filenameList + " as changelog files."); + } else if (args[currentArgument].equals("--changelog-description-field")) { + descriptionField = args[++currentArgument]; + Logger.log("--changelog-description-field found. Using " + descriptionField + " as the Changelog Description field."); } else { Logger.err("Unknown argument: " + args[currentArgument]); System.exit(2); @@ -116,7 +119,7 @@ public static void main(String[] args) } } - JiraAPI jiraApi = new JiraAPI(jiraUsername, jiraPassword, jiraURL, jql); + JiraAPI jiraApi = new JiraAPI(jiraUsername, jiraPassword, jiraURL, jql, descriptionField); if (objectCachePath != null) { VersionInfoCache cache = new VersionInfoCache(jiraProjectKey, objectCachePath); @@ -128,10 +131,10 @@ public static void main(String[] args) Logger.log("Building changelog files."); if (filenameList == null) { - // default all filenames to changelog.txt if none have been specified + // default all filenames to changelog#.txt if none have been specified files = new String[templates.length]; for (int i = 0; i < files.length; i++) { - files[i] = "changelog.txt"; + files[i] = "changelog" + i + ".txt"; } } clWriter.build(jiraApi.getVersionInfoList(), files, templates); diff --git a/test/net/foxopen/jira/changelog/ChangelogTemplateTest.java b/test/net/foxopen/jira/changelog/ChangelogTemplateTest.java index d2b4e4f..046f036 100644 --- a/test/net/foxopen/jira/changelog/ChangelogTemplateTest.java +++ b/test/net/foxopen/jira/changelog/ChangelogTemplateTest.java @@ -89,22 +89,7 @@ public void testHTMLChangelog() throws Exception { public void testXMLChangelog() throws Exception { System.out.println("XMLChangelog"); try { - JiraAPI jira = new JiraAPI("jenkins", "j3nk1ns!", "https://fivium.atlassian.net", "", ""); - jira.fetchVersionDetails("TESTPROJ", "2.0.1"); - String[] files = new String[2]; - files[0] = "file.mustache"; - files[1] = "module.mustache"; - ChangelogBuilder clWriter = new ChangelogBuilder(); - clWriter.build(jira.getVersionInfoList(), "changelog", files); - - // attempt to open the generated changelog file. If an IOException is thrown, then the file does not exist. - FileReader reader = new FileReader("changelog1.txt"); - reader.close(); - reader = new FileReader("changelog2.txt"); - reader.close(); - } catch (IOException e) { - fail("File does not exist!"); - System.err.println(e.getMessage()); + ChangelogTemplate.createChangelog(versions, output, "examples/xml.mustache"); } catch (Exception e) { fail("Exception raised."); e.printStackTrace(); @@ -139,4 +124,4 @@ public void testFullRun() throws Exception { File f = new File("changelog.html"); assertTrue(f.exists()); } -} +} \ No newline at end of file