Delegate to our assembleTask for methods not already defined in JRubyStorm
Fixes #13
This commit is contained in:
parent
2046c89c29
commit
8c7e2ddc14
|
@ -38,6 +38,9 @@ dependencies {
|
|||
testCompile ("org.spockframework:spock-core:0.7-groovy-${gradle.gradleVersion.startsWith('1.')?'1.8':'2.0'}") {
|
||||
exclude module : 'groovy-all'
|
||||
}
|
||||
|
||||
/* Used for mocking non interface types */
|
||||
testCompile 'cglib:cglib-nodep:3.1'
|
||||
}
|
||||
|
||||
plugins.withType(JavaPlugin) {
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
package com.github.jrubygradle.storm
|
||||
|
||||
import com.github.jrubygradle.JRubyPlugin
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Incubating
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.file.CopySpec
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Optional
|
||||
|
||||
import com.github.jrubygradle.storm.internal.JRubyStorm as JRubyStormInternal
|
||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask
|
||||
|
||||
/**
|
||||
* Implement the custom behaviors needed to build a JRubyStorm topology
|
||||
*/
|
||||
@Incubating
|
||||
class JRubyStorm extends DefaultTask {
|
||||
static final String DEFAULT_CONFIGURATION_NAME = 'jrubyStorm'
|
||||
|
||||
/** Dynamically created dependent task for running the topology in local mode*/
|
||||
private Task runTask
|
||||
/** Dynamically created dependent task for building the topology jar */
|
||||
private Task assembleTask
|
||||
/**
|
||||
* Dynamically created dependent task for building the topology jar
|
||||
*/
|
||||
@Delegate
|
||||
AbstractArchiveTask assembleTask
|
||||
|
||||
/** Default version of redstorm to use */
|
||||
protected String customRedstormVersion
|
||||
|
@ -30,8 +33,6 @@ class JRubyStorm extends DefaultTask {
|
|||
/** Configuration which has all of our dependencies */
|
||||
protected Configuration configuration
|
||||
|
||||
/** Grab the {@code org.gradle.api.tasks.bundling.AbstractArchiveTask} that this depends on to build the jar */
|
||||
@Incubating
|
||||
Task getAssembleTask() {
|
||||
return assembleTask
|
||||
}
|
||||
|
@ -70,18 +71,6 @@ class JRubyStorm extends DefaultTask {
|
|||
return configuration ?: project.configurations.findByName(DEFAULT_CONFIGURATION_NAME)
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
void into(CopySpec spec) {
|
||||
assembleTask.into(spec)
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
void from(CopySpec spec) {
|
||||
assembleTask.from(spec)
|
||||
}
|
||||
|
||||
JRubyStorm() {
|
||||
super()
|
||||
configuration = project.configurations.maybeCreate(DEFAULT_CONFIGURATION_NAME)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.github.jrubygradle.storm
|
||||
|
||||
import com.github.jrubygradle.storm.internal.JRubyStormJar
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import spock.lang.*
|
||||
|
||||
|
@ -69,6 +70,31 @@ class JRubyStormSpec extends Specification {
|
|||
task.dependsOn.find { it == task.assembleTask }
|
||||
}
|
||||
|
||||
def "into(destPath) should delegate to the assembleTask"() {
|
||||
given:
|
||||
final String path = "some-path"
|
||||
JRubyStormJar assembleTask = Mock(JRubyStormJar)
|
||||
JRubyStorm task = project.task('spock', type: JRubyStorm)
|
||||
task.assembleTask = assembleTask
|
||||
1 * assembleTask.into(path) >> assembleTask
|
||||
|
||||
expect:
|
||||
task.into(path) == assembleTask
|
||||
}
|
||||
|
||||
def "into(destPath, copySpec) should delegate to the assembleTask"() {
|
||||
given:
|
||||
final String path = "some-path"
|
||||
JRubyStormJar assembleTask = Mock(JRubyStormJar)
|
||||
JRubyStorm task = project.task('spock', type: JRubyStorm)
|
||||
task.assembleTask = assembleTask
|
||||
Closure copySpec = { 1 + 1 }
|
||||
1 * assembleTask.into(path, copySpec) >> assembleTask
|
||||
|
||||
expect:
|
||||
task.into(path, copySpec) == assembleTask
|
||||
}
|
||||
|
||||
def "getStormVersion() should return the storm.defaultStormVersion by default"() {
|
||||
given:
|
||||
JRubyStorm task = project.task('spock', type: JRubyStorm)
|
||||
|
|
Loading…
Reference in New Issue