yeller_ruby 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bee1785d04c635656df246e09d756d3791f46b5
4
- data.tar.gz: 65305257a3f82db0f8dc6616e187fdfbda0fba9f
3
+ metadata.gz: 6ee207401005b37d98db0a62563af2fc23a29a17
4
+ data.tar.gz: 0a423f8b41680ca0be1493dfaa797076afa7e91d
5
5
  SHA512:
6
- metadata.gz: 437a25a5f7f345861d44b4edc8d2fbf73f0a82a49ab21e369e2b453872743096f0171835e065bcfd6f4bb34cbd8c50ce05d50800df0fb6f4ce799a791dd23267
7
- data.tar.gz: 859e43b237958738afb47db0d5cf9ec3777939722242e6e48a93b90baac7c93d6f87354aa64272e7216d838d19bc7ba18f49b6b09257c8a1123576f3458ea4be
6
+ metadata.gz: 4ce49b66ee1ab619bd2dbc52b007c3806fbbd71bb7b13fb3c485e2717955bed183d47819dfec4b8e85654e56dd22553ce140951d540a75c271ba84643f77f588
7
+ data.tar.gz: 5a28772bbc5226ad17d98ff7d4c277e1cdd81122601ccac027e00f74e949184d1a721d4092319006b94bb59273879036f2b76f7de668d0813acbfadf2caea85a
@@ -1,76 +1,79 @@
1
- require 'action_controller/test_case'
2
- namespace :yeller do
3
- task :enable_verify_log => [] do
4
- Yeller::VerifyLog.enable!
5
- end
1
+ if defined?(::Rake) && defined?(::ActionController) && defined? (::ActiveSupport)
2
+ require 'action_controller/test_case'
3
+ require File.expand_path('../../../yeller/rails', __FILE__)
4
+ namespace :yeller do
5
+ task :enable_verify_log => [] do
6
+ Yeller::VerifyLog.enable!
7
+ end
6
8
 
7
- desc "verify your yeller gem installation by sending a test exception to yeller's servers"
8
- task :verify => [:enable_verify_log, :environment] do
9
- Dir["app/controllers/application*.rb"].each { |file| require(File.expand_path(file)) }
9
+ desc "verify your yeller gem installation by sending a test exception to yeller's servers"
10
+ task :verify => [:enable_verify_log, :environment] do
11
+ Dir["app/controllers/application*.rb"].each { |file| require(File.expand_path(file)) }
10
12
 
11
- catcher = Yeller::Rails::ActionControllerCatchingHooks
13
+ rails3_onwards_catcher = Yeller::Rails::Rails3AndFourCatchingHooks
12
14
 
13
- if !([ActionController::Base, ActionDispatch::DebugExceptions, ActionDispatch::ShowExceptions, ApplicationController].any? {|x| x.included_modules.include?(catcher) })
14
- puts "YELLER: NO RAILS INITIALIZATION DETECTED"
15
- puts "this is likely our problem, email tcrayford@yellerapp.com"
16
- exit 126
17
- end
15
+ if !([ActionController::Base, ActionDispatch::DebugExceptions, ActionDispatch::ShowExceptions, ApplicationController].any? {|x| x.included_modules.include?(rails3_onwards_catcher) })
16
+ puts "YELLER: NO RAILS INITIALIZATION DETECTED"
17
+ puts "this is likely our problem, email tcrayford@yellerapp.com"
18
+ exit 126
19
+ end
18
20
 
19
- client = Yeller::Rack.instance_variable_get('@client')
20
- if client.token.nil? || client.token == 'YOUR_API_TOKEN_HERE'
21
- puts "NO YELLER API TOKEN DETECTED: your api token was set to #{client.token.inspect}"
22
- puts "Yeller needs an api key configured. Check the README: https://github.com/tcrayford/yeller_ruby to find out how to do that"
23
- exit 126
24
- end
21
+ client = Yeller::Rack.instance_variable_get('@client')
22
+ if client.token.nil? || client.token == 'YOUR_API_TOKEN_HERE'
23
+ puts "NO YELLER API TOKEN DETECTED: your api token was set to #{client.token.inspect}"
24
+ puts "Yeller needs an api key configured. Check the README: https://github.com/tcrayford/yeller_ruby to find out how to do that"
25
+ exit 126
26
+ end
25
27
 
26
- class YellerVerifyException < RuntimeError; end
28
+ class YellerVerifyException < RuntimeError; end
27
29
 
28
- Yeller::Rails.configure do |config|
29
- config.development_environments = []
30
- end
30
+ Yeller::Rails.configure do |config|
31
+ config.development_environments = []
32
+ end
31
33
 
32
- class ApplicationController
33
- prepend_before_filter :verify_yeller
34
+ class ApplicationController
35
+ prepend_before_filter :verify_yeller
34
36
 
