Skip to content

Commit

Permalink
Update version and allow variable reporter for JSHint
Browse files Browse the repository at this point in the history
  • Loading branch information
eriwen committed Apr 6, 2013
1 parent 60c7f01 commit 02d4135
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ targetCompatibility = '1.6'

defaultTasks 'clean', 'build'

version = '1.4.2'
version = '1.5.0'
group = 'com.eriwen'
ext.archivesBaseName = 'gradle-js-plugin'
ext.isSnapshot = version.endsWith("-SNAPSHOT")
Expand Down
5 changes: 3 additions & 2 deletions plugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.eriwen:gradle-js-plugin:1.4.1'
classpath 'com.eriwen:gradle-js-plugin:1.5.0'
}
}
buildscript {
Expand Down Expand Up @@ -75,7 +75,8 @@ task gzip(type: com.eriwen.gradle.js.tasks.GzipJsTask) {
task jshintz(type: com.eriwen.gradle.js.tasks.JsHintTask) {
source = javascript.source.custom.js.files
dest = "${buildDir}/jshint.out"
ignoreExitCode = false
ignoreExitCode = true
reporter = 'checkstyle'
jshint.options = [expr: "true", unused: "true"]
}

Expand Down
11 changes: 7 additions & 4 deletions src/main/groovy/com/eriwen/gradle/js/tasks/JsHintTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class JsHintTask extends SourceTask {
@OutputFile def dest = new File(project.buildDir, "jshint.log")
@Input def ignoreExitCode = true
@Input def outputToStdOut = false
@Input def checkstyle = false
@Input def reporter = ''

File getDest() {
project.file(dest)
Expand All @@ -43,10 +43,13 @@ class JsHintTask extends SourceTask {
new File(project.buildDir, TMP_DIR), JSHINT_PATH)
final List<String> args = [jshintJsFile.canonicalPath]
args.addAll(source.files.collect { it.canonicalPath })
if (checkstyle) {
logger.debug("reporter=checkstyle")
args.add("reporter=checkstyle")

// Allow variable reporter
if (reporter) {
logger.debug("reporter=${reporter}")
args.add("reporter=${reporter}")
}

LinkedHashMap<String, Object> options = project.jshint.options
if (options != null && options.size() > 0) {
def optionsArg = ""
Expand Down
2 changes: 1 addition & 1 deletion src/test/groovy/com/eriwen/gradle/js/JsHintTaskTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class JsHintTaskTest extends Specification {

def "generates checkstyle report when enabled"() {
given:
task.checkstyle = true
task.reporter = 'checkstyle'
addFile("invalid.js", "var b = 5")

when:
Expand Down

0 comments on commit 02d4135

Please sign in to comment.