fiveruns-dash-rails 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,15 @@ if START_FIVERUNS_DASH_RAILS
14
14
  version[:minor],
15
15
  version[:patch]
16
16
  ].map(&:to_s).join('.')
17
+
18
+ IGNORE_EXCEPTIONS = [
19
+ ::ActionController::RoutingError,
20
+ ::ActionController::UnknownController,
21
+ ::ActionController::UnknownAction
22
+ ]
23
+ if defined?(::ActiveRecord)
24
+ IGNORE_EXCEPTIONS << ::ActiveRecord::RecordNotFound
25
+ end
17
26
 
18
27
  class << self
19
28
  attr_accessor :server
@@ -1,14 +1,16 @@
1
1
  # Rails #######################################################################
2
2
  Fiveruns::Dash.register_recipe :rails, :url => 'http://dash.fiveruns.com' do |recipe|
3
3
 
4
- recipe.add_recipe :activerecord, :url => 'http://dash.fiveruns.com',
5
- :total_time => 'response_time'
6
- recipe.modify :recipe_name => :activerecord, :recipe_url => 'http://dash.fiveruns.com' do |metric|
7
- metric.find_context_with do |obj, *args|
8
- if Fiveruns::Dash::Context.context == []
9
- []
10
- else
11
- [[], Fiveruns::Dash::Context.context]
4
+ if defined?(ActiveRecord)
5
+ recipe.add_recipe :activerecord, :url => 'http://dash.fiveruns.com',
6
+ :total_time => 'response_time'
7
+ recipe.modify :recipe_name => :activerecord, :recipe_url => 'http://dash.fiveruns.com' do |metric|
8
+ metric.find_context_with do |obj, *args|
9
+ if Fiveruns::Dash::Context.context == []
10
+ []
11
+ else
12
+ [[], Fiveruns::Dash::Context.context]
13
+ end
12
14
  end
13
15
  end
14
16
  end
@@ -54,16 +56,14 @@ Fiveruns::Dash.register_recipe :rails, :url => 'http://dash.fiveruns.com' do |re
54
56
 
55
57
  # Same classes as the exception_notification plugin
56
58
  recipe.ignore_exceptions do |exception|
57
- [ ActiveRecord::RecordNotFound,
58
- ActionController::RoutingError,
59
- ActionController::UnknownController,
60
- ActionController::UnknownAction
61
- ].include?(exception.class)
59
+ Fiveruns::Dash::Rails::IGNORE_EXCEPTIONS.include?(exception.class)
62
60
  end
63
61
 
64
62
  recipe.added do
65
63
 
66
- ActiveRecord::Base.send(:include, Fiveruns::Dash::Rails::Context::ActiveRecord)
64
+ if defined?(ActiveRecord)
65
+ ActiveRecord::Base.send(:include, Fiveruns::Dash::Rails::Context::ActiveRecord)
66
+ end
67
67
  ActionController::Base.send(:include, Fiveruns::Dash::Rails::Context::Action)
68
68
  ActionView::Template.send(:include, Fiveruns::Dash::Rails::Context::Template) if defined?(ActionView::Template)
69
69
  ActionView::InlineTemplate.send(:include, Fiveruns::Dash::Rails::Context::Template) if defined?(ActionView::InlineTemplate)
@@ -3,15 +3,19 @@ require File.dirname(__FILE__) << "/fiveruns/dash/rails/startup"
3
3
  if START_FIVERUNS_DASH_RAILS
4
4
  gem 'fiveruns-dash-ruby' # Put its path first
5
5
  require 'fiveruns/dash'
6
- begin
7
- require 'fiveruns/dash/activerecord'
8
- rescue LoadError
9
- abort "Missing the `activerecord' recipe. Please install the fiveruns-dash-activerecord gem"
6
+ if defined?(ActiveRecord)
7
+ begin
8
+ require 'fiveruns/dash/activerecord'
9
+ rescue LoadError
10
+ abort "Missing the `activerecord' recipe. Please install the fiveruns-dash-activerecord gem"
11
+ end
10
12
  end
11
13
  require 'fiveruns/dash/rails'
12
14
  require 'fiveruns/dash/rails/initializer'
13
15
  require 'fiveruns/dash/rails/context/action'
14
- require 'fiveruns/dash/rails/context/active_record'
16
+ if defined?(ActiveRecord)
17
+ require 'fiveruns/dash/rails/context/active_record'
18
+ end
15
19
  require 'fiveruns/dash/rails/context/template'
16
20
  require File.dirname(__FILE__) << "/../rails/init"
17
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiveruns-dash-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - FiveRuns Development Team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-20 00:00:00 -08:00
12
+ date: 2009-02-26 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency