Skip to content

Commit 6dff6c3

Browse files
authored
Merge pull request #389 from ysb33r/master
Remove Torquebox
2 parents 226bb19 + a8ffdf8 commit 6dff6c3

File tree

22 files changed

+120
-79
lines changed

22 files changed

+120
-79
lines changed

base-plugin/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-plugin
77

88
=== Compatibility
99

10-
This plugin requires link:http://gradle.org[Gradle] 4.0 or better
10+
This plugin requires link:http://gradle.org[Gradle] 4.9 or better
1111

1212
=== Installing
1313

base-plugin/build.gradle

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ project.afterEvaluate {
2222
// --- up to here
2323

2424
ext {
25-
olderJRubyVersion = '9.2.1.0'
2625
slimVersion = '2.0.2'
2726
leafyVersion = '0.4.0'
2827
}
@@ -48,31 +47,27 @@ dependencies {
4847
exclude group: 'org.codehaus.groovy'
4948
}
5049

51-
// NOTE: This is used by JRubyPrepareGemsIntegrationSpec
52-
integrationTestGems "rubygems:slim:${slimVersion}"
53-
54-
// NOTE: This is used by JRubyPrepareJarsIntegrationSpec
55-
integrationTestGems "rubygems:leafy-complete:${leafyVersion}"
56-
57-
// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec & JRubyExecExtensionIntegrationSpec
58-
integrationTestGems 'rubygems:credit_card_validator:1.1.0'
59-
60-
// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec
61-
integrationTestGems 'rubygems:rspec:3.1.0'
62-
63-
// NOTE: This should always be an older older version.
50+
// NOTE: This should always be an older older version.
6451
// It is used by JRubyExecIntegrationSpec
6552
integrationTestGems "org.jruby:jruby-complete:${olderJRubyVersion}"
6653

67-
// NOTE: older jruby versions needs this for exec to work properly
68-
integrationTestGems "rubygems:jar-dependencies:0.1.15"
69-
7054
// This is used by JRubyExecExtensionIntegrationSpec
7155
integrationTestGems "org.bouncycastle:bcprov-jdk15on:${bcprovVersion}"
7256

57+
// This is used by JRubyPrepareJarsIntegrationSpec
58+
integrationTestGems "io.dropwizard.metrics:metrics-core:${dropwizardMetricsCoreVersion}"
59+
7360
gradleTest "org.jruby:jruby-complete:${jrubyVersion}"
74-
gradleTest 'rubygems:credit_card_validator:1.1.0'
7561
gradleTest 'org.bouncycastle:bcprov-jdk15on:1.50'
62+
63+
// These are real GEMs which cannot currently be cached
64+
// gradleTest 'rubygems:credit_card_validator:1.1.0'
65+
// integrationTestGems "rubygems:slim:${slimVersion}"
66+
// integrationTestGems "rubygems:leafy-complete:${leafyVersion}"
67+
// integrationTestGems 'rubygems:credit_card_validator:1.1.0'
68+
// integrationTestGems 'rubygems:rspec:3.1.0'
69+
// integrationTestGems "rubygems:jar-dependencies:0.1.15"
70+
7671
}
7772

