Skip to content

Commit a0ed2c0

Browse files
committed
Allow Torquebox to still be used, if required. (#364)
1 parent 0674e0f commit a0ed2c0

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

base-plugin/README.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,20 @@ repositories {
199199
ruby.gems() // <1>
200200
ruby.gems('https://your-own-server.org') // <2>
201201
ruby.gems('https://another-server.org', 'acmegems') // <3>
202+
ruby.torquebox() // <4>
202203
}
203204
204205
dependencies {
205-
gems 'rubygems:sinatra:1.4.5' // <4>
206-
gems 'acmegems:some-gem:1.2.3' // <5>
206+
gems 'rubygems:sinatra:1.4.5' // <5>
207+
gems 'acmegems:some-gem:1.2.3' // <6>
207208
}
208209
----
209210
<1> Retrieve GEMs from https://rubygems.org
210211
<2> Retrieve GEMs from another server.
211212
<3> Retrieve GEMS from another server and associated a custom group name with that server.
212-
<4> Retrieve a GEM. `rubygems` is the default group for GEMs.
213-
<5> Retrieve a GEM using a custom group.
213+
<4> Enabled the legacy Torquebox Maven proxy. Please note that this proxy server is unmaintained upstream and may lead to brittle builds in some cases.
214+
<5> Retrieve a GEM. `rubygems` is the default group for GEMs.
215+
<6> Retrieve a GEM using a custom group.
214216

215217
NOTE: If the version of Gradle supports the `content` DSL keyword for repositories, only
216218
requests dependencies with the specific groups will be sent to the GEM repositories.

core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import com.github.jrubygradle.api.gems.GemGroups
44
import com.github.jrubygradle.internal.core.IvyXmlGlobalProxyRegistry
55
import groovy.transform.CompileDynamic
66
import groovy.transform.CompileStatic
7+
import org.gradle.api.Action
78
import org.gradle.api.Project
89
import org.gradle.api.artifacts.repositories.ArtifactRepository
910
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
11+
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
1012
import org.gradle.util.GradleVersion
1113

1214
/** Extension which can be added to {@code project.repositories}.
@@ -62,6 +64,25 @@ class RepositoryHandlerExtension {
6264
bindRepositoryToProxyServer(project.uri(uri), group)
6365
}
6466

67+
/** Adds the legacy Torquebox Maven proxy to {@code rubygems.org}.
68+
*
69+
* Please note that this proxy is effectively unmaintained an no longer supported
70+
* by the original creators.
71+
*
72+
* @return Maven artifact repository
73+
*/
74+
MavenArtifactRepository torquebox() {
75+
Action mvnConfigurator = new Action<MavenArtifactRepository>() {
76+
void execute(MavenArtifactRepository mvn) {
77+
mvn.url = 'http://rubygems-proxy.torquebox.org/releases'.toURI()
78+
}
79+
}
80+
(MavenArtifactRepository)restrictToGems(
81+
this.project.repositories.maven(mvnConfigurator),
82+
DEFAULT_GROUP_NAME
83+
)
84+
}
85+
6586
private ArtifactRepository bindRepositoryToProxyServer(
6687
URI serverUri,
6788
String group
@@ -80,7 +101,7 @@ class RepositoryHandlerExtension {
80101
}
81102

82103
@CompileDynamic
83-
private IvyArtifactRepository restrictToGems(IvyArtifactRepository repo, String group) {
104+
private ArtifactRepository restrictToGems(ArtifactRepository repo, String group) {
84105
if (HAS_CONTENT_FEATURE) {
85106
repo.content {
86107
it.includeGroup group

0 commit comments

Comments
 (0)