errplane 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,7 @@ module Errplane
29
29
  :app_host => "app.errplane.com",
30
30
  :ignored_exceptions => %w{ActiveRecord::RecordNotFound
31
31
  ActionController::RoutingError},
32
- :ignored_environments => %w{development test cucumber selenium},
32
+ :ignored_environments => %w{test cucumber selenium},
33
33
  :ignored_user_agents => %w{GoogleBot},
34
34
  :backtrace_filters => [
35
35
  lambda { |line| line.gsub(/^\.\//, "") },
@@ -8,6 +8,7 @@ module Errplane
8
8
  def self.initialize
9
9
  ActionController::Base.send(:include, Errplane::Rails::AirTrafficController)
10
10
  ActionController::Base.send(:include, Errplane::Rails::Middleware::HijackRescueActionEverywhere)
11
+ ActionController::Base.send(:include, Errplane::Rails::Instrumentation)
11
12
 
12
13
  ::Rails.configuration.middleware.insert_after 'ActionController::Failsafe', Errplane::Rack
13
14
 
@@ -90,6 +90,9 @@ module Errplane
90
90
  ActiveSupport.on_load(:action_controller) do
91
91
  require 'errplane/rails/air_traffic_controller'
92
92
  include Errplane::Rails::AirTrafficController
93
+
94
+ require 'errplane/rails/instrumentation'
95
+ include Errplane::Rails::Instrumentation
93
96
  end
94
97
 
95
98
  if defined?(::ActionDispatch::DebugExceptions)
@@ -1,3 +1,3 @@
1
1
  module Errplane
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -3,6 +3,24 @@ require 'rails/generators'
3
3
  class ErrplaneGenerator < Rails::Generators::Base
4
4
  desc "Description:\n This creates a Rails initializer for Errplane."
5
5
 
6
+ begin
7
+ puts "Contacting Errplane API"
8
+ application_name = Rails.application.class.parent_name
9
+ api_key = ARGV.last
10
+ http = Net::HTTP.new("localhost", "3000")
11
+ url = "/api/v1/applications?api_key=#{api_key}&name=#{application_name}"
12
+ response = http.post(url, nil)
13
+ @application = JSON.parse(response.body)
14
+
15
+ unless response.is_a?(Net::HTTPSuccess)
16
+ raise "The Errplane API returned an error: #{response.inspect}"
17
+ end
18
+ rescue => e
19
+ puts "We ran into a problem creating your application via the API!"
20
+ puts "If this issue persists, contact us at support@errplane.com with the following details:"
21
+ puts "#{e.class}: #{e.message}"
22
+ end
23
+
6
24
  source_root File.expand_path('../templates', __FILE__)
7
25
  argument :api_key,
8
26
  :required => true,
@@ -10,7 +28,7 @@ class ErrplaneGenerator < Rails::Generators::Base
10
28
  :description => "API key for your Errplane organization"
11
29
  argument :application_id,
12
30
  :required => false,
13
- :default => SecureRandom.hex(4),
31
+ :default => @application["key"],
14
32
  :type => :string,
15
33
  :description => "Identifier for this application (Leave blank and a new one will be generated for you)"
16
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: errplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-02 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70165371262220 !ruby/object:Gem::Requirement
16
+ requirement: &70329913694340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70165371262220
24
+ version_requirements: *70329913694340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70165371261120 !ruby/object:Gem::Requirement
27
+ requirement: &70329913693580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.3.14
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70165371261120
35
+ version_requirements: *70329913693580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: actionpack
38
- requirement: &70165371260600 !ruby/object:Gem::Requirement
38
+ requirement: &70329913692540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.3.14
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70165371260600
46
+ version_requirements: *70329913692540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70165371259960 !ruby/object:Gem::Requirement
49
+ requirement: &70329913692040 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70165371259960
57
+ version_requirements: *70329913692040
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: fakeweb
60
- requirement: &70165371259200 !ruby/object:Gem::Requirement
60
+ requirement: &70329901187280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70165371259200
68
+ version_requirements: *70329901187280
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard
71
- requirement: &70165371258360 !ruby/object:Gem::Requirement
71
+ requirement: &70329901186200 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70165371258360
79
+ version_requirements: *70329901186200
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-rspec
82
- requirement: &70165371257800 !ruby/object:Gem::Requirement
82
+ requirement: &70329901185400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70165371257800
90
+ version_requirements: *70329901185400
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &70165371257320 !ruby/object:Gem::Requirement
93
+ requirement: &70329901184360 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70165371257320
101
+ version_requirements: *70329901184360
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rdoc
104
- requirement: &70165371256800 !ruby/object:Gem::Requirement
104
+ requirement: &70329901183000 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70165371256800
112
+ version_requirements: *70329901183000
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
- requirement: &70165371256240 !ruby/object:Gem::Requirement
115
+ requirement: &70329901182400 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70165371256240
123
+ version_requirements: *70329901182400
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: tzinfo
126
- requirement: &70165371255740 !ruby/object:Gem::Requirement
126
+ requirement: &70329901181840 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70165371255740
134
+ version_requirements: *70329901181840
135
135
  description: This gem provides exception reporting with Errplane for Rails 3.x applications.
136
136
  email:
137
137
  - todd@errplane.com
@@ -158,7 +158,6 @@ files:
158
158
  - lib/errplane/black_box.rb
159
159
  - lib/errplane/capistrano.rb
160
160
  - lib/errplane/configuration.rb
161
- - lib/errplane/errplane_chef_handler.rb
162
161
  - lib/errplane/instrumentation.rb
163
162
  - lib/errplane/logger.rb
164
163
  - lib/errplane/rack.rb
@@ -1,63 +0,0 @@
1
- #Forked from https://github.com/morgoth/airbrake_handler/blob/master/lib/airbrake_handler.rb
2
- #Apache license please see above url for more details
3
-
4
- require "chef/handler"
5
- require "errplane"
6
- require 'logger'
7
-
8
- class ErrplaneChefHandler < Chef::Handler
9
-
10
- attr_accessor :options, :api_key, :ignore, :notify_host, :environment
11
-
12
- def initialize(options = {})
13
- @api_key = options.delete(:api_key)
14
- @ignore = options.delete(:ignore) || []
15
- @options = options
16
- @environment = options.delete(:env) || "production"
17
- end
18
-
19
- def report
20
- if run_status.failed? && !ignore_exception?(run_status.exception)
21
- Chef::Log.error("Creating Errplane exception report")
22
-
23
- excep = run_status.exception
24
- setup_errplane
25
- Errplane.transmit(excep, errplane_params)
26
- end
27
- end
28
-
29
- def ignore_exception?(exception)
30
- ignore.any? do |ignore_case|
31
- ignore_case[:class] == exception.class.name && (!ignore_case.key?(:message) || !!ignore_case[:message].match(exception.message))
32
- end
33
- end
34
-
35
- def errplane_params
36
- {
37
- :notifier_name => "Chef Errplane Notifier",
38
- :notifier_version => Errplane::VERSION,
39
- :notifier_url => "https://github.com/errplane/gem",
40
- :component => run_status.node.name,
41
- :url => nil,
42
- :environment => @environment,
43
- :params => {
44
- :start_time => run_status.start_time,
45
- :end_time => run_status.end_time,
46
- :elapsed_time => run_status.elapsed_time,
47
- :run_list => run_status.node.run_list.to_s
48
- }
49
- }.merge(options)
50
- end
51
-
52
- def setup_errplane
53
- raise ArgumentError.new("You must provide an Errplane API key") unless api_key
54
- Errplane.configure do |config|
55
- config.api_key = api_key
56
- config.application_id = "chef"
57
- config.application_name = "chef"
58
- config.logger = Chef::Log
59
- config.debug = false
60
- config.rails_environment = @environment
61
- end
62
- end
63
- end