7873
generateTestConfig {
@@ -81,7 +76,10 @@ generateTestConfig {
8176
bcprovVersion: bcprovVersion,
8277
olderJRubyVersion: olderJRubyVersion,
8378
slimVersion: slimVersion,
84-
leafyVersion: leafyVersion
79+
leafyVersion: leafyVersion,
80+
creditCardValidatorVersion : '1.1.0',
81+
dropwizardMetricsCoreVersion : dropwizardMetricsCoreVersion,
82+
rspecVersion : '3.1.0'
8583
}
8684

8785
task copyIntegrationTestJRuby(type: Copy) {

base-plugin/src/gradleTest/jrubyExec/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ configurations {
66
jrubyExec
77
}
88

9+
repositories {
10+
ruby.gems()
11+
}
12+
913
dependencies {
10-
jrubyExec ':credit_card_validator:1.1.0@gem'
14+
jrubyExec 'rubygems:credit_card_validator:1.1.0'
1115
}
1216

1317

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ package com.github.jrubygradle
2525

2626
import com.github.jrubygradle.testhelper.IntegrationSpecification
2727
import org.gradle.testkit.runner.BuildResult
28+
import spock.lang.IgnoreIf
2829

2930
/**
3031
* @author Schalk W. Cronjé
3132
*/
33+
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
3234
class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
3335

34-
static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
35-
static final String BCPROV_NAME = 'bcprov-jdk15on'
36+
public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
37+
public static final String BCPROV_NAME = 'bcprov-jdk15on'
3638

3739
void "Run a script with minimum parameters"() {
3840
setup:
@@ -147,7 +149,7 @@ class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
147149
@SuppressWarnings('BuilderMethodWithSideEffects')
148150
private void createJRubyExecProject(String preamble, String jrubyexecConfig) {
149151
buildFile.text = """
150-
${projectWithLocalRepo}
152+
${projectWithRubyGemsRepo}
151153
152154
${preamble}
153155

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
151151
script 'rspec'
152152
"""
153153

154+
File specDir = new File(projectDir,'spec')
155+
specDir.mkdirs()
156+
new File(specDir,'sample.rb').text = ''
157+
154158
when:
155159
BuildResult result = build()
156160

@@ -224,7 +228,7 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
224228
buildFile.text = """
225229
import com.github.jrubygradle.JRubyExec
226230
227-
${projectWithMavenRepo}
231+
${projectWithRubyGemsRepo}
228232
229233
${preamble ?: ''}
230234

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import spock.lang.IgnoreIf
3030
/**
3131
* @author Schalk W. Cronjé
3232
*/
33+
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
3334
class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
3435

3536
static final String DEFAULT_TASK_NAME = 'RubyWax'
@@ -40,7 +41,7 @@ class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
4041
buildFile.text = """
4142
import com.github.jrubygradle.GenerateGradleRb
4243
43-
${projectWithLocalRepo}
44+
${projectWithRubyGemsRepo}
4445
4546
task ${DEFAULT_TASK_NAME} (type: GenerateGradleRb) {
4647
gemInstallDir 'build/gems'

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ import spock.lang.Issue
3131
/**
3232
* @author Schalk W. Cronjé.
3333
*/
34+
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
3435
class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
3536

3637
static final String DEFAULT_TASK_NAME = 'jrubyPrepare'
3738

38-
String repoSetup = projectWithLocalRepo
39+
String repoSetup = projectWithRubyGemsRepo
3940
String preamble
4041
String dependenciesConfig
4142

@@ -72,7 +73,7 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
7273
then:
7374
// since we need a version range in the setup the
7475
// resolved version here can vary over time
75-
new File(projectDir, "gems/rack-1.6.11").exists()
76+
new File(projectDir, "gems/rack-1.6.12").exists()
7677
}
7778

7879
@IgnoreIf({ IntegrationSpecification.OFFLINE })

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,35 @@
2424
package com.github.jrubygradle
2525

2626
import com.github.jrubygradle.testhelper.IntegrationSpecification
27+
import spock.lang.IgnoreIf
2728

2829
/**
2930
* @author Schalk W. Cronjé.
3031
* @author Christian Meier
3132
*/
33+
@IgnoreIf({ IntegrationSpecification.OFFLINE })
3234
class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification {
3335

3436
def "Check that default 'jrubyPrepare' uses the correct directory for the jars"() {
3537
given:
38+
String testVer = testProperties.dropwizardMetricsCoreVersion
3639
buildFile.text = """
37-
${projectWithLocalRepo}
40+
${projectWithRubyGemsRepo}
3841
3942
dependencies {
40-
gems 'io.dropwizard.metrics:metrics-core:3.1.0'
43+
gems "io.dropwizard.metrics:metrics-core:${testVer}"
4144
}
4245
"""
4346

4447
when:
4548
gradleRunner('jrubyPrepare', '-i').build()
4649

4750
then:
48-
new File(projectDir, 'build/.gems/Jars.lock').text.trim() == 'io.dropwizard.metrics:metrics-core:3.1.0:runtime:'
49-
new File(projectDir, 'build/.gems/jars/io/dropwizard/metrics/metrics-core/3.1.0/metrics-core-3.1.0.jar').exists()
51+
new File(projectDir, 'build/.gems/Jars.lock').text.trim() ==
52+
"io.dropwizard.metrics:metrics-core:${testProperties.dropwizardMetricsCoreVersion}:runtime:"
53+
new File(
54+
projectDir,
55+
"build/.gems/jars/io/dropwizard/metrics/metrics-core/${testVer}/metrics-core-${testVer}.jar"
56+
).exists()
5057
}
5158
}

base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,37 @@
2323
*/
2424
package com.github.jrubygradle.testhelper
2525

26+
2627
import org.gradle.testkit.runner.GradleRunner
2728
import org.junit.Rule
2829
import org.junit.rules.TemporaryFolder
2930
import spock.lang.Shared
3031
import spock.lang.Specification
3132

33+
import static com.github.jrubygradle.JRubyExecExtensionIntegrationSpec.BCPROV_NAME
34+
3235
class IntegrationSpecification extends Specification {
3336

34-
static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE')
37+
public static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE')
3538

36-
static final String HELLO_WORLD = 'helloWorld.rb'
37-
static final String HELLO_NAME = 'helloName.rb'
38-
static final String REQUIRES_GEM = 'requiresGem.rb'
39-
static final String REQUIRE_THE_A_GEM = 'require-a-gem.rb'
40-
static final String ENV_VARS = 'envVars.rb'
39+
public static final String HELLO_WORLD = 'helloWorld.rb'
40+
public static final String HELLO_NAME = 'helloName.rb'
41+
public static final String REQUIRES_GEM = 'requiresGem.rb'
42+
public static final String REQUIRE_THE_A_GEM = 'require-a-gem.rb'
43+
public static final String ENV_VARS = 'envVars.rb'
4144

4245
@Shared
4346
Map testProperties
47+
4448
@Shared
4549
File flatRepoLocation
50+
4651
@Shared
4752
File mavenRepoLocation
4853

54+
@Shared
55+
Map artifactVersions
56+
4957
@Rule
5058
TemporaryFolder testFolder
5159

@@ -57,6 +65,15 @@ class IntegrationSpecification extends Specification {
5765
testProperties = loadTestProperties()
5866
flatRepoLocation = new File(testProperties.flatrepo)
5967
mavenRepoLocation = new File(testProperties.mavenrepo)
68+
69+
artifactVersions = [
70+
'credit_card_validator': testProperties.creditCardValidatorVersion,
71+
'rspec' : testProperties.rspecVersion,
72+
'rspec-core' : testProperties.rspecVersion,
73+
'rspec-support' : testProperties.rspecVersion,
74+
'metrics-core' : testProperties.dropwizardMetricsCoreVersion,
75+
(BCPROV_NAME) : testProperties.bcprovVersion
76+
]
6077
}
6178

6279
void setup() {
@@ -73,28 +90,19 @@ class IntegrationSpecification extends Specification {
7390
destination.text = this.class.getResource("/scripts/${name}").text
7491
}
7592

93+
7694
String findDependency(final String organisation, final String artifact, final String extension) {
77-
"'${VersionFinder.findDependency(flatRepoLocation, organisation, artifact, extension)}'"
95+
String ver = artifactVersions[artifact]
96+
if (!ver) {
97+
throw new RuntimeException("No version specified for ${artifact}")
98+
}
99+
"'${organisation ?: 'rubygems'}:${artifact}:${ver}@${extension}'"
78100
}
79101

80102
String pathAsUriStr(final File path) {
81103
path.absoluteFile.toURI().toString()
82104
}
83105

84-
String getProjectWithLocalRepo() {
85-
"""
86-
plugins {
87-
id 'com.github.jruby-gradle.base'
88-
}
89-
90-
repositories {
91-
flatDir {
92-
dirs '${pathAsUriStr(flatRepoLocation)}'.toURI()
93-
}
94-
}
95-
"""
96-
}
97-
98106
String getProjectWithMavenRepo() {
99107
"""
100108
plugins {
@@ -138,13 +146,14 @@ class IntegrationSpecification extends Specification {
138146
}
139147
"""
140148
}
149+
141150
GradleRunner gradleRunner(List<String> args) {
142151
GradleRunner.create()
143-
.withProjectDir(projectDir)
144-
.withDebug(true)
145-
.withArguments(args)
146-
.withPluginClasspath()
147-
.forwardOutput()
152+
.withProjectDir(projectDir)
153+
.withDebug(true)
154+
.withArguments(args)
155+
.withPluginClasspath()
156+
.forwardOutput()
148157
}
149158

150159
GradleRunner gradleRunner(String... args) {

base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
263263
*
264264
* There are three modes of behaviour
265265
* <ul>
266-
* <li> script set. no jrubyArgs, or jrubyArgs does not contain {@code -S} - Normal way to execute script. A check
266+
* <li> script set. no jrubyArgs, or jrubyArgs does not contain {@code -S}: normal way to execute script. A check
267267
* whether the script exists will be performed.
268-
* <li> script set. jrubyArgs contains {@code -S} - If script is not absolute, no check will be performed to see
268+
* <li> script set. jrubyArgs contains {@code -S}: if script is not absolute, no check will be performed to see
269269
* if the script exists and will be assumed that the script can be found using the default ruby path mechanism.
270-
* <li> script not set, but jrubyArgs set - Set up to execute jruby with no script. This should be a rarely used otion.
270+
* <li> script not set, but jrubyArgs set: set up to execute jruby with no script. This should be a rarely used
271+
* option.
271272
* </ul>
272273
*
273274
* @throw {@code org.gradle.api.InvalidUserDataException} if mode of behaviour cannot be determined.

0 commit comments

Comments
 (0)