Skip to content

Commit 6e1be93

Browse files
committed
Describe repositories and GEM resolver strategy customisation (#378)
1 parent 60829c7 commit 6e1be93

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

core-plugin/README.adoc

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,41 @@ plugins {
3232
repositories {
3333
ruby.mavengems() // <1>
3434
ruby.mavengems('https://foo.bar') // <2>
35-
ruby.mavengems('https://foo.bar', 'acme-rubygems') // <3>
35+
ruby.mavengems('acme-rubygems', 'https://foo.bar') // <3>
36+
37+
ruby.gems() // <4>
38+
ruby.gems { // <5>
39+
prerelease = true
40+
}
41+
ruby.gems('https://foo.bar') // <6>
42+
ruby.gems('acme-rubygems', 'https://foo.bar') // <7>
3643
}
3744
----
3845
<1> Adds a Maven repository that uses the one official supported by the JRuby group. In order to use this, GEM dependencies should all be placed in the `rubygems` group.
3946
<2> Adds a custom Maven repository that will proxy a GEMs repository. In order to use this, GEM dependencies should all be placed in the `rubygems` group.
40-
<3> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist.
47+
<3> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist.
48+
<4> Proxy rubygems.org directly and use `rubygems` as the Maven coordinate group.
49+
<5> Proxy rubygems.org directly and allow prerelease GEMs to be considered. Use `rubygems` as the Maven coordinate group.
50+
<6> Proxy a custom rubygems repository.
51+
<7> Proxy a custom rubygems repository and assign a custom Maven coordinate group.
52+
53+
== Advanced
54+
55+
=== Customising GEM resolving
56+
57+
By default the `rubygems` configuration and others added via `ruby.mavengems()` and `ruby.gems()` will have additional resolving strategies applied that mimicks GEM behaviour rather then Gradle behaviour. It is possible to customise this behaviour.
58+
59+
.build.gradle
60+
[source,groovy]
61+
----
62+
gemResolverStrategy {
63+
excludeConfigurations 'foo', 'bar' // <1>
64+
excludeModule 'foo.*' // <2>
65+
excludeModule 'foo.*', /1\.2.*/ // <3>
66+
useGemVersionResolver 'gems2'
67+
}
68+
----
69+
<1> Exclude configurations `foo` and `bar` from being considered for GEM resolver strategies.
70+
<2> Exclude module that matches regular expression from GEM resolver strategies.
71+
<3> Exclude module and version that matches regular expression from GEM resolver strategies.
72+
<4> Apply GEM resolver strategies to a specific configuration.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class GemResolverStrategy {
102102

103103
/** Whether the GEM version resolving strategy should be applied for a specific module.
104104
*
105-
* In most cases this will alsways be {@code true} unless a specific rule excludes it.
105+
* In most cases this will always be {@code true} unless a specific rule excludes it.
106106
*
107107
* @param mvs Module version selector
108108
* @return Whether the Bundler-like version selector atregty may be applied

0 commit comments

Comments
 (0)