Permalink
Browse files

Add capture for RackConfig

  • Loading branch information...
1 parent 75ce7b9 commit cb7aed11704d514e68d9e5ed95fb2df549a347ee @nicksieger nicksieger committed Feb 10, 2011
Showing with 17 additions and 0 deletions.
  1. +1 −0 examples/sinatra/lib/demo.rb
  2. +15 −0 src/main/ruby/jruby/rack/capture.rb
  3. +1 −0 src/main/ruby/jruby/rack/core_ext.rb
@@ -4,6 +4,7 @@
include JRuby::Rack::Capture::Base
include JRuby::Rack::Capture::RubyGems
include JRuby::Rack::Capture::Bundler
+ include JRuby::Rack::Capture::JRubyRackConfig
include JRuby::Rack::Capture::Environment
include JRuby::Rack::Capture::JavaEnvironment
include JRuby::Rack::Capture::LoadPath
@@ -64,6 +64,21 @@ def capture
end
end
+ module JRubyRackConfig
+ def capture
+ super
+ methods = $servlet_context.config.class.instance_methods(false) +
+ org.jruby.rack.DefaultRackConfig.instance_methods(false)
+ methods = methods.uniq.reject do |m|
+ m =~ /^(get|is|set)/ || m =~ /[A-Z]|create|quiet|([!?=]$)/
+ end
+ output.puts("\n--- JRuby-Rack Config",
+ *(methods.sort.map do |m|
+ "#{m} = #{$servlet_context.config.send(m)}" rescue "#{m} = <error: #{$?}>"
+ end))
+ end
+ end
+
module Environment
def capture
super
@@ -12,6 +12,7 @@ class StandardError
include JRuby::Rack::Capture::Exception
include JRuby::Rack::Capture::RubyGems
include JRuby::Rack::Capture::Bundler
+ include JRuby::Rack::Capture::JRubyRackConfig
end
class LoadError

0 comments on commit cb7aed1

Please sign in to comment.