Skip to content

Commit

Permalink
Merge pull request #30 from kicksolutions/msantosh-workbin
Browse files Browse the repository at this point in the history
SVG Generation Added
  • Loading branch information
santoshm1188 authored Dec 17, 2017
2 parents c310eae + 7ca8e62 commit c30b961
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Following are the tools which this project internally uses:
- [Swagger Parser]
- [Plant UML]
- [Graphviz]
- [Mustache]

Please [install](https://graphviz.gitlab.io/download/) Graphviz on your machines, ensure you edit PATH varible of your machine and add bin folder of graphviz.

Expand Down Expand Up @@ -62,3 +63,4 @@ Apacahe 2.0
[Swagger]: <https://swagger.io/>
[Swagger Parser]: <https://github.com/swagger-api/swagger-parser>
[Graphviz]: <https://graphviz.gitlab.io/>
[Mustache]: <https://github.com/spullara/mustache.java>
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>io.github.kicksolutions</groupId>
Expand Down Expand Up @@ -72,6 +73,7 @@
<version.swagger-parser>1.0.33</version.swagger-parser>
<version.mustache>0.8.18</version.mustache>
<version.junit>3.8.1</version.junit>
<version.net.sourceforge.plantuml>7999</version.net.sourceforge.plantuml>
</properties>

<dependencyManagement>
Expand All @@ -92,23 +94,27 @@
<artifactId>compiler</artifactId>
<version>${version.mustache}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
<version>${version.net.sourceforge.plantuml}</version>
</dependency>
</dependencies>
</dependencyManagement>

<modules>
<module>swagger2puml-core</module>
</modules>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -125,7 +131,7 @@
</plugin>
</plugins>
</build>

<profiles>
<!-- Activate using the release property: mvn clean install -Prelease -->
<profile>
Expand Down
11 changes: 8 additions & 3 deletions swagger2puml-core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>

<parent>
Expand All @@ -11,10 +12,10 @@
<artifactId>swagger-plantuml-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>Core POM to generate Plant UML from Swagger</description>

<packaging>jar</packaging>
<name>swagger2plantuml-core</name>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -29,5 +30,9 @@
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kicksolutions.swagger.plantuml;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -81,16 +82,28 @@ private void transformSwagger2Puml(String specFile,String output,boolean generat
LOGGER.info("Processing File --> "+ specFile);
pumlPath = codegen.generatePuml();
LOGGER.info("Sucessfully Create PUML !!!");

generateUMLDiagram(pumlPath, targetLocation);
}
catch(Exception e){
LOGGER.log(Level.SEVERE, e.getMessage(),e);
System.exit(1);
throw new RuntimeException(e);
}
}
else{
}else{
LOGGER.severe(USAGE);
}

LOGGER.exiting(LOGGER.getName(), "transformSwagger2Puml");
}

/**
*
* @param pumlLocation
* @param targetLocation
* @throws IOException
* @throws InterruptedException
*/
private void generateUMLDiagram(String pumlLocation,File targetLocation) throws IOException, InterruptedException{
net.sourceforge.plantuml.Run.main(new String[]{"-tsvg","-o",targetLocation.getAbsolutePath(),"-I",pumlLocation});
}
}

0 comments on commit c30b961

Please sign in to comment.