Skip to content

Commit 428189d

Browse files
committed
Fixed the issue with project.javaexec
1 parent 9bd9b88 commit 428189d

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

src/integTest/groovy/com/lookout/jruby/JRubyExecExtensionIntegrationSpec.groovy

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
package com.lookout.jruby
22

3-
import org.gradle.api.artifacts.Configuration
4-
import org.gradle.api.artifacts.repositories.ArtifactRepository
53
import org.gradle.testfixtures.ProjectBuilder
6-
import spock.lang.FailsWith
7-
import spock.lang.Ignore
8-
import spock.lang.IgnoreIf
9-
import spock.lang.IgnoreRest
10-
import spock.lang.Specification
11-
import spock.lang.Stepwise
4+
import spock.lang.*
125

136
import static org.gradle.api.logging.LogLevel.LIFECYCLE
147

158
/**
169
* @author Schalk W. Cronjé
1710
*/
1811
class JRubyExecExtensionIntegrationSpec extends Specification {
19-
20-
static final boolean TESTS_ARE_OFFLINE = true
21-
//static final boolean TESTS_ARE_OFFLINE = System.getProperty('TESTS_ARE_OFFLINE') != null
12+
13+
static final boolean TESTS_ARE_OFFLINE = System.getProperty('TESTS_ARE_OFFLINE') != null
2214
static final File TEST_SCRIPT_DIR = new File( System.getProperty('TEST_SCRIPT_DIR') ?: 'src/integTest/resources/scripts')
2315
static final File TESTROOT = new File("${System.getProperty('TESTROOT') ?: 'build/tmp/test/integration-tests'}/jreeis")
2416

@@ -38,19 +30,18 @@ class JRubyExecExtensionIntegrationSpec extends Specification {
3830
}
3931
}
4032

41-
4233
@IgnoreIf({TESTS_ARE_OFFLINE})
4334
def "Run a script with minimum parameters"() {
4435
given:
4536
def output = new ByteArrayOutputStream()
4637

47-
when:
38+
when: "I call jrubyexec with only a script name"
4839
project.jrubyexec {
4940
script "${TEST_SCRIPT_DIR}/helloWorld.rb"
5041
standardOutput output
5142
}
5243

53-
then:
44+
then: "I expect the Ruby script to be executed"
5445
output.toString() == "Hello, World\n"
5546
}
5647

src/main/groovy/com/lookout/jruby/GemUtils.groovy

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ class GemUtils {
2525
}
2626
}
2727

28-
/** Given a FileCollection return a filtered FileCollection only containing GEMs
29-
*
30-
* @param fc Original FileCollection
31-
* @return Filtered FileCollection
32-
*/
33-
static FileCollection getGems(Configuration fc) {
34-
fc.files { File f ->
35-
f.name.toLowerCase().endsWith('.gem')
36-
}
37-
}
38-
3928
/** Extract a gem to the default {@code gemInstallDir} dreictory using the default jruby version
4029
*
4130
* @param project Current project
@@ -124,9 +113,11 @@ class GemUtils {
124113
* @param action
125114
*/
126115
static void extractGems(Project project,Configuration jRubyClasspath, Configuration gemConfig,File destDir,GemUtils.OverwriteAction action ) {
127-
getGems(gemConfig).each { File f ->
116+
getGems(project.files(gemConfig.files)).each { File f ->
128117
GemUtils.extractGem(project,jRubyClasspath,f,destDir,action)
129118
}
119+
120+
130121
}
131122

132123
/** Take the given .gem filename (e.g. rake-10.3.2.gem) and just return the

0 commit comments

Comments
 (0)