Skip to content

Commit 98d86b3

Browse files
committed
Update documentation for new features (#364,#366)
1 parent 9387364 commit 98d86b3

File tree

4 files changed

+112
-65
lines changed

4 files changed

+112
-65
lines changed

base-plugin/README.adoc

Lines changed: 96 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,16 @@ 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] 2.0 or better
11-
10+
This plugin requires link:http://gradle.org[Gradle] 4.0 or better
1211

1312
=== Installing
1413

1514
.build.gradle
1615
[source, groovy]
1716
----
18-
buildscript {
19-
repositories { jcenter() }
20-
21-
dependencies {
22-
/* check jruby-gradle.org for the latest release */
23-
classpath "com.github.jruby-gradle:jruby-gradle-plugin:[1.1.4,2.0)"
24-
}
17+
plugins {
18+
id 'com.github.jruby-gradle.base' version 'VERSION-OF-PLUGIN'
2519
}
26-
27-
apply plugin: 'com.github.jruby-gradle.base'
2820
----
2921

3022
=== Adding gems
@@ -44,15 +36,9 @@ dependencies {
4436
}
4537
----
4638

47-
IMPORTANT: Prereleased gems can only be a specific version due to limitations of mapping a rubygems repository to a maven repository.
39+
IMPORTANT: Prereleased gems should only be a specific version due to limitations of mapping a rubygems repository to an Ivy repository.
4840

49-
NOTE: This functionality currently relies on a deployed version of the
50-
link:https://github.com/torquebox/rubygems-servlets[rubygems-servlets]
51-
software to help proxy a Rubygem repository into a Maven repository format.
52-
This ensures that Gradle can resolve gem-based dependencies. _Currently_ the
53-
plugin release on link:http://rubygems.lasagna.io/proxy/maven/releases[a
54-
Rubygems Maven proxy] operated by link:https://github.com/rtyler[R. Tyler
55-
Croy]
41+
NOTE: This functionality relies on an internal proxy which converts information from https://rubygems.org in to an Ivy repository service. this functionality is enabled by adding `ruby.gems()` to the `repositories` block. If you have a running Maven GEMs proxy you may use that too.
5642

5743
== Tasks
5844

@@ -89,16 +75,7 @@ Common methods for `JRubyExec` for executing a script
8975
* `standardOutput` - `OutputStream`. Capture the output of the script.
9076
* `errorOutput` - `OutputStream`. Capture the error output of the script.
9177
* `ignoreExitValue` - `Boolean`. Ignore the JVm exit value. Exit values are only effective if the exit value of the Ruby script is correctly communicated back to the JVM.
92-
* `configuration` - `String`. Configuration to copy gems from. (*)
93-
* `classpath` - `List`. Additional Jars/Directories to place on classpath.
94-
* `jrubyVersion` - `String`. JRuby version to use if not the same as ```project.jruby.execVersion```.
95-
* `gemWorkDir` - `File`. Provide a custom working directory for unpacking GEMs. By default each `JRubyExec` task
96-
uses it's own work directory. Use this to set a common work directory for a number of tasks.
97-
98-
(*) If `jrubyVersion` has not been set, `jrubyExec` will used as configuration.
99-
However, if `jrubyVersion` has been set, a configuration must also be provded
100-
to maintain dependency isolation, see
101-
link:http://jruby-gradle.org/errors/jrubyexec-version-conflict/[this page] for more details.
78+
* `jruby` - `JRubyPluginExtension`. Allows to override settigns from the global `jruby` extension.
10279

10380
Additional `JRubyExec` methods for controlling the JVM instance
10481

