Skip to content

Commit 7661a48

Browse files
committed
[chore] Tidy and document examples
1 parent 253be8a commit 7661a48

File tree

8 files changed

+56
-32
lines changed

8 files changed

+56
-32
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ can embed it directly in the `web.xml` as follows (using Sinatra as an example):
127127
</context-param>
128128
```
129129

130-
Be sure to escape angle-brackets for XML !
130+
Be sure to escape angle-brackets for XML!
131131

132132

133133
## Servlet Filter
@@ -306,6 +306,9 @@ logging system, configure `jruby.rack.logging` as follows:
306306
For those loggers that require a specific named logger, set it with the
307307
`jruby.rack.logging.name` option, by default "jruby.rack" name will be used.
308308

309+
## Examples
310+
311+
Some example demo applications are available at [./examples](./examples).
309312

310313
## Building
311314

examples/Kirkfile

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

examples/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## JRuby-Rack Examples
2+
3+
This directory includes samples using JRuby-Rack to build Rack web applications for deployment
4+
into Java app servers.
5+
6+
- All use [Warbler](https://github.com/jruby/warbler) to do so for easy of packaging.
7+
- Require JRuby `9.4` and a compatible JVM (Java `8` -> `25`).
8+
9+
### Building/running
10+
11+
For deployment into a separate webserver:
12+
13+
1. ```bash
14+
bundle
15+
bundle exec warble war
16+
```
17+
2. Drop the war into a relevant Java app server running a compatible JVM version
18+
19+
As an executable jar within Jetty:
20+
21+
1. ```bash
22+
bundle
23+
bundle exec warble executable war
24+
```
25+
2. ```shell
26+
java -jar *.war
27+
```
28+
29+
## Demo routes
30+
31+
| Example | Component | Embedded Route | Deployed War Route |
32+
|---------|-------------------------------|-----------------------------------|------------------------------------------|
33+
| Rails 7 | Status Page | http://localhost:8080/up | http://localhost:8080/rails7/up |
34+
| Rails 7 | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/rails7/snoop |
35+
| Rails 7 | Embedded JSP (non-functional) | http://localhost:8080/jsp/ | http://localhost:8080/rails7/jsp/ |
36+
| Rails 7 | Simple Form submission | http://localhost:8080/simple_form | http://localhost:8080/rails7/simple_form |
37+
| Rails 7 | Body Posts | http://localhost:8080/body | http://localhost:8080/rails7/body |
38+
| Sinatra | Demo Index | http://localhost:8080/ | http://localhost:8080/sinatra |
39+
| Sinatra | Info | http://localhost:8080/info | http://localhost:8080/sinatra/info |
40+
| Sinatra | Snoop Dump | http://localhost:8080/env | http://localhost:8080/sinatra/env |
41+
| Camping | Demo Index | http://localhost:8080/ | http://localhost:8080/camping |
42+
| Camping | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/camping/snoop |

examples/camping/Gemfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ gem 'rackup'
77
gem 'camping', '< 3'
88
gem 'markaby'
99

10-
group :development do
11-
gem 'warbler', '~> 2.1'
12-
gem 'jruby-jars', '< 10'
13-
end
10+
gem 'warbler', '~> 2.1'
11+
gem 'jruby-jars', '< 10'

examples/rails7/Gemfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ gem 'rails', '~> 7.2.2', '>= 7.2.2.2'
66
gem 'rack', '~> 2.2.20'
77
gem "sprockets-rails"
88

9-
group :development do
10-
gem 'warbler', '~> 2.1'
11-
gem 'jruby-jars', '< 10'
12-
end
9+
gem 'warbler', '~> 2.1'
10+
gem 'jruby-jars', '< 10'

examples/rails7/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ GEM
222222
zeitwerk (2.6.18)
223223

224224
PLATFORMS
225-
universal-java-21
225+
java
226226
x86_64-linux
227227

228228
DEPENDENCIES

examples/rails7/config/environments/production.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
4848

4949
# Log to STDOUT by default
50-
# config.logger = ActiveSupport::Logger.new(STDOUT)
51-
# .tap { |logger| logger.formatter = ::Logger::Formatter.new }
52-
# .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
50+
config.logger = ActiveSupport::Logger.new(STDOUT)
51+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
52+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
5353

5454
# Prepend all log lines with the following tags.
5555
config.log_tags = [ :request_id ]

examples/sinatra/Gemfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ gem 'sinatra'
66
gem 'webrick'
77
gem 'rack', '~> 2.2.20'
88

9-
group :development do
10-
gem 'warbler', '~> 2.1'
11-
gem 'jruby-jars', '< 10'
12-
end
9+
gem 'warbler', '~> 2.1'
10+
gem 'jruby-jars', '< 10'

0 commit comments

Comments
 (0)