Skip to content

Commit

Permalink
Merge pull request #14 from Steppschuh/feature/009-provide-snapshot-b…
Browse files Browse the repository at this point in the history
…uilds

Feature/009 provide snapshot builds
  • Loading branch information
Steppschuh authored Jul 14, 2020
2 parents ea490b7 + f871266 commit 67c9117
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 75 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: java
jdk:
- openjdk8
before_script: cd Source/MarkdownGenerator
after_success:
- bash <(curl -s https://codecov.io/bash)
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Java Markdown Generator
[![Travis](https://img.shields.io/travis/Steppschuh/Java-Markdown-Generator.svg)](https://travis-ci.org/Steppschuh/Java-Markdown-Generator/) [![Bintray](https://api.bintray.com/packages/steppschuh/Markdown-Generator/Markdown-Generator/images/download.svg) ](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/_latestVersion) [![Maven Central](https://img.shields.io/maven-central/v/net.steppschuh.markdowngenerator/markdowngenerator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.steppschuh.markdowngenerator%22) [![Codecov](https://img.shields.io/codecov/c/github/Steppschuh/Java-Markdown-Generator.svg)](https://codecov.io/gh/Steppschuh/Java-Markdown-Generator)
[![Travis](https://img.shields.io/travis/Steppschuh/Java-Markdown-Generator.svg)](https://travis-ci.org/Steppschuh/Java-Markdown-Generator/) [![JitPack](https://img.shields.io/jitpack/v/Steppschuh/Java-Markdown-Generator.svg)](https://jitpack.io/#Steppschuh/Java-Markdown-Generator)
[![Bintray](https://api.bintray.com/packages/steppschuh/Markdown-Generator/Markdown-Generator/images/download.svg) ](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/_latestVersion) [![Maven Central](https://img.shields.io/maven-central/v/net.steppschuh.markdowngenerator/markdowngenerator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.steppschuh.markdowngenerator%22) [![Codecov](https://img.shields.io/codecov/c/github/Steppschuh/Java-Markdown-Generator.svg)](https://codecov.io/gh/Steppschuh/Java-Markdown-Generator)

Simple to use Java library to generate beautiful markdown.

Expand All @@ -10,14 +11,26 @@ Simple to use Java library to generate beautiful markdown.
## Integration

### Gradle

You can get snapshot and release builds from [JitPack](https://jitpack.io/#Steppschuh/Java-Markdown-Generator):

```groovy
repositories {
maven {
url "http://dl.bintray.com/steppschuh/Markdown-Generator"
}
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.Steppschuh:Java-Markdown-Generator:master-SNAPSHOT'
}
```

Alternatively, release builds are also available on [Bintray](https://bintray.com/steppschuh/Markdown-Generator/Markdown-Generator/):

```groovy
repositories {
maven { url 'http://dl.bintray.com/steppschuh/Markdown-Generator' }
}
dependencies {
compile 'net.steppschuh.markdowngenerator:markdowngenerator:1.3.1.1'
compile 'net.steppschuh.markdowngenerator:markdowngenerator:1.3.2'
}
```

Expand All @@ -26,7 +39,7 @@ dependencies {
<dependency>
<groupId>net.steppschuh.markdowngenerator</groupId>
<artifactId>markdowngenerator</artifactId>
<version>1.3.1.1</version>
<version>1.3.2</version>
</dependency>
```

Expand Down
2 changes: 2 additions & 0 deletions Source/MarkdownGenerator/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Source/MarkdownGenerator/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions Source/MarkdownGenerator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id "com.jfrog.bintray" version "1.7.3"
id "com.jfrog.bintray" version "1.8.5"
}

allprojects {
Expand All @@ -17,14 +17,19 @@ allprojects {
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: "jacoco"
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.5'
}
}

def libraryVersion = '1.3.2'

group 'net.steppschuh.markdowngenerator'
version = '1.3.1.1'
version = libraryVersion

sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.8
targetCompatibility = 1.8

def pomConfig = {
licenses {
Expand Down Expand Up @@ -56,7 +61,7 @@ publishing {
artifact javadocJar
groupId 'net.steppschuh.markdowngenerator'
artifactId 'markdowngenerator'
version '1.3.1.1'
version "${libraryVersion}"
pom.withXml {
def root = asNode()
root.appendNode('description', 'Java library to generate markdown')
Expand All @@ -82,10 +87,10 @@ bintray {
githubRepo = 'Steppschuh/Java-Markdown-Generator'
githubReleaseNotesFile = 'README.md'
version {
name = '1.3.1.1'
desc = 'Markdown Generator 1.3.1.1'
name = "${libraryVersion}"
desc = "Markdown Generator ${libraryVersion}"
released = new Date()
vcsTag = '1.3.1.1'
vcsTag = "${libraryVersion}"
gpg {
sign = true
}
Expand Down
Binary file modified Source/MarkdownGenerator/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Jul 14 14:30:46 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
zipStoreBase=GRADLE_USER_HOME
72 changes: 42 additions & 30 deletions Source/MarkdownGenerator/gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down Expand Up @@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
14 changes: 4 additions & 10 deletions Source/MarkdownGenerator/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class Table extends MarkdownElement {

public static final String SEPERATOR = "|";
public static final String SEPARATOR = "|";
public static final String WHITESPACE = " ";
public static final String DEFAULT_TRIMMING_INDICATOR = "~";
public static final int DEFAULT_MINIMUM_COLUMN_WIDTH = 3;
Expand All @@ -25,7 +25,7 @@ public class Table extends MarkdownElement {

private List<TableRow> rows;
private List<Integer> alignments;
private boolean firstRowIsHeader = true;
private boolean firstRowIsHeader;
private int minimumColumnWidth = DEFAULT_MINIMUM_COLUMN_WIDTH;
private String trimmingIndicator = DEFAULT_TRIMMING_INDICATOR;

Expand Down Expand Up @@ -108,15 +108,15 @@ public String serialize() {

StringBuilder sb = new StringBuilder();

String headerSeperator = generateHeaderSeperator(columnWidths, alignments);
String headerSeparator = generateHeaderSeparator(columnWidths, alignments);
boolean headerSeperatorAdded = !firstRowIsHeader;
if (!firstRowIsHeader) {
sb.append(headerSeperator).append(System.lineSeparator());
sb.append(headerSeparator).append(System.lineSeparator());
}

for (TableRow row : rows) {
for (int columnIndex = 0; columnIndex < columnWidths.size(); columnIndex++) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);

String value = "";
if (row.getColumns().size() > columnIndex) {
Expand All @@ -138,16 +138,16 @@ public String serialize() {
sb.append(value);

if (columnIndex == row.getColumns().size() - 1) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);
}
}

if (rows.indexOf(row) < rows.size() - 1) {
if (rows.indexOf(row) < rows.size() - 1 || rows.size() == 1) {
sb.append(System.lineSeparator());
}

if (!headerSeperatorAdded) {
sb.append(headerSeperator).append(System.lineSeparator());
sb.append(headerSeparator).append(System.lineSeparator());
headerSeperatorAdded = true;
}
}
Expand All @@ -170,8 +170,8 @@ public Table trim(int rowsToKeep) {
* Removes {@link TableRow}s from the center of the specified table until only the requested
* amount of rows is left.
*
* @param table Table to remove {@link TableRow}s from
* @param rowsToKeep Amount of {@link TableRow}s that should not be removed
* @param table Table to remove {@link TableRow}s from
* @param rowsToKeep Amount of {@link TableRow}s that should not be removed
* @param trimmingIndicator The content that trimmed cells should be filled with
* @return The trimmed table
*/
Expand Down Expand Up @@ -200,10 +200,10 @@ public static Table trim(Table table, int rowsToKeep, String trimmingIndicator)
return table;
}

public static String generateHeaderSeperator(Map<Integer, Integer> columnWidths, List<Integer> alignments) {
public static String generateHeaderSeparator(Map<Integer, Integer> columnWidths, List<Integer> alignments) {
StringBuilder sb = new StringBuilder();
for (int columnIndex = 0; columnIndex < columnWidths.entrySet().size(); columnIndex++) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);

String value = StringUtil.fillUpLeftAligned("", "-", columnWidths.get(columnIndex));

Expand All @@ -225,7 +225,7 @@ public static String generateHeaderSeperator(Map<Integer, Integer> columnWidths,

sb.append(value);
if (columnIndex == columnWidths.entrySet().size() - 1) {
sb.append(SEPERATOR);
sb.append(SEPARATOR);
}
}
return sb.toString();
Expand Down
Loading

0 comments on commit 67c9117

Please sign in to comment.