mrhenry-failtale-reporter 0.0.3 → 0.0.4

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.
@@ -1,14 +1,13 @@
1
1
 
2
2
  begin
3
3
  require 'digest/sha1'
4
- require 'httparty'
4
+ httparty = Dir.glob(File.dirname(__FILE__)+'/../vendor/httparty-*/lib/httparty.rb').last
5
+ httparty ||= 'httparty'
6
+ require httparty
5
7
  rescue LoadError
6
8
  retry if require 'rubygems'
7
9
  end
8
10
 
9
- require File.dirname(__FILE__)+'/failtale_reporter/error'
10
- require File.dirname(__FILE__)+'/failtale_reporter/client'
11
-
12
11
  module FailtaleReporter
13
12
 
14
13
  include HTTParty
@@ -22,7 +21,7 @@ module FailtaleReporter
22
21
 
23
22
  class << self
24
23
  def reportable_exceptions(*arr)
25
- arr = [Exception] if arr.empty?
24
+ arr = [Exception] if (arr || []).empty?
26
25
  @reportable_exceptions ||= arr.flatten
27
26
  end
28
27
  def ignored_exceptions(*arr)
@@ -47,3 +46,6 @@ module FailtaleReporter
47
46
  end
48
47
 
49
48
  end
49
+
50
+ require File.dirname(__FILE__)+'/failtale_reporter/error'
51
+ require File.dirname(__FILE__)+'/failtale_reporter/client'
@@ -4,10 +4,13 @@ module FailtaleReporter
4
4
 
5
5
  module Rails
6
6
 
7
- IGNORED_EXCEPTIONS = [ActiveRecord::RecordNotFound,
8
- ActionController::RoutingError,
9
- ActionController::InvalidAuthenticityToken,
10
- CGI::Session::CookieStore::TamperedWithCookie]
7
+ IGNORED_EXCEPTIONS = ['ActiveRecord::RecordNotFound',
8
+ 'ActionController::RoutingError',
9
+ 'ActionController::InvalidAuthenticityToken',
10
+ 'CGI::Session::CookieStore::TamperedWithCookie']
11
+
12
+ IGNORED_EXCEPTIONS.map!{|e| eval(e) rescue nil }.compact!
13
+ IGNORED_EXCEPTIONS.freeze
11
14
 
12
15
  def self.included(target)
13
16
  target.send :alias_method_chain, :rescue_action_in_public, :errors
@@ -19,11 +22,16 @@ module FailtaleReporter
19
22
  end
20
23
 
21
24
  def rescue_action_in_public_with_errors(exception)
22
- is_private = ::Rails.env.development? or ::Rails.env.test?
23
- FailtaleReporter.report(exception) unless is_private
25
+ FailtaleReporter.report(exception) unless is_private?
24
26
  rescue_action_in_public_without_errors(exception)
25
27
  end
26
28
 
29
+ protected
30
+
31
+ def is_private? #nodoc:
32
+ defined?(RAILS_ENV) and !['development', 'test'].include?(RAILS_ENV)
33
+ end
34
+
27
35
  end
28
36
 
29
37
  end
@@ -0,0 +1,56 @@
1
+
2
+ namespace :failtale do
3
+
4
+ desc 'Test failtale configuration'
5
+ task :test => :environment do
6
+ class ::FailtaleReporter::TestError < Exception ; end
7
+ FailtaleReporter.report do
8
+ raise FailtaleReporter::TestError, 'Test exception'
9
+ end
10
+ end
11
+
12
+ desc 'Freeze Failtale reporter'
13
+ task :freeze do
14
+ vendor_dir = File.expand_path('./vendor/plugins')
15
+ sh %{mkdir -p "#{vendor_dir}"}
16
+ Dir.chdir vendor_dir do
17
+ sh %{gem unpack mrhenry-failtale-reporter}
18
+ sh %{mv mrhenry-failtale-reporter-* failtale-reporter}
19
+ sh %{cp failtale-reporter/rails/init.rb failtale-reporter/init.rb}
20
+ end
21
+ end
22
+
23
+ desc 'Unfreeze Failtale reporter'
24
+ task :unfreeze do
25
+ vendor_dir = File.expand_path('./vendor/plugins')
26
+ sh %{rm -rf #{vendor_dir}/failtale-reporter}
27
+ end
28
+
29
+ namespace :httparty do
30
+
31
+ desc 'Freeze HTTParty'
32
+ task :freeze do
33
+ unless __FILE__.include? "vendor/plugins/failtale-reporter"
34
+ puts "Failtale is not installed as a plugin!"
35
+ exit(1)
36
+ end
37
+ vendor_dir = File.dirname(__FILE__)+'/../vendor'
38
+ sh %{mkdir -p "#{vendor_dir}"}
39
+ Dir.chdir vendor_dir do
40
+ sh %{gem unpack httparty}
41
+ end
42
+ end
43
+
44
+ desc 'Unfreeze HTTParty'
45
+ task :unfreeze do
46
+ unless __FILE__.include? "vendor/plugins/failtale-reporter"
47
+ puts "Failtale is not installed as a plugin!"
48
+ exit(1)
49
+ end
50
+ vendor_dir = File.dirname(__FILE__)+'/../vendor'
51
+ sh %{rm -rf "#{vendor_dir}"}
52
+ end
53
+
54
+ end
55
+
56
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrhenry-failtale-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-09 00:00:00 -08:00
12
+ date: 2009-02-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -46,6 +46,7 @@ files:
46
46
  - lib/failtale_reporter.rb
47
47
  - lib/mrhenry-failtale-reporter.rb
48
48
  - rails/init.rb
49
+ - tasks/failtale.rake
49
50
  - spec/error_reporter_spec.rb
50
51
  - spec/error_spec.rb
51
52
  - README.textile