Skip to content

Commit e27f895

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gocd-master
2 parents 0864cbf + 880f427 commit e27f895

File tree

216 files changed

+3184
-1498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+3184
-1498
lines changed

.github/workflows/maven.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
# Default versions for canonical release build
1111
DEFAULT_JAVA_VERSION: '8'
12-
DEFAULT_JRUBY_VERSION: '9.4.13.0' # Should match pom.xml <jruby.version> property (AND a version inside the test matrix)
12+
DEFAULT_JRUBY_VERSION: '9.4.14.0' # Should match pom.xml <jruby.version> property (AND a version inside the test matrix)
1313
DEFAULT_RACK_VERSION: '~> 2.2.0' # Should match Gemfile (AND a version inside the test matrix)
1414

1515
jobs:
@@ -19,8 +19,8 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
jruby_version: [ '9.4.13.0', '10.0.2.0' ]
23-
java_version: [ '8', '11', '17', '21' ]
22+
jruby_version: [ '9.4.14.0', '10.0.2.0' ]
23+
java_version: [ '8', '11', '17', '21', '25' ]
2424
rack_version: [ '~> 2.2.0' ]
2525
exclude:
2626
- jruby_version: '10.0.2.0'
@@ -32,10 +32,10 @@ jobs:
3232
fail-fast: false
3333

3434
steps:
35-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3636

3737
- name: Set up JDK
38-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
38+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
3939
with:
4040
java-version: ${{ matrix.java_version }}
4141
distribution: 'temurin'
@@ -59,17 +59,14 @@ jobs:
5959
strategy:
6060
matrix:
6161
appraisal: [
62-
'rails50_rack22',
63-
'rails52_rack22',
64-
'rails60_rack22',
6562
'rails61_rack22',
6663
'rails70_rack22',
6764
'rails71_rack22',
6865
'rails72_rack22',
6966
'rails80_rack22',
7067
]
71-
jruby_version: [ '9.4.13.0', '10.0.2.0' ]
72-
java_version: [ '8', '11', '17', '21' ]
68+
jruby_version: [ '9.4.14.0', '10.0.2.0' ]
69+
java_version: [ '8', '11', '17', '21', '25' ]
7370
exclude:
7471
- jruby_version: '10.0.2.0'
7572
java_version: '8' # JRuby 10 requires Java 21
@@ -78,25 +75,25 @@ jobs:
7875
- jruby_version: '10.0.2.0'
7976
java_version: '17' # JRuby 10 requires Java 21
8077
- appraisal: 'rails80_rack22'
81-
jruby_version: '9.4.13.0' # Rails 8 requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
78+
jruby_version: '9.4.14.0' # Rails 8 requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
8279
fail-fast: false
8380

8481
env:
8582
BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile
8683
JRUBY_VERSION: ${{ matrix.jruby_version }}
8784

8885
steps:
89-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
86+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
9087

9188
- name: Set up JDK
92-
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
89+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
9390
with:
9491
java-version: ${{ matrix.java_version }}
9592
distribution: 'temurin'
9693
cache: maven
9794

9895
- name: Setup JRuby
99-
uses: ruby/setup-ruby@829114fc20da43a41d27359103ec7a63020954d4 # v1.255.0
96+
uses: ruby/setup-ruby@v1
10097
with:
10198
ruby-version: jruby-${{ matrix.jruby_version }}
10299
bundler-cache: 'false' # Need to install later so we can vary from Gemfile.lock as required for JRuby version compatibility

