Skip to content

Commit 9a7f390

Browse files
committed
[chore] Replace examples approach for running from source with simpler validated approach
1 parent bb98ac0 commit 9a7f390

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

examples/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,16 @@ As an executable jar within Jetty:
4141
| Sinatra | Streaming Demo | http://localhost:8080/stream | http://localhost:8080/sinatra/stream |
4242
| Camping | Demo Index | http://localhost:8080/ | http://localhost:8080/camping |
4343
| Camping | Snoop Dump | http://localhost:8080/snoop | http://localhost:8080/camping/snoop |
44+
45+
## Development
46+
47+
You can run the examples using local source for warbler or jruby-rack using env vars, e.g
48+
49+
```shell
50+
export WARBLER_SRC=true JRUBY_RACK_SRC=true && bundle && bundle exec warble executable war && java -Dwarbler.debug=true -jar rails*.war
51+
```
52+
53+
- Warbler can run directly from source
54+
- jruby-rack needs to be built, since it does not define a gemspec
55+
- There are alternate ways to do this by replacing the jruby-rack jar within the warbled jar/war, however this is more
56+
complex and error-prone that using the gem and ensuring compatibility since warbler itself depends on the jruby-rack gem.

examples/camping/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gem 'camping'
66
gem 'rack', '~> 2.2'
77

88
group :development do
9-
gem 'warbler', '~> 2.1'
9+
if !ENV['WARBLER_SRC']; gem 'warbler' else gem 'warbler', path: '../../../warbler' end
10+
if !ENV['JRUBY_RACK_SRC']; gem 'jruby-rack' else gem 'jruby-rack', path: '../../target' end
1011
gem 'jruby-jars', '< 10'
1112
end

examples/camping/config/warble.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
1818
# own versions if you directly set the value
1919
# config.java_libs += FileList["lib/java/*.jar"]
20-
if ENV['JRUBY_RACK_SRC']
21-
config.java_libs.delete_if {|f| f =~ /jruby-rack[^\/]+\.jar/}
22-
config.java_libs += FileList["../../target/jruby-rack*.jar"]
23-
end
2420

2521
# Loose Java classes and miscellaneous files to be placed in WEB-INF/classes.
2622
# config.java_classes = FileList["target/classes/**.*"]

examples/rails7/Gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ gem 'rack', '~> 2.2'
77
gem 'sprockets-rails'
88

99
group :development do
10-
gem 'warbler', '~> 2.1'
11-
gem 'jruby-jars', '< 10'
10+
if !ENV['WARBLER_SRC']; gem 'warbler' else gem 'warbler', path: '../../../warbler' end
11+
if !ENV['JRUBY_RACK_SRC']; gem 'jruby-rack' else gem 'jruby-rack', path: '../../target' end
12+
gem 'jruby-jars', '~> 10'
1213
end

examples/rails7/config/warble.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525
# JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
2626
# own versions if you directly set the value
2727
# config.java_libs += FileList["lib/java/*.jar"]
28-
if ENV['JRUBY_RACK_SRC']
29-
config.java_libs.delete_if {|f| f =~ /jruby-rack[^\/]+\.jar/}
30-
config.java_libs += FileList["../../target/jruby-rack*.jar"]
31-
end
32-
if ENV['JRUBY_COMPLETE_SRC']
33-
config.java_libs.delete_if {|f| f =~ /jruby-(core|stdlib|complete)/}
34-
config.java_libs += FileList[ENV['JRUBY_COMPLETE_SRC']]
35-
end
3628

3729
# Loose Java classes and miscellaneous files to be included.
3830
# config.java_classes = FileList["target/classes/**.*"]

examples/sinatra/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gem 'sinatra'
66
gem 'rack', '~> 2.2'
77

88
group :development do
9-
gem 'warbler', '~> 2.1'
9+
if !ENV['WARBLER_SRC']; gem 'warbler' else gem 'warbler', path: '../../../warbler' end
10+
if !ENV['JRUBY_RACK_SRC']; gem 'jruby-rack' else gem 'jruby-rack', path: '../../target' end
1011
gem 'jruby-jars', '< 10'
1112
end

examples/sinatra/config/warble.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Warbler::Config.new do |config|
33
config.features += ['executable']
44

5-
if ENV['JRUBY_RACK_SRC']
6-
config.java_libs.delete_if {|f| f =~ /jruby-rack[^\/]+\.jar/}
7-
config.java_libs += FileList["../../target/jruby-rack*.jar"]
8-
end
95
config.dirs += ['views']
106
require 'socket'
117
config.webxml.ENV_OUTPUT = File.expand_path('../../servers', __FILE__)

0 commit comments

Comments
 (0)