Skip to content

Commit

Permalink
added in better debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Synapticloop authored and Synapticloop committed Feb 9, 2016
1 parent ecf04fe commit 65fb4fd
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 25 deletions.
58 changes: 40 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
plugins {
id 'java'
id 'eclipse'
id 'maven'
id 'maven-publish'
id 'net.saliman.cobertura' version '2.2.6'
id "org.sonarqube" version "1.0"
id "com.jfrog.bintray" version "1.4"
id 'co.riiid.gradle' version '0.3.1'
id 'com.jfrog.bintray' version '1.4'
}


group = 'synapticloop'
archivesBaseName = 'templar'
description = """Templar templating engine"""
version = 'v1.1.2'
version = 'v1.1.3'

sourceCompatibility = 1.6
targetCompatibility = 1.6


cobertura {
coverageFormats = [ 'html', 'xml']
}
Expand All @@ -39,6 +41,26 @@ dependencies {
testCompile 'org.mockito:mockito-all:1.10.19'
}

// we always want to fail on version conflict
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
}

github {
owner = group
repo = archivesBaseName
if(System.getenv('GITHUB_TOKEN')) {
token = System.getenv('GITHUB_TOKEN')
}
tagName = version
name = version
assets = [
'build/libs/' + archivesBaseName + '-' + version + '-all.jar'
]
}

def javaApiUrl = 'http://docs.oracle.com/javase/1.6.0/docs/api/'
def groovyApiUrl = 'http://groovy.codehaus.org/gapi/'

Expand All @@ -56,25 +78,24 @@ task sourcesJar(type: Jar) {
classifier = 'sources'
}

test.finalizedBy(project.tasks.cobertura)

allprojects {
repositories {
jcenter()
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
}

publishing {
publications {
Synapticloop(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId 'synapticloop'
artifactId 'templar'

groupId group
artifactId archivesBaseName

pom.withXml {
configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each { dep ->
asNode().dependencies[0].dependency.find {
it.artifactId[0].text() == dep.moduleName &&
it.groupId[0].text() == dep.moduleGroup
}.scope[0].value = 'compile'
}
}
}
}
}
Expand All @@ -89,8 +110,9 @@ bintray {

pkg {
repo = 'maven'
name = "templar"
name = archivesBaseName
}

}

task(dist).dependsOn( [ 'test', 'cobertura'] )
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 @@
#Fri Oct 30 15:05:30 GMT 2015
#Wed Nov 25 10:24:10 GMT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package synapticloop.templar.function.string;

import java.util.ArrayList;
import java.util.Arrays;

import synapticloop.templar.exception.FunctionException;
import synapticloop.templar.function.Function;
import synapticloop.templar.helper.ObjectHelper;
import synapticloop.templar.utils.TemplarContext;

public class FunctionSplit extends Function {
Expand All @@ -12,8 +16,10 @@ public FunctionSplit() {

@Override
protected Object evaluateFunction(Object[] args, TemplarContext templarContext) throws FunctionException {
// TODO Auto-generated method stub
return null;
String argZero = ObjectHelper.evaluateObjectToDefault(args[0], templarContext).toString();
String argOne = ObjectHelper.evaluateObjectToDefault(args[1], templarContext).toString();

return(new ArrayList<String>(Arrays.asList(argZero.split(argOne))));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public Object evaluate(TemplarContext templarContext) throws RenderException {
return(ObjectHelper.deQuote(evaluateCommand));
}

return(ObjectHelper.evaluateObject(evaluateCommand, templarContext));
try {
return(ObjectHelper.evaluateObject(evaluateCommand, templarContext));
} catch(RenderException ex) {
throw new RenderException("Could not render line: " + evaluateCommand, ex);
}
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package synapticloop.templar.function.string;
import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import synapticloop.templar.exception.FunctionException;
import synapticloop.templar.function.FunctionLength;

public class FunctionSplitTest {
private FunctionSplit functionSplit = null;
private FunctionLength functionLength = null;

@Before
public void setup() {
functionSplit = new FunctionSplit();
functionLength = new FunctionLength();
}

@Test
public void testMethodName() throws FunctionException {
Object evaluate = functionSplit.evaluate("split", new Object[] { "1,1,1,1,1", "," }, null);
assertEquals(5, functionLength.evaluate("length", new Object[] { evaluate }, null));
}
}

0 comments on commit 65fb4fd

Please sign in to comment.