Appraisals

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ version_spec = ->(prefix, desc) { "~> #{desc.split(prefix).last.insert(1, ".")}.
33
# Rails version -> rack versions in format
44
# rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ]
55
{
6-
"rails50" => %w[rack22],
7-
"rails52" => %w[rack22],
8-
"rails60" => %w[rack22],
96
"rails61" => %w[rack22],
107
"rails70" => %w[rack22],
118
"rails71" => %w[rack22],

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ group :default do
44
if rack_version = ENV['RACK_VERSION']
55
gem 'rack', rack_version
66
else
7-
gem 'rack', '~> 2.2.0'
7+
gem 'rack', '~> 2.2.18'
88
end
99
end
1010

Gemfile.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GEM
66
rake
77
thor (>= 0.14.0)
88
diff-lcs (1.6.2)
9-
rack (2.2.17)
9+
rack (2.2.18)
1010
rake (13.3.0)
1111
rspec (3.13.1)
1212
rspec-core (~> 3.13.0)
@@ -28,10 +28,11 @@ PLATFORMS
2828
universal-java-11
2929
universal-java-17
3030
universal-java-21
31+
universal-java-25
3132
x86_64-linux
3233

3334
DEPENDENCIES
3435
appraisal
35-
rack (~> 2.2.0)
36+
rack (~> 2.2.18)
3637
rake (~> 13.3)
3738
rspec

History.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Support Javax Servlet API 4.0 (JEE 8)
44
- Adds basic compatibility with JRuby 10.0
55
- Drop support for JRuby 9.3
6+
- Drop support for Rails < 6.1
67
- Drop unnecessary `jruby.compat.version` and `RackConfig.getCompatVersion()` API
78
- Drop JMS support
89
- Drop deprecated `RackLogger` string (level) constants
@@ -18,6 +19,17 @@
1819
- Change context listener to throw, in case of an exception during initialization, by default
1920
- Change rails context listener to assume a thread-safe application by default
2021

22+
## 1.2.6 (UNRELEASED)
23+
24+
- Add missing block-only signature for debug logging
25+
- update (bundled) rack to 2.2.18
26+
27+
## 1.2.5
28+
29+
- Fix use of jruby-rack under Java 8 (#324)
30+
- Fix deprecated usages of JRuby runtime
31+
- Fix deprecated usages of Rack API
32+
2133
## 1.2.4
2234

2335
- update (bundled) rack to 2.2.17

README.md

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ dependencies {
3030

3131
| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes |
3232
|------------------------------------------------------------|------------|-----------|------------|------|-----------|---------------------|--------------------------------------------|
33-
| 2.0 (_planned_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 5.0 → 8.0 | 5.0+ (Jakarta EE 9) | Pre 5.0 servlet APIs non functional. |
34-
| 1.3 (master, _unreleased_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 5.0 → 8.0 | 4.0 (Java EE 8) | Servlet 2.5 → 3.1 likely to work fine. |
33+
| 2.0 (_planned_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 6.1 → 8.0 | 5.0+ (Jakarta EE 9) | Pre 5.0 servlet APIs non functional. |
34+
| 1.3 (master, _unreleased_) | Dev | 2.2 | 9.4 → 10.0 | 8+ | 6.1 → 8.0 | 4.0 (Java EE 8) | Servlet 2.5 → 3.1 likely to work fine. |
3535
| [1.2](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 9.4 | 8+ | 5.0 → 7.2 | 3.0 (Java EE 6) | Servlet 3.1 → 4.0 OK with some containers. |
3636
| [1.1](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) | Servlet 3.0 → 4.0 OK with some containers. |
3737
| 1.0 | EOL | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | |
@@ -46,16 +46,18 @@ in your WAR file when it gets built.
4646
If you're assembling your own WAR using other means, you can install the
4747
**jruby-rack** gem. It provides a method to locate the jar file:
4848

49-
require 'jruby-rack'
50-
FileUtils.cp JRubyJars.jruby_rack_jar_path, '.'
49+
```ruby
50+
require 'jruby-rack'
51+
FileUtils.cp JRubyJars.jruby_rack_jar_path, '.'
52+
```
5153

5254
Otherwise you'll need to download the latest [jar release][2], drop it into the
53-
*WEB-INF/lib* directory and configure the `RackFilter` in your application's
54-
*web.xml* (see following examples).
55+
`WEB-INF/lib` directory and configure the `RackFilter` in your application's
56+
`web.xml` (see following examples).
5557

5658
### Rails
5759

58-
Here's sample *web.xml* configuration for Rails. Note the environment and
60+
Here's sample `web.xml` configuration for Rails. Note the environment and
5961
min/max runtime parameters. For **multi-threaded** (a.k.a. `threadsafe!`)
6062
Rails with a single runtime, set min/max both to 1. Otherwise, define the size
6163
of the runtime pool as you wish.
@@ -104,8 +106,8 @@ of the runtime pool as you wish.
104106
### (Other) Rack Applications
105107

106108
The main difference when using a non-Rails Rack application is that JRuby-Rack
107-
looks for a "rackup" file named **config.ru** in `WEB-INF/config.ru` or
108-
`WEB-INF/*/config.ru`. Here's a sample *web.xml* configuration :
109+
looks for a "rackup" file named `config.ru` in `WEB-INF/config.ru` or
110+
`WEB-INF/*/config.ru`. Here's a sample `web.xml` configuration :
109111

110112
```xml
111113
<filter>
@@ -123,8 +125,8 @@ looks for a "rackup" file named **config.ru** in `WEB-INF/config.ru` or
123125
</listener>
124126
```
125127

126-
If you don't have a *config.ru* or don't want to include it in your web app, you
127-
can embed it directly in the *web.xml* as follows (using Sinatra as an example):
128+
If you don't have a `config.ru` or don't want to include it in your web app, you
129+
can embed it directly in the `web.xml` as follows (using Sinatra as an example):
128130

129131
```xml
130132
<context-param>
@@ -160,7 +162,7 @@ using is `org.jruby.rack.RackFilter`, the filter supports the following
160162
only), by default "true"
161163
- **addsHtmlToPathInfo** controls whether the .html suffix is added to the URI
162164
when checking if the request is for a static page. The default behavior for
163-
Rails and many other Ruby applications is to add an *.html* extension to the
165+
Rails and many other Ruby applications is to add an `.html` extension to the
164166
resource and attempt to handle it before serving a dynamic request on the
165167
original URI. However, this behavior may confuse other servlets in your
166168
application that have a wildcard mapping. Defaults to true.
@@ -174,9 +176,9 @@ a filter, the servlet class name is `org.jruby.rack.RackServlet`.
174176
## Servlet Environment Integration
175177

176178
- servlet context is accessible to any application through the Rack environment
177-
variable *java.servlet_context* (as well as the `$servlet_context` global).
179+
variable `java.servlet_context` (as well as the `$servlet_context` global).
178180
- the (native) servlet request and response objects could be obtained via the
179-
*java.servlet_request* and *java.servlet_response* keys
181+
`java.servlet_request` and `java.servlet_response` keys
180182
- all servlet request attributes are passed through to the Rack environment (and
181183
thus might override request headers or Rack environment variables)
182184
- servlet sessions can be used as a (java) session store for Rails, session
@@ -198,13 +200,13 @@ JRuby runtime management and pooling is done automatically by the framework.
198200
For Rack-only applications (and Rails ones from jruby-rack >= 1.3), a single
199201
shared runtime is created and shared for every request by default.
200202

201-
If *jruby.min.runtimes* and *jruby.max.runtimes* values are
203+
If `jruby.min.runtimes` and `jruby.max.runtimes` values are
202204
specified pooling of runtimes can be enabled for both types of applications.
203205

204206
We do recommend to boot your runtimes up-front to avoid the cost of initializing
205207
one while a request kicks in and find the pool empty, this can be easily avoided
206-
by setting *jruby.min.runtimes* equal to *jruby.max.runtimes*. You might also
207-
want to consider tuning the *jruby.runtime.acquire.timeout* parameter to not
208+
by setting `jruby.min.runtimes` equal to `jruby.max.runtimes`. You might also
209+
want to consider tuning the `jruby.runtime.acquire.timeout` parameter to not
208210
wait too long when all (max) runtimes from the pool are busy.
209211

210212
## JRuby-Rack Configuration
@@ -214,18 +216,18 @@ as context init parameters in web.xml or as VM-wide system properties.
214216

215217
- `rackup`: Rackup script for configuring how the Rack application is mounted.
216218
Required for Rack-based applications other than Rails. Can be omitted if a
217-
*config.ru* is included in the application root.
219+
`config.ru` is included in the application root.
218220
- `public.root`: Relative path to the location of your application's static
219-
assets. Defaults to */*.
221+
assets. Defaults to `*/*`.
220222
- `rails.root`: Root path to the location of the Rails application files.
221-
Defaults to */WEB-INF*.
223+
Defaults to `*/WEB-INF*`.
222224
- `rails.env`: Specify the Rails environment to run. Defaults to 'production'.
223225
- `rails.relative_url_append`: Specify a path to be appended to the
224226
`ActionController::Base.relative_url_root` after the context path. Useful
225227
for running a rails app from the same war as an existing app, under a
226228
sub-path of the main servlet context root.
227229
- `gem.path`: Relative path to the bundled gem repository. Defaults to
228-
*/WEB-INF/gems*.
230+
`/WEB-INF/gems`.
229231
- `jruby.min.runtimes`: For non-threadsafe Rails applications using a runtime
230232
pool, specify an integer minimum number of runtimes to hold in the pool.
231233
- `jruby.max.runtimes`: For non-threadsafe Rails applications, an integer
@@ -270,17 +272,17 @@ as context init parameters in web.xml or as VM-wide system properties.
270272

271273
There are often cases where you need to perform custom initialization of the
272274
Ruby environment before booting the application. You can create a file called
273-
*META-INF/init.rb* or *WEB-INF/init.rb* inside the war file for this purpose.
275+
`META-INF/init.rb` or `WEB-INF/init.rb` inside the war file for this purpose.
274276
These files, if found, will be evaluated before booting the Rack environment,
275277
allowing you to set environment variables, load scripts, etc.
276278

277279
For plain Rack applications, JRuby-Rack also supports a magic comment to solve
278280
the "rackup" chicken-egg problem (you need Rack's builder loaded before loading
279-
the *config.ru*, yet you may want to setup the gem version from within the rackup
281+
the `config.ru`, yet you may want to setup the gem version from within the rackup
280282
file). As we ship with the Rack gem bundled, otherwise when executing the
281-
provided *config.ru* the bundled (latest) version of Rack will get loaded.
283+
provided `config.ru` the bundled (latest) version of Rack will get loaded.
282284

283-
Use **rack.version** to specify the Rack gem version to be loaded before rackup :
285+
Use `rack.version` to specify the Rack gem version to be loaded before rackup :
284286

285287
```ruby
286288
# encoding: UTF-8
@@ -331,7 +333,7 @@ Build the .jar using Maven :
331333
./mvnw install
332334
```
333335

334-
the generated jar should be located at **target/jruby-rack-*.jar**
336+
the generated jar should be located at `target/jruby-rack-*.jar`
335337

336338
Alternatively use Rake, e.g. to build the gem (skipping specs) :
337339

@@ -352,6 +354,20 @@ package and push the .jar every time a commit changes a source file).
352354
* `./mvnw release:perform` (possibly with `-DuseReleaseProfile=false` due to Javadoc doclint failures for now)
353355
* `rake clean gem SKIP_SPECS=true` and push the gem
354356

357+
## Adding testing for new Rails versions
358+
359+
* Add the new version to `.github/workflows/maven.yml` under the `matrix` section
360+
* Add a new configuration to the `Appraisals` file, then
361+
```bundle exec appraisal generate```
362+
* Generate a new stub Rails application for the new version
363+
```shell
364+
VERSION=rails72
365+
cd src/spec/stub
366+
rm -rf $VERSION && BUNDLE_GEMFILE=~/Projects/community/jruby-rack/gemfiles/${VERSION}_rack22.gemfile bundle exec rails new $VERSION --minimal --skip-git --skip-docker --skip-active-model --skip-active-record --skip-test --skip-system-test --skip-dev-gems --skip-bundle --skip-keeps --skip-asset-pipeline --skip-ci --skip-brakeman --skip-rubocop
367+
```
368+
* Manual changes to make to support testing
369+
* In `config/production.rb` comment out the default `config.logger` value so jruby-rack applies its own `RailsLogger`.
370+
355371
## Support
356372

357373
Please use [github][3] to file bugs, patches and/or pull requests.

examples/Kirkfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rack "rails3/config.ru" do
1+
rack "rails7/config.ru" do
22
listen 9090
33
end
44

examples/camping/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
gem 'rack', '~> 2.2.0'
3+
gem 'rack', '~> 2.2.18'
44
gem 'rackup'
55
gem 'camping', '< 3'
66
gem 'markaby'

examples/camping/Gemfile.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/jruby/warbler.git
3-
revision: f10ed60aefe3bf498917bfd18de780fb7d240f65
3+
revision: 523237b6d931efcd6f13a79692f6aa46ad997443
44
branch: master
55
specs:
66
warbler (2.0.5)
@@ -9,7 +9,7 @@ GIT
99
ostruct (= 0.6.2)
1010
rake (>= 13.0.3)
1111
rexml (~> 3.0)
12-
rubyzip (>= 1.0.0)
12+
rubyzip (>= 3.0.0)
1313

1414
GEM
1515
remote: https://rubygems.org/
@@ -18,29 +18,30 @@ GEM
1818
camping (2.1.532)
1919
mab (>= 0.0.3)
2020
rack (>= 1.0)
21-
jruby-jars (9.4.13.0)
22-
jruby-rack (1.2.3)
21+
jruby-jars (9.4.14.0)
22+
jruby-rack (1.2.5)
2323
mab (0.0.3)
2424
markaby (0.9.4)
2525
builder
2626
ostruct (0.6.2)
27-
rack (2.2.17)
27+
rack (2.2.18)
2828
rackup (1.0.1)
2929
rack (< 3)
3030
webrick
3131
rake (13.3.0)
32-
rexml (3.4.1)
33-
rubyzip (2.4.1)
32+
rexml (3.4.3)
33+
rubyzip (3.1.0)
3434
webrick (1.9.1)
3535

3636
PLATFORMS
3737
java
38+
x86_64-linux
3839

3940
DEPENDENCIES
4041
camping (< 3)
4142
jruby-jars (< 10)
4243
markaby
43-
rack (~> 2.2.0)
44+
rack (~> 2.2.18)
4445
rackup
4546
warbler!
4647

examples/rails3/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)