Skip to content

Commit

Permalink
Added a changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
fthevenet committed Jan 6, 2019
1 parent e1f1cb8 commit c7d49e5
Show file tree
Hide file tree
Showing 10 changed files with 614 additions and 19 deletions.
254 changes: 254 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

File renamed without changes.
4 changes: 3 additions & 1 deletion NOTICE → NOTICE.md
@@ -1,10 +1,12 @@
### binjr
###### Flexible Time Series Visualisation
Copyright 2016-2019 Frederic Thevenet

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Expand Up @@ -118,7 +118,8 @@ public List<GithubRelease> getAllReleases(String owner, String repo) throws IOEx
URIBuilder requestUrl = new URIBuilder()
.setScheme(URL_PROTOCOL)
.setHost(GITHUB_API_HOSTNAME)
.setPath("/repos/" + owner + "/" + repo + "/releases");
.setPath("/repos/" + owner + "/" + repo + "/releases")
.addParameter("per_page", "100");

logger.debug(() -> "requestUrl = " + requestUrl);
HttpGet httpget = new HttpGet(requestUrl.build());
Expand Down
68 changes: 68 additions & 0 deletions binjr-core/src/main/java/eu/binjr/common/github/MakeChangeLog.java
@@ -0,0 +1,68 @@
package eu.binjr.common.github;/*
* Copyright 2019 Frederic Thevenet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;

public class MakeChangeLog {

private static final String HTML_HEADER =
"<html lang=\"en\">\n" +
"<head>\n" +
" <title>binjr</title>\n" +
" <meta charset=\"utf-8\"/>\n" +
" <link rel=\"stylesheet\" href=\"./resources/css/air.css\">\n" +
"</head>\n\n";

public static void main(String[] args) {
try {
buildChangeLog("binjr", "binjr", Paths.get("distribution/info/CHANGELOG.md"));
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}


}

public static void buildChangeLog(String owner, String repo, Path output) throws IOException, URISyntaxException {
try (FileOutputStream fout = new FileOutputStream(output.toFile())) {
buildChangeLog(owner, repo, fout);
}
}

public static void buildChangeLog(String owner, String repo, OutputStream output) throws IOException, URISyntaxException {
var df = new SimpleDateFormat("EEE, d MMM yyyy");
try (var writer = new OutputStreamWriter(output)) {
writer.write("# Change Log\n\n");
for (var release : GithubApi.getInstance().getAllReleases(owner, repo)) {
writer.write("### [" + release.getName() + "](" + release.getHtmlUrl() + ")\n");
writer.write("Released on " + df.format(release.getPublishedAt()) + "\n\n");
writer.write(release.getBody());
writer.write("\n\n");
}
}

}

}
30 changes: 30 additions & 0 deletions build.gradle
Expand Up @@ -189,6 +189,36 @@ task copyResources(type: Copy) {
markdownToHtml {
sourceDir = file("${projectDir}/distribution/info")
outputDir = file("$DISTRIBUTION_PATH")

doLast {
ConfigurableFileTree tree = fileTree(dir: "$DISTRIBUTION_PATH")
tree.include '**/*.html'

tree.each { File file ->
String path = file.path
File newFile = new File("${DISTRIBUTION_PATH}/tmp_${file.name}")
newFile << "<html lang=\"en\">\n" +
"<head>\n" +
" <title>" + (file.name - ".html") + "</title>\n" +
" <meta charset=\"utf-8\"/>\n" +
" <link rel=\"stylesheet\" href=\"./resources/css/air.css\">\n" +
"</head>"
newFile << file.getText("utf-8")
if (!file.name.startsWith("LICENSE")) {
newFile << "<footer>\n" +
" <br>\n" +
" <hr>\n" +
" <p style=\"text-align:left;\">\n" +
" (c) 2016-2019 <a href=\"https://www.fthevenet.eu\">Frederic Thevenet</a>\n" +
" <span style=\"float:right;\"><a href=\"https://www.binjr.eu\">www.binjr.eu</a></span>\n" +
" </p>\n" +
"</footer>"
}
file.delete()
newFile.renameTo(path)
}

}
}

task downloadopenJfxJmods(type: Download) {
Expand Down

0 comments on commit c7d49e5

Please sign in to comment.