@@ -135,11 +112,8 @@ task needSomeRubyLove {
135112

136113
The behaviour of `project.jrubyexec` is slightly different to that of `JRubyExec`.
137114

138-
* The version of `jruby-complete` is strictly tied to the `jruby.execVersion`. Therefore trying to set `jrubyVersion`
139-
in the ```jrubyexec``` closure will cause a failure
140-
* GEMs and additional JARs are only taken from the `jrubyExec` configuration.
141-
* It is not possible to supply a `configuration` parameter to the `jrubyexec` closure.
142-
* GEMs will be installed to `jruby.gemInstallDir`. Existing gems will not be overwritten.
115+
* The version of JRuby is strictly tied to the global `jruby.jrubyVersion`.
116+
* GEMs and additional JARs are only taken from the `jruby.gemConfiguration` configuration.
143117

144118
As with `JRubyExec`, `args`, `setArgs` and `main` are illegal within the `jrubyexec` closure.
145119
All other methods should work.
@@ -180,7 +154,11 @@ ext {
180154

181155
link:/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyPrepare.html[API docs]
182156

183-
Unpacking occurs using the default `jruby` version as set by `jruby.execVersion`.
157+
Unpacking occurs using the default JRuby version as set by `jruby.jrubyVersion`. This can be overridden within the task itself if required.
158+
159+
In most cases you do not have to do anything. The JRubyPrepare task will be created for you and associated with the appropriate configuration. If you customise configurations or use different configurations for different tasks, Gradle will useually create appropriate `JRubyPrepare` tasks for you and link the appropriate task dependencies.
160+
161+
You can also create your own custom `JRubyPrepare` tasks if required.
184162

185163
.build.gradle
186164
[source,gradle]
@@ -237,36 +215,6 @@ dependencies {
237215
NOTE: If the version of Gradle supports the `content` DSL keyword for repositories, only
238216
requests dependencies with the specific groups will be sent to the GEM repositories.
239217

240-
=== Using a custom Gem repository
241-
242-
By default the jruby plugin will use
243-
link:http://rubygems.lasanga.io[rubygems.lasanga.io] as its source of Ruby
244-
gems. This is a server operated by link:https://github.com/rtyler[R. Tyler
245-
Croy] and it presents a Maven repository of the data from
246-
link:https://rubygems.org[rubygems.org].
247-
248-
If you **do not** wish to use this repository, you can run your own Maven proxy
249-
repository for either rubygems.org or your own gem repository by running the
250-
link:https://github.com/torquebox/rubygems-servlets[rubygems-servlets] server.
251-
252-
You can then use that custom Gem repository with:
253-
254-
.build.gradle
255-
[source,gradle]
256-
----
257-
jruby {
258-
defaultRepositories false
259-
}
260-
261-
repositories {
262-
maven { url 'http://localhost:8989/releases' }
263-
}
264-
265-
dependencies {
266-
gems 'rubygems:my-custom-gem:1.0.1'
267-
}
268-
----
269-
270218
=== Using the JRuby/Gradle without Gradle
271219

272220
There are still plenty of cases, such as for local development, when you might
@@ -286,3 +234,86 @@ end
286234

287235
NOTE: The `.rb` file is assuming it's in the top level of the source tree, i.e.
288236
where `build.gradle` is located
237+
238+
== Upgrading to 2.x from 1.7.x
239+
240+
If you are already using the base proxy for work, upgrading will yield a number of surprises. Hopefully they will come as nice wow factors once you have changed your build file.
241+
242+
=== Default repositories
243+
244+
Repositories are no longer added by default. You should explictly declare which repositories you require. If you still need the old behaviour, you can obtain that by
245+
246+
[source,groovy]
247+
----
248+
jruby {
249+
defaultRepositories = true // <1>
250+
}
251+
----
252+
<1> Adds `ruby.gems()` and `jcenter()`.
253+
254+
This functionality is deprecated and will be removed in a future version.
255+
256+
=== jrubyExec configuration
257+
258+
The `jrubyExec` configuration is no longer added as the GEM configuration handling has been cleaned up and much improved in 2.x. If you have a number of instances relying on `jrubyExec` you can do
259+
260+
[source,groovy]
261+
----
262+
configurations {
263+
jrubyExec
264+
}
265+
----
266+
267+
and then enable this configuration either globally as your GEM configuration by doing
268+
269+
[source,groovy]
270+
----
271+
jruby {
272+
gemConfiguration 'jrubyExec'
273+
}
274+
----
275+
276+
or on a task-specific basis
277+
278+
[source,groovy]
279+
----
280+
task myRunner(type: JRubyExec) {
281+
jruby {
282+
gemConfiguration 'jrubyExec' // <1>
283+
}
284+
}
285+
----
286+
<1> Enables configuration only for the given task.
287+
288+
NOTE: If you set `gemConfiguration 'jrubyExec'` you will also notice that Gradle creates a `jrubyPrepareJrubyExec` tasks to unpack your GEMs in an isolated area.
289+
290+
=== Setting GEM & JAR installation directories
291+
292+
This behaviour was already deprecated in 1.7.x and has now been removed. Directories are now associated with specific configuration names. For the `gems` configuration this is in `${buildDir}/.gems`. For other configurations it will be a different directory. You can obtain the directory, via the `JRubyPrepare.getOutputDir()` method.
293+
294+
=== Setting the JRuby version to use
295+
296+
`jruby.defaultVersion` is deprecated. Do this rather via
297+
298+
[source,groovy]
299+
----
300+
jruby {
301+
jrubyVersion = '9.1.2.3'
302+
}
303+
----
304+
305+
You can also override the JRuby version a per-task basis.
306+
307+
[source,groovy]
308+
----
309+
task myRunner(type: JRubyExec) {
310+
jruby {
311+
jrubyVersion = '9.1.2.3' // <1>
312+
}
313+
}
314+
----
315+
<1> Use a different version of JRuby only in a specific task, whilst using a globally configured version for everything else.
316+
317+
=== Changing the JRubyExec configuration
318+
319+
The `configuration` is deprecated. Use `jruby.gemConfiguration` on the task itself for a custom configuration.

core-plugin/README.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
== Core plugin
2+
3+
The core plugin is not meant for consumption by build script authors. It is rather targeted at authors of other plugins that might require some core JRuby functionality without the conventional and extensions that is associated with other JRuby-Gradle plugins.
4+
5+
This plugin offers the following functionality:
6+
7+
* A repository handler extension to resolve GEMs directly from https://rubygems.org or another GEM repository that serves the same REST API.
8+
* Conversion between GEM-style and Ivy-style dependencies notations.
9+
* An abstract task class (`AbstractJRubyPrepare`) for preparing local GEM + JAR installations.
10+

docs/core.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Core plugin
2+
:page-layout: base
3+
:toc: right
4+
5+
include::./../core-plugin/README.adoc[]

docs/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ NOTE: As from version 2.0.0 you will need at least Gradle 4.2.
1818
* link:jar/[Jar]
1919
* link:war/[War]
2020
* link:storm/[Storm]
21+
* link:core/[Core]
2122
2223
== Quick Start
2324

0 commit comments

Comments
 (0)