An open API service indexing awesome lists of open source software.

https://github.com/vmj/slacklog-java

Java bindings for Python slacklog module
https://github.com/vmj/slacklog-java

changelog feed generator java slackware

Last synced: 25 days ago
JSON representation

Java bindings for Python slacklog module

Awesome Lists containing this project

README

          

= Slacklog Java

Java wrapper for Python https://pypi.python.org/pypi/slacklog[slacklog] module.

slacklog-java provides a library to convert a Slackware ChangeLog into other formats.
Currently, RSS, Atom, JSON and PyBlosxom formats are supported.

* Source code: https://github.com/vmj/slacklog-java
* Builds status: https://travis-ci.org/vmj/slacklog-java
* Docs: https://www.javadoc.io/doc/fi.linuxbox.slacklog/slacklog-java

== Example usage

[source,java]
----
import fi.linuxbox.slacklog.formatters.SlackLogJsonFormatter;
import fi.linuxbox.slacklog.models.SlackLog;
import fi.linuxbox.slacklog.parsers.SlackLogParser;
import org.python.core.Py;
import org.python.core.PySystemState;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.UTF_8;

public class Example {

public static void main(String... args) throws IOException {
// Initialize Jython
PySystemState.initialize();

// Read the source ChangeLog.txt
final String changelog = read("src/test/resources/ChangeLog.txt", ISO_8859_1);

// Parse the ChangeLog.txt
final SlackLog slacklog = new SlackLogParser().parse(changelog);

// Convert the ChangeLog to JSON
final SlackLogJsonFormatter formatter = new SlackLogJsonFormatter();
formatter.setIndent(4);
final String json = formatter.format(slacklog);

// Write the output
write("src/test/resources/ChangeLog.json", json.getBytes(UTF_8));

// Close the resources
Py.getSystemState().close();
}

private static String read(final String path, final Charset charset) throws IOException {
return new String(Files.readAllBytes(Paths.get(path)), charset);
}

private static void write(final String path, final byte[] data) throws IOException {
Files.write(Paths.get(path), data);
}
}
----

== Requirements

Slacklog Java requires Java 8. This library is available at
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22fi.linuxbox.slacklog%22[The Central Repository] and
https://bintray.com/search?sort=last_updated&query=fi.linuxbox.slacklog[jcenter]

== Authors

Original author and current maintainer is Mikko Värri (vmj@linuxbox.fi).

== License

slacklog-java is Free Software, licensed under GNU General Public License
(GPL), version 3 or later. See LICENSE.txt file for details.