Skip to content

Commit

Permalink
LRDOCS-1385 Formatting and finishing touches on Git and Diffs targets
Browse files Browse the repository at this point in the history
  • Loading branch information
codyhoag committed Sep 5, 2014
1 parent 925ee11 commit ff85301
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void execute() throws BuildException {
}

try {
System.out.println("Creating ../dist/diffs.zip file");
FileOutputStream fileOutputStream = new FileOutputStream("dist/diffs.zip");
ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,37 @@ public static void main(String[] args) throws GitAPIException, IOException {

List<DiffEntry> diff = new Git(repo).diff().setOldTree(masterTreeParser).setNewTree(importTreeParser).call();

System.out.println("Creating ../git-modified-list.txt file");
PrintWriter writer = new PrintWriter("git-modified-list.txt", "UTF-8");
addTimeStamp("Comparing your " + importBranch + " branch to your master branch\n"
+ "Generated on", writer);

boolean newDiff = false;

for (DiffEntry entry : diff) {
String stringEntry = entry.toString();

if (stringEntry.contains(purposedir + "/" + docdir)) {
writer.println(stringEntry);
System.out.println(stringEntry);
newDiff = true;
}
}

if (!newDiff) {
System.out.println("There are no additions/modifications in .../" + purposedir + "/" + docdir);
writer.println("There are no new additions/modifications to report");
}

writer.close();
repo.close();

}

private static Repository openGitRepository() throws IOException {
FileRepositoryBuilder repoBuilder = new FileRepositoryBuilder();
Repository repo = repoBuilder.readEnvironment().findGitDir().build();
private static void addTimeStamp(String message, PrintWriter writer) {

return repo;
}
Calendar calendar = Calendar.getInstance();
writer.printf("%s %tc\n\n", message, calendar);
}

private static AbstractTreeIterator gitTreeParser(Repository repo, String ref)
throws IOException {
Expand All @@ -79,8 +87,11 @@ private static AbstractTreeIterator gitTreeParser(Repository repo, String ref)
return masterTreeParser;
}

private static void addTimeStamp(String message, PrintWriter writer) {
Calendar calendar = Calendar.getInstance();
writer.printf("%s %tc\n\n", message, calendar);
}
private static Repository openGitRepository() throws IOException {

FileRepositoryBuilder repoBuilder = new FileRepositoryBuilder();
Repository repo = repoBuilder.readEnvironment().findGitDir().build();

return repo;
}
}
Binary file modified lib/liferay-doc-utils.jar
Binary file not shown.

0 comments on commit ff85301

Please sign in to comment.