class TingYun::Frameworks::Rails
noinspection ALL
Public Instance Methods
env()
click to toggle source
# File lib/ting_yun/frameworks/rails.rb, line 10 def env @evn ||= RAILS_ENV.dup end
init_config(options = {})
click to toggle source
In versions of Rails
prior to 2.0, the rails config was only available to the init.rb, so it had to be passed on from there. This is a best effort to find a config and use that.
# File lib/ting_yun/frameworks/rails.rb, line 34 def init_config(options = {}) @config = options[:config] # Install the dependency detection, if rails_config && ::Rails.configuration.respond_to?(:after_initialize) rails_config.after_initialize do # This will insure we load all the instrumentation as late as possible. If the agent # is not enabled, it will load a limited amount of instrumentation. TingYun::Support::LibraryDetection.detect! end end if !Agent.config[:'agent_enabled'] # Might not be running if it does not think mongrel, thin, passenger, etc # is running, if it thinks it's a rake task, or if the agent_enabled is false. ::TingYun::Agent.logger.info("TingYun Agent is unable to run.") else install_browser_monitoring(rails_config) end rescue => e ::TingYun::Agent.logger.error("Failure during init_config for Rails. Is Rails required in a non-Rails app? Set TING_YUN_FRAMEWORK=ruby to avoid this message.", "The Ruby agent will continue running, but Rails-specific features may be missing.", e) end
install_browser_monitoring(config)
click to toggle source
# File lib/ting_yun/frameworks/rails.rb, line 58 def install_browser_monitoring(config) return if @browser_monitoring_installed @browser_monitoring_installed = true return if config.nil? || !config.respond_to?(:middleware) begin require 'ting_yun/middleware/browser_monitoring' config.middleware.use TingYun::BrowserMonitoring ::TingYun::Agent.logger.debug("Installed TingYun Browser Monitoring middleware") rescue => e ::TingYun::Agent.logger.error("Error installing TingYun Browser Monitoring middleware", e) end end
rails_config()
click to toggle source
# File lib/ting_yun/frameworks/rails.rb, line 23 def rails_config if defined?(::Rails) && ::Rails.respond_to?(:configuration) ::Rails.configuration else @config end end
rails_root()
click to toggle source
noinspection Rails3Deprecated,Rails3Deprecated
# File lib/ting_yun/frameworks/rails.rb, line 19 def rails_root RAILS_ROOT if defined?(RAILS_ROOT) end
root()
click to toggle source
Calls superclass method
TingYun::Frameworks::Ruby#root
# File lib/ting_yun/frameworks/rails.rb, line 14 def root root = rails_root.to_s.empty? ? super : rails_root.to_s end
Protected Instance Methods
rails_vendor_root()
click to toggle source
# File lib/ting_yun/frameworks/rails.rb, line 73 def rails_vendor_root File.join(root,'vendor','rails') end