35
- def verify_yeller
36
- Yeller::VerifyLog.about_to_raise_exception_in_controller!
37
- raise YellerVerifyException.new("verifying that yeller works")
38
- end
37
+ def verify_yeller
38
+ Yeller::VerifyLog.about_to_raise_exception_in_controller!
39
+ raise YellerVerifyException.new("verifying that yeller works")
40
+ end
39
41
 
40
- def verify
41
- end
42
+ def verify
43
+ end
42
44
 
43
- def consider_all_requests_local
44
- false
45
- end
45
+ def consider_all_requests_local
46
+ false
47
+ end
46
48
 
47
- def local_request?
48
- false
49
+ def local_request?
50
+ false
51
+ end
49
52
  end
50
- end
51
53
 
52
- class YellerVerificationController < ApplicationController; end
54
+ class YellerVerificationController < ApplicationController; end
53
55
 
54
56
 
55
- Rails.application.routes.draw do
56
- get '/yeller_verify' => 'yeller_verification#verify'
57
- end
57
+ Rails.application.routes.draw do
58
+ get '/yeller_verify' => 'yeller_verification#verify'
59
+ end
58
60
 
59
- env = Rack::MockRequest.env_for('http://example.com/yeller_verify')
60
- Rails.application.call(env)
61
+ env = Rack::MockRequest.env_for('http://example.com/yeller_verify')
62
+ Rails.application.call(env)
61
63
 
62
- client = Yeller::Rack.instance_variable_get('@client')
63
- if client.reported_error?
64
- Kernel.puts "SUCCESS: yeller-verified token=\"#{client.token}\""
65
- else
66
- if !client.enabled?
67
- Kernel.puts "ERROR: CLIENT NOT ENABLED yeller-verification-failed enabled=#{client.enabled?} token=\"#{client.token}\""
68
- Kernel.puts "Yeller rails client not enabled, check development_environments setting"
64
+ client = Yeller::Rack.instance_variable_get('@client')
65
+ if client.reported_error?
66
+ Kernel.puts "SUCCESS: yeller-verified token=\"#{client.token}\""
69
67
  else
70
- Yeller::StdoutVerifyLog.print_log!
71
- Kernel.puts "ERROR yeller-verification-failed enabled=#{client.enabled?} token=\"#{client.token}\""
68
+ if !client.enabled?
69
+ Kernel.puts "ERROR: CLIENT NOT ENABLED yeller-verification-failed enabled=#{client.enabled?} token=\"#{client.token}\""
70
+ Kernel.puts "Yeller rails client not enabled, check development_environments setting"
71
+ else
72
+ Yeller::StdoutVerifyLog.print_log!
73
+ Kernel.puts "ERROR yeller-verification-failed enabled=#{client.enabled?} token=\"#{client.token}\""
74
+ end
75
+ exit 126
72
76
  end
73
- exit 126
74
77
  end
75
78
  end
76
79
  end
data/lib/yeller/rails.rb CHANGED
@@ -80,8 +80,7 @@ module Yeller
80
80
  base.send(:alias_method, :render_exception, :render_exception_with_yeller)
81
81
  end
82
82
 
83
- def render_exception_with_yeller(env, exception)
84
- Yeller::VerifyLog.render_exception_with_yeller!
83
+ def _capture_exception(env, exception, extra={})
85
84
  begin
86
85
  request = ::Rack::Request.new(env)
87
86
  controller = env['action_controller.instance']
@@ -92,7 +91,7 @@ module Yeller
92
91
  exception,
93
92
  :url => request.url,
94
93
  :location => "#{controller.class.to_s}##{params[:action]}",
95
- :custom_data => controller._yeller_custom_data
94
+ :custom_data => controller._yeller_custom_data.merge(extra)
96
95
  )
97
96
  else
98
97
  Yeller::VerifyLog.action_controller_instance_not_in_env!
@@ -101,6 +100,15 @@ module Yeller
101
100
  rescue => e
102
101
  Yeller::VerifyLog.error_reporting_rails_error!(e)
103
102
  end
103
+ end
104
+
105
+ def report_exception_to_yeller(exception, extra={})
106
+ _capture_exception(request.env, exception, extra)
107
+ end
108
+
109
+ def render_exception_with_yeller(env, exception)
110
+ Yeller::VerifyLog.render_exception_with_yeller!
111
+ _capture_exception(env, exception)
104
112
  render_exception_without_yeller(env, exception)
105
113
  end
106
114
  end
@@ -1,3 +1,3 @@
1
1
  module Yeller
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
data/lib/yeller.rb CHANGED
@@ -12,6 +12,7 @@ require File.expand_path('../yeller/version', __FILE__)
12
12
  require File.expand_path('../yeller/startup_params', __FILE__)
13
13
  require File.expand_path('../yeller/log_error_handler', __FILE__)
14
14
  require File.expand_path('../yeller/verify_log', __FILE__)
15
+ require File.expand_path('../yeller/rails/tasks', __FILE__)
15
16
 
16
17
  module Yeller
17
18
  def self.client(*blocks, &block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeller_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Crayford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-18 00:00:00.000000000 Z
11
+ date: 2015-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler