atmos-merb_hoptoad_notifier 1.0.1 → 1.0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,9 +7,9 @@ require 'merb-core/tasks/merb_rake_helper'
7
7
  require 'spec/rake/spectask'
8
8
 
9
9
  NAME = "merb_hoptoad_notifier"
10
- GEM_VERSION = "1.0.5"
10
+ GEM_VERSION = "1.0.9"
11
11
  AUTHOR = "Corey Donohoe"
12
- EMAIL = "atmos@atmos.org"
12
+ EMAIL = 'atmos@atmos.org'
13
13
  HOMEPAGE = "http://github.com/atmos"
14
14
  SUMMARY = "Merb plugin that provides hoptoad exception notification"
15
15
 
@@ -1,4 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__)+'/merb_hoptoad_notifier/hoptoad_notifier')
2
+ require File.expand_path(File.dirname(__FILE__)+'/merb_hoptoad_notifier/hoptoad_mixin')
3
+
2
4
  # make sure we're running inside Merb
3
5
  if defined?(Merb::Plugins)
4
6
  Merb::BootLoader.after_app_loads do
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__)+'/hoptoad_notifier')
2
+
3
+ module HoptoadMixin
4
+ def notify_hoptoad(request=nil, session=nil)
5
+ request ||= self.request
6
+ session ||= self.session
7
+
8
+ HoptoadNotifier.notify_hoptoad(request, session)
9
+ end
10
+
11
+ def warn_hoptoad(message, request=nil, session=nil, options={})
12
+ request ||= self.request
13
+ session ||= self.session
14
+
15
+ HoptoadNotifier.warn_hoptoad(message, request, session, options)
16
+ end
17
+ end
@@ -3,21 +3,49 @@ require 'net/http'
3
3
  module HoptoadNotifier
4
4
  class << self
5
5
  attr_accessor :api_key, :logger
6
-
6
+
7
7
  def configure
8
8
  key = YAML.load_file(Merb.root / 'config' / 'hoptoad.yml')
9
9
  if key
10
10
  env = key[Merb.env.to_sym]
11
11
  env ? @api_key = env[:api_key] : raise(ArgumentError, "No hoptoad key for Merb environment #{Merb.env}")
12
12
  end
13
- end
14
-
13
+ end
14
+
15
15
  def logger
16
16
  @logger || Merb.logger
17
17
  end
18
18
 
19
19
  def environment_filters
20
- @environment_filters ||= %w(SSH_AUTH_SOCK)
20
+ @environment_filters ||= %w(AWS_ACCESS_KEY AWS_SECRET_ACCESS_KEY AWS_ACCOUNT SSH_AUTH_SOCK)
21
+ end
22
+
23
+ def warn_hoptoad(message, request, session, options={})
24
+ return if request.nil?
25
+ params = request.params
26
+
27
+ data = {
28
+ :api_key => HoptoadNotifier.api_key,
29
+ :error_class => options[:error_class] || message,
30
+ :error_message => message,
31
+ :backtrace => caller,
32
+ :environment => ENV.to_hash
33
+ }
34
+
35
+ data[:request] = {
36
+ :params => params
37
+ }
38
+
39
+ data[:environment] = clean_hoptoad_environment(ENV.to_hash.merge(request.env))
40
+ data[:environment][:RAILS_ENV] = Merb.env
41
+
42
+ data[:session] = {
43
+ :key => session.instance_variable_get("@session_id"),
44
+ :data => session.to_hash
45
+ }
46
+
47
+ send_to_hoptoad :notice => default_notice_options.merge(data)
48
+ true
21
49
  end
22
50
 
23
51
  def notify_hoptoad(request, session)
@@ -34,7 +62,7 @@ module HoptoadNotifier
34
62
  }
35
63
 
36
64
  data[:request] = {
37
- :params => params[:original_params]
65
+ :params => params
38
66
  }
39
67
 
40
68
  data[:environment] = clean_hoptoad_environment(ENV.to_hash.merge(request.env))
@@ -42,7 +70,7 @@ module HoptoadNotifier
42
70
 
43
71
  data[:session] = {
44
72
  :key => session.instance_variable_get("@session_id"),
45
- :data => session.instance_variable_get("@data")
73
+ :data => session.to_hash
46
74
  }
47
75
 
48
76
  send_to_hoptoad :notice => default_notice_options.merge(data)
metadata CHANGED
@@ -1,20 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atmos-merb_hoptoad_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Donohoe
8
+ - Phil Darnowsky
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2008-12-16 00:00:00 -08:00
13
+ date: 2009-02-16 00:00:00 -08:00
13
14
  default_executable:
14
15
  dependencies: []
15
16
 
16
17
  description: Merb plugin that provides hoptoad exception notification
17
- email: atmos@atmos.org
18
+ email: phil@darnowsky.com
18
19
  executables: []
19
20
 
20
21
  extensions: []
@@ -31,6 +32,7 @@ files:
31
32
  - lib/merb_hoptoad_notifier
32
33
  - lib/merb_hoptoad_notifier/hoptoad_notifier.rb
33
34
  - lib/merb_hoptoad_notifier/merbtasks.rb
35
+ - lib/merb_hoptoad_notifier/hoptoad_mixin.rb
34
36
  - lib/merb_hoptoad_notifier.rb
35
37
  - spec/fixtures
36
38
  - spec/fixtures/hoptoad.yml
@@ -38,7 +40,7 @@ files:
38
40
  - spec/spec.opts
39
41
  - spec/spec_helper.rb
40
42
  has_rdoc: true
41
- homepage: http://github.com/atmos
43
+ homepage: http://github.com/phildarnowsky
42
44
  post_install_message:
43
45
  rdoc_options: []
44
46