Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Group ID refactor and fit requirements to deploy on sonatype.org
Browse files Browse the repository at this point in the history
  • Loading branch information
Eomm committed Jul 31, 2017
1 parent 56c74b4 commit 6a34da5
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 47 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Once you [installed the lib](https://maven.apache.org/guides/mini/guide-3rd-part
<build>
<plugins>
<plugin>
<groupId>it.eomm.plugins</groupId>
<groupId>it.eomm.tools</groupId>
<artifactId>dolm-maven-plugin</artifactId>
<version>LATEST</version>
<executions>
Expand Down Expand Up @@ -122,7 +122,7 @@ Simply run `mvn clean test`
### Next steps
+ :white_check_mark: JUnit
+ :white_check_mark: Better integration in the maven lifecycle
+ :white_medium_square: Deploy on [mvn-repository](http://central.sonatype.org/)
+ :hourglass_flowing_sand: Deploy on [mvn-repository](http://central.sonatype.org/)
+ :white_medium_square: Add a template system to the `.md` files
+ :white_medium_square: Customize the output file format (`docx`, `odt`, ecc...)

Expand Down
80 changes: 76 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.eomm.plugins</groupId>

<groupId>it.eomm.tools</groupId>
<artifactId>dolm-maven-plugin</artifactId>
<version>0.0.2</version>
<version>1.0.0</version>
<packaging>maven-plugin</packaging>

<name>DOLM</name>
<description>DOLM (Document Lifecycle Management) start with an easy plugin for build PDF docs from any markdown .md
files.
</description>
<url>https://github.com/Eomm/dolm</url>

<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -130,9 +139,62 @@
</systemProperties>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<profiles>
<profile>
<id>sign-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<developers>
<developer>
<name>Manuel Spigolon</name>
Expand All @@ -142,14 +204,24 @@

<scm>
<connection>scm:git:git@github.com:Eomm/dolm.git</connection>
<url>scm:git:git@github.com:Eomm/dolm.git</url>
<developerConnection>scm:git:git@github.com:Eomm/dolm.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/Eomm/dolm/tree/master</url>
</scm>

<issueManagement>
<url>https://github.com/Eomm/dolm.git/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm;
package it.eomm.tools.dolm;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.logging.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm;
package it.eomm.tools.dolm;

import org.apache.maven.plugin.Mojo;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm.bean;
package it.eomm.tools.dolm.bean;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm.exceptions;
package it.eomm.tools.dolm.exceptions;

public class ConvertException extends Exception {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm.exceptions;
package it.eomm.tools.dolm.exceptions;

public class PipeException extends Exception {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package it.eomm.plugins.dolm.goals;

import it.eomm.plugins.dolm.Dolm;
import it.eomm.plugins.dolm.bean.Converted;
import it.eomm.plugins.dolm.logic.PipelineConverter;
import it.eomm.plugins.dolm.logic.converter.MarkdownFileConverter;
import it.eomm.plugins.dolm.logic.converter.OutPdf;
import it.eomm.plugins.dolm.utils.ConvertFactory;
import it.eomm.plugins.dolm.utils.FileNamePatternFilter;
import it.eomm.plugins.dolm.utils.FileSystemIterator;
package it.eomm.tools.dolm.goals;

import it.eomm.tools.dolm.Dolm;
import it.eomm.tools.dolm.bean.Converted;
import it.eomm.tools.dolm.logic.PipelineConverter;
import it.eomm.tools.dolm.logic.converter.MarkdownFileConverter;
import it.eomm.tools.dolm.logic.converter.OutPdf;
import it.eomm.tools.dolm.utils.ConvertFactory;
import it.eomm.tools.dolm.utils.FileNamePatternFilter;
import it.eomm.tools.dolm.utils.FileSystemIterator;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -22,6 +22,13 @@
@Mojo(name = "build", defaultPhase = LifecyclePhase.PRE_SITE)
public class BuildMojo extends Dolm {

/**
* Convert all the files in @{sourcePath} matching the @{filter} filename's pattern to PDF files in the @{outputPath} with @{filenamePatternOutput}.<br>
* If there aren't files in the directory the plugins does nothings.
*
* @throws MojoExecutionException when an unexpected error occurs
* @throws MojoFailureException when a parameter is not valid
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package it.eomm.plugins.dolm.logic;
package it.eomm.tools.dolm.logic;

import it.eomm.plugins.dolm.exceptions.ConvertException;
import it.eomm.tools.dolm.exceptions.ConvertException;

/**
* Created by Manuel Spigolon on 02/07/2017.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package it.eomm.plugins.dolm.logic;
package it.eomm.tools.dolm.logic;

import it.eomm.plugins.dolm.exceptions.PipeException;
import it.eomm.tools.dolm.exceptions.PipeException;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package it.eomm.plugins.dolm.logic.converter;
package it.eomm.tools.dolm.logic.converter;

import it.eomm.plugins.dolm.bean.Converted;
import it.eomm.plugins.dolm.exceptions.ConvertException;
import it.eomm.plugins.dolm.logic.IConverter;
import it.eomm.plugins.dolm.utils.ConvertFactory;
import it.eomm.tools.dolm.bean.Converted;
import it.eomm.tools.dolm.exceptions.ConvertException;
import it.eomm.tools.dolm.logic.IConverter;
import it.eomm.tools.dolm.utils.ConvertFactory;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;

import java.io.File;
import java.io.FileReader;

/**
* Convert a {@link File} to a Markdown {@link Node}
* Created by Manuel Spigolon on 02/07/2017.
*/
public class MarkdownFileConverter implements IConverter<File, Converted<File, Node>> {
Expand All @@ -25,6 +26,11 @@ public MarkdownFileConverter(ConvertFactory factory) {
this.factory = factory;
}

/**
* @param input a {@link File} in the markdown format
* @return a {@link Converted} object with the original {@link File} and the converted {@link Node}
* @throws ConvertException if some unexpected error occurs
*/
@Override
public Converted<File, Node> convert(File input) throws ConvertException {
Parser parser = factory.buildParser();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package it.eomm.plugins.dolm.logic.converter;
package it.eomm.tools.dolm.logic.converter;

import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.tool.xml.XMLWorkerHelper;
import it.eomm.plugins.dolm.bean.Converted;
import it.eomm.plugins.dolm.exceptions.ConvertException;
import it.eomm.plugins.dolm.logic.IConverter;
import it.eomm.plugins.dolm.utils.ConvertFactory;
import it.eomm.tools.dolm.bean.Converted;
import it.eomm.tools.dolm.exceptions.ConvertException;
import it.eomm.tools.dolm.logic.IConverter;
import it.eomm.tools.dolm.utils.ConvertFactory;
import org.commonmark.node.Node;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Date;

/**
* Convert a Markdown {@link Node} to a PDF {@link File}.
*/
public class OutPdf implements IConverter<Converted<File, Node>, Converted<Node, File>> {

private ConvertFactory factory;
Expand All @@ -32,6 +35,14 @@ public OutPdf(ConvertFactory factory, String outputPath, String outputFileNamePa
this.outputFileVersion = outputFileVersion;
}

/**
* Convert the input node to a PDF file using {@link PdfWriter}.<br>
* If the @{outputPath} doesn't exist it will be created.
*
* @param input a {@link Converted} object with the original file read and the Markdown node.
* @return a {@link Converted} object with the node from input and the {@link File} output
* @throws ConvertException if some error occurs
*/
@Override
public Converted<Node, File> convert(Converted<File, Node> input) throws ConvertException {
File outPath = new File(outputPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm.utils;
package it.eomm.tools.dolm.utils;

import org.commonmark.Extension;
import org.commonmark.parser.Parser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.eomm.plugins.dolm.utils;
package it.eomm.tools.dolm.utils;

import java.io.File;
import java.io.FilenameFilter;
Expand All @@ -7,6 +7,10 @@ public class FileNamePatternFilter implements FilenameFilter {

private String pattern;

/**
* Filter a java.util.File by his filename
* @param pattern mandatory pattern
*/
public FileNamePatternFilter(String pattern) {
super();

Expand Down
Loading

0 comments on commit 6a34da5

Please sign in to comment.