yeller_ruby 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yeller/rails/tasks.rb +57 -54
- data/lib/yeller/rails.rb +11 -3
- data/lib/yeller/version.rb +1 -1
- data/lib/yeller.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee207401005b37d98db0a62563af2fc23a29a17
|
4
|
+
data.tar.gz: 0a423f8b41680ca0be1493dfaa797076afa7e91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ce49b66ee1ab619bd2dbc52b007c3806fbbd71bb7b13fb3c485e2717955bed183d47819dfec4b8e85654e56dd22553ce140951d540a75c271ba84643f77f588
|
7
|
+
data.tar.gz: 5a28772bbc5226ad17d98ff7d4c277e1cdd81122601ccac027e00f74e949184d1a721d4092319006b94bb59273879036f2b76f7de668d0813acbfadf2caea85a
|
data/lib/yeller/rails/tasks.rb
CHANGED
@@ -1,76 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
13
|
+
rails3_onwards_catcher = Yeller::Rails::Rails3AndFourCatchingHooks
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
28
|
+
class YellerVerifyException < RuntimeError; end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
Yeller::Rails.configure do |config|
|
31
|
+
config.development_environments = []
|
32
|
+
end
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
+
class ApplicationController
|
35
|
+
prepend_before_filter :verify_yeller
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
42
|
+
def verify
|
43
|
+
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
def consider_all_requests_local
|
46
|
+
false
|
47
|
+
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
def local_request?
|
50
|
+
false
|
51
|
+
end
|
49
52
|
end
|
50
|
-
end
|
51
53
|
|
52
|
-
|
54
|
+
class YellerVerificationController < ApplicationController; end
|
53
55
|
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
Rails.application.routes.draw do
|
58
|
+
get '/yeller_verify' => 'yeller_verification#verify'
|
59
|
+
end
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
+
env = Rack::MockRequest.env_for('http://example.com/yeller_verify')
|
62
|
+
Rails.application.call(env)
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
71
|
-
|
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
|
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
|
data/lib/yeller/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|