lib/trinidad/web_app.rb in trinidad-1.3.4 vs lib/trinidad/web_app.rb in trinidad-1.3.5

- old
+ new

@@ -59,33 +59,31 @@ !!( web_xml && web_xml.root.elements["/web-app/listener[contains(listener-class, '#{context_listener}')]"] ) end - def public_root - @app_config[:public] || @config[:public] || 'public' - end - - %w{context_path web_app_dir libs_dir classes_dir default_web_xml - jruby_min_runtimes jruby_max_runtimes rackup log}.each do |method_name| + %w{ context_path web_app_dir libs_dir classes_dir default_web_xml + jruby_min_runtimes jruby_max_runtimes rackup log }.each do |method_name| define_method method_name do sym = method_name.to_sym @app_config[sym] || @config[sym] end end + def public_root; @app_config[:public] || @config[:public] || 'public'; end + def environment; @app_config[:environment] || @config[:environment] || 'development'; end + def work_dir; @app_config[:work_dir] || @config[:work_dir] || web_app_dir; end + def extensions @extensions ||= begin extensions = @config[:extensions] || {} extensions.merge!(@app_config[:extensions]) if @app_config[:extensions] extensions end end def war?; WebApp.war?(app_config); end - def work_dir; @app_config[:work_dir] || @config[:work_dir] || web_app_dir; end - def environment; @app_config[:environment] || @config[:environment] || 'development'; end def solo? !self.is_a?(WarWebApp) && @app_config[:solo] end @@ -145,15 +143,17 @@ environment = app_config[:environment] || config[:environment] if threadsafe_instance?(app_config[:web_app_dir], environment) app_config[:jruby_min_runtimes] = 1 app_config[:jruby_max_runtimes] = 1 end - + + rackup = config[:rackup] || 'config.ru' + app_config[:web_app_dir] ||= config[:web_app_dir] || Dir.pwd # Check for rackup (but still use config/environment.rb for Rails 3) - if !app_config[:rackup] && !config[:rackup] && - File.exists?("#{app_config[:web_app_dir]}/config.ru") && - !File.exists?("#{app_config[:web_app_dir]}/config/environment.rb") - app_config[:rackup] = 'config.ru' + if !app_config[:rackup] && + File.exists?(File.join(app_config[:web_app_dir], rackup)) && + !File.exists?(File.join(app_config[:web_app_dir], 'config/environment.rb')) + app_config[:rackup] = rackup end end def self.threadsafe_instance?(app_base, environment) threadsafe_match?("#{app_base}/config/environments/#{environment}.rb") ||