hoptoad_notifier 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/lib/hoptoad_notifier/version.rb +1 -1
- data/lib/templates/rescue.erb +91 -0
- metadata +3 -2
data/Rakefile
CHANGED
@@ -41,7 +41,8 @@ gemspec = Gem::Specification.new do |s|
|
|
41
41
|
s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
|
42
42
|
|
43
43
|
s.files = FileList['[A-Z]*', 'generators/**/*.*', 'lib/**/*.rb',
|
44
|
-
'test/**/*.rb', 'rails/**/*.rb', 'script/*'
|
44
|
+
'test/**/*.rb', 'rails/**/*.rb', 'script/*',
|
45
|
+
'lib/templates/*.erb']
|
45
46
|
s.require_path = 'lib'
|
46
47
|
s.test_files = Dir[*['test/**/*_test.rb']]
|
47
48
|
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
var Hoptoad = {
|
3
|
+
host : <%= host.to_json %>,
|
4
|
+
api_key : <%= api_key.to_json %>,
|
5
|
+
notice : <%= notice.to_json %>,
|
6
|
+
message : 'This error exists in production!',
|
7
|
+
|
8
|
+
initialize: function() {
|
9
|
+
if (this.initialized) {
|
10
|
+
return;
|
11
|
+
} else {
|
12
|
+
this.initialized = true;
|
13
|
+
}
|
14
|
+
|
15
|
+
var data = [];
|
16
|
+
|
17
|
+
for (var key in this.notice) {
|
18
|
+
data[data.length] = 'notice[' + key + ']=' + this.notice[key];
|
19
|
+
}
|
20
|
+
|
21
|
+
data[data.length] = 'notice[api_key]=' + this.api_key;
|
22
|
+
data[data.length] = 'callback=Hoptoad.onSuccess';
|
23
|
+
data[data.length] = '_=' + (new Date()).getTime();
|
24
|
+
|
25
|
+
var head = document.getElementsByTagName('head')[0];
|
26
|
+
var done = false;
|
27
|
+
|
28
|
+
var
|
29
|
+
script = document.createElement('script');
|
30
|
+
script.src = 'http://' + this.host + '/notices_api/v1/notices/exist?' +
|
31
|
+
data.join('&');
|
32
|
+
script.type = 'text/javascript';
|
33
|
+
script.onload = script.onreadystatechange = function(){
|
34
|
+
if (!done && (!this.readyState ||
|
35
|
+
this.readyState == 'loaded' || this.readyState == 'complete')) {
|
36
|
+
|
37
|
+
done = true;
|
38
|
+
|
39
|
+
// Handle memory leak in IE. (via jQuery)
|
40
|
+
script.onload = script.onreadystatechange = null;
|
41
|
+
head.removeChild(script);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
45
|
+
head.appendChild(script);
|
46
|
+
},
|
47
|
+
|
48
|
+
onSuccess: function(error) {
|
49
|
+
var body = document.getElementsByTagName('body')[0];
|
50
|
+
var text = document.createTextNode(this.message);
|
51
|
+
var element = document.createElement('a');
|
52
|
+
|
53
|
+
element.id = 'hoptoad';
|
54
|
+
element.href = 'http://' + error.subdomain + '.' + this.host +
|
55
|
+
'/projects/' + error.project_id + '/errors/' + error.id;
|
56
|
+
element.appendChild(text);
|
57
|
+
|
58
|
+
body.insertBefore(element, body.firstChild);
|
59
|
+
|
60
|
+
var h1 = document.getElementsByTagName('h1')[0];
|
61
|
+
var pre = document.getElementsByTagName('pre')[0];
|
62
|
+
var wrapper = document.createElement('div');
|
63
|
+
|
64
|
+
wrapper.id = 'wrapper';
|
65
|
+
wrapper.appendChild(h1);
|
66
|
+
wrapper.appendChild(pre);
|
67
|
+
|
68
|
+
body.insertBefore(wrapper, body.children[1]);
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
window.onload = function() {
|
73
|
+
Hoptoad.initialize.apply(Hoptoad);
|
74
|
+
};
|
75
|
+
</script>
|
76
|
+
|
77
|
+
<style type="text/css">
|
78
|
+
#hoptoad {
|
79
|
+
background: #FFF url(http://hoptoadapp.com/images/fell-off-the-toad.gif) no-repeat top right;
|
80
|
+
color: #F00;
|
81
|
+
padding: 45px 101px 45px 12px;
|
82
|
+
font-size: 14px;
|
83
|
+
font-weight: bold;
|
84
|
+
display: block;
|
85
|
+
float: right;
|
86
|
+
}
|
87
|
+
|
88
|
+
#wrapper {
|
89
|
+
padding-right: 360px;
|
90
|
+
}
|
91
|
+
</style>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoptoad_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot, inc
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- test/sender_test.rb
|
59
59
|
- rails/init.rb
|
60
60
|
- script/integration_test.rb
|
61
|
+
- lib/templates/rescue.erb
|
61
62
|
has_rdoc: true
|
62
63
|
homepage: http://www.hoptoadapp.com
|
63
64
|
licenses: []
|