class Trinidad::RailsWebApp
Rails web application specifics (supports same versions as JRuby-Rack).
Private Class Methods
threadsafe?(app_base, environment)
click to toggle source
def layout_class 'JRuby::Rack::RailsFileSystemLayout' end
# File lib/trinidad/web_app.rb, line 699 def self.threadsafe?(app_base, environment) threadsafe_match?("#{app_base}/config/environments/#{environment}.rb") || threadsafe_match?("#{app_base}/config/environment.rb") end
threadsafe_match?(file)
click to toggle source
# File lib/trinidad/web_app.rb, line 704 def self.threadsafe_match?(file) File.exist?(file) && ( file_line_match?(file, /^[^#]*threadsafe!/) || ( # Rails 4.0 file_line_match?(file, /^[^#]*config\.eager_load\s?*=\s?*true/) && file_line_match?(file, /^[^#]*config\.cache_classes\s?*=\s?*true/) ) ) end
Public Instance Methods
context_listener()
click to toggle source
# File lib/trinidad/web_app.rb, line 678 def context_listener; 'org.jruby.rack.rails.RailsServletContextListener'; end
context_params()
click to toggle source
Calls superclass method
Trinidad::WebApp#context_params
# File lib/trinidad/web_app.rb, line 672 def context_params add_context_param 'rails.root', app_root add_context_param 'rails.env', environment super end
web_xml_environment()
click to toggle source
# File lib/trinidad/web_app.rb, line 680 def web_xml_environment; web_xml_context_param('rails.env'); end
Protected Instance Methods
complete_config!()
click to toggle source
Calls superclass method
Trinidad::WebApp#complete_config!
# File lib/trinidad/web_app.rb, line 684 def complete_config! super # detect threadsafe! in config/environments/environment.rb : if ! key?(:threadsafe) && self.class.threadsafe?(root_dir, environment) config[:jruby_min_runtimes] = 1 unless key?(:jruby_min_runtimes, false) config[:jruby_max_runtimes] = 1 unless key?(:jruby_max_runtimes, false) end end