Skip to content

Commit

Permalink
nashorn engine is a singleton now
Browse files Browse the repository at this point in the history
close #8
  • Loading branch information
atomfrede committed Jun 23, 2016
1 parent 7707b98 commit c280ddb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.github.atomfrede'
version '1.1.1-RELEASE'
version '1.2.0-RELEASE'

apply plugin: 'java'

Expand All @@ -23,5 +23,5 @@ dependencies {
check.dependsOn jacocoTestReport

task wrapper(type: Wrapper) {
gradleVersion = '2.13'
gradleVersion = '2.14'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 09 07:12:47 CEST 2016
#Thu Jun 23 20:02:24 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
13 changes: 6 additions & 7 deletions src/main/java/com/github/atomfrede/jadenticon/Jadenticon.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@

public class Jadenticon {

private enum FileType {
SVG, PNG
}

final String hash;
private JdenticonWrapper jdenticonWrapper;
int size;
double padding;

private JdenticonWrapper jdenticonWrapper;
private Jadenticon(String hash) {
jdenticonWrapper = new JdenticonWrapper();
jdenticonWrapper = JdenticonWrapper.getInstance();
this.hash = hash;
this.size = 300;
this.padding = 0.08;
Expand Down Expand Up @@ -131,4 +126,8 @@ private File createTempFile(String name, FileType fileType) throws IOException {
return file;
}

private enum FileType {
SVG, PNG
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

class JdenticonWrapper {

public static JdenticonWrapper instance = new JdenticonWrapper();
private Object jdenticon;
private Invocable invocable;

JdenticonWrapper() {
private JdenticonWrapper() {

try {
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
Expand All @@ -35,6 +36,10 @@ class JdenticonWrapper {

}

public static JdenticonWrapper getInstance() {
return instance;
}

String getSvg(Jadenticon jadenticon) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class JdenticonWrapperTest {

JdenticonWrapper wrapper = new JdenticonWrapper();
JdenticonWrapper wrapper = JdenticonWrapper.getInstance();

@Test
public void shouldCreateSvgWithDefaults() {
Expand Down

0 comments on commit c280ddb

Please sign in to comment.