opal-airbrake 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +2 -0
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/LICENSE.md +21 -0
- data/README.md +14 -0
- data/Rakefile +14 -0
- data/lib/opal-airbrake.rb +3 -0
- data/opal-airbrake.gemspec +17 -0
- data/opal/airbrake.rb +11 -0
- data/opal/opal-airbrake.rb +1 -0
- data/opal/vendor/airbrake.js +831 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f7cbc1c03209f89f442930b5277d5b8fd4c299c5
|
4
|
+
data.tar.gz: c9425d3e016294660b2c954f7298bf7a843ae3d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 59ddc6e6d6a18f347dc4c0f02c97d6e0f01611005e1ee6f99201429fe51796266119d229b96eaaf8b399bc09b8a92ce5ebfe32a853ff7d051799ddfd6f489b29
|
7
|
+
data.tar.gz: b14bf821ef318220d5c14e31fc9f933b75ba80aad1b9cc94eac49e5dc24c33d630e26061f4c6165562ff44f4f1ba7830b7c5baaf2bacf7a7e8db7313129ec128
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Michał Kalbarczyk
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# opal-airbrake [![Gem Version](https://badge.fury.io/rb/opal-airbrake.svg)](http://badge.fury.io/rb/opal-airbrake) [![Code Climate](https://codeclimate.com/github/fazibear/opal-airbrake/badges/gpa.svg)](https://codeclimate.com/github/fazibear/opal-airbrake)
|
2
|
+
|
3
|
+
Opal wrapper for [airbrake-js](https://github.com/airbrake/airbrake-js) javascript library.
|
4
|
+
|
5
|
+
## usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
Airbrake.new({
|
9
|
+
project_id: 'xxx',
|
10
|
+
project_key: 'yyy'
|
11
|
+
})
|
12
|
+
```
|
13
|
+
|
14
|
+
And that is it :)
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
desc 'Update JS dependencies'
|
8
|
+
task :js_deps do
|
9
|
+
js_lib_url = 'https://raw.githubusercontent.com/airbrake/airbrake-js/master/dist/client.js'
|
10
|
+
js_lib_dest = File.join(File.dirname(__FILE__), './opal/vendor/airbrake.js')
|
11
|
+
open(js_lib_url) do |f|
|
12
|
+
File.write(js_lib_dest, f.readlines.join)
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'opal-airbrake'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.authors = ['Michał Kalbarczyk']
|
5
|
+
s.email = 'fazibear@gmail.com'
|
6
|
+
s.homepage = 'http://github.com/fazibear/opal-airbrake'
|
7
|
+
s.summary = 'airbrake-js wrapper for opal'
|
8
|
+
s.description = 'airbrake-js wrapper for opal'
|
9
|
+
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
12
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
+
s.require_paths = ['lib']
|
14
|
+
|
15
|
+
s.add_dependency 'opal'
|
16
|
+
s.add_development_dependency 'rake'
|
17
|
+
end
|
data/opal/airbrake.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'vendor/airbrake'
|
2
|
+
|
3
|
+
class Airbrake
|
4
|
+
include Native
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
options[:projectId] ||= options.delete(:project_id)
|
8
|
+
options[:projectKey] ||= options.delete(:project_key)
|
9
|
+
super `new window.airbrakeJs.Client(#{options.to_n})`
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'airbrake'
|
@@ -0,0 +1,831 @@
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.airbrakeJs || (g.airbrakeJs = {})).Client = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
(function (global){
|
3
|
+
var Client, Promise, makeOnErrorHandler, merge;
|
4
|
+
|
5
|
+
require('./internal/compat');
|
6
|
+
|
7
|
+
merge = require('./internal/merge');
|
8
|
+
|
9
|
+
Promise = require('./internal/promise');
|
10
|
+
|
11
|
+
makeOnErrorHandler = function(notifier) {
|
12
|
+
return function(message, file, line, column, error) {
|
13
|
+
if (error) {
|
14
|
+
return notifier.notify(error);
|
15
|
+
} else {
|
16
|
+
return notifier.notify({
|
17
|
+
error: {
|
18
|
+
message: message,
|
19
|
+
fileName: file,
|
20
|
+
lineNumber: line,
|
21
|
+
columnNumber: column || 0
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
25
|
+
};
|
26
|
+
};
|
27
|
+
|
28
|
+
Client = (function() {
|
29
|
+
function Client(opts) {
|
30
|
+
var reporter;
|
31
|
+
if (opts == null) {
|
32
|
+
opts = {};
|
33
|
+
}
|
34
|
+
this._projectId = opts.projectId || 0;
|
35
|
+
this._projectKey = opts.projectKey || '';
|
36
|
+
this._host = opts.host || 'https://api.airbrake.io';
|
37
|
+
this._processor = null;
|
38
|
+
this._reporters = [];
|
39
|
+
this._filters = [];
|
40
|
+
if (opts.processor !== void 0) {
|
41
|
+
this._processor = opts.processor;
|
42
|
+
} else {
|
43
|
+
this._processor = require('./processors/stack');
|
44
|
+
}
|
45
|
+
if (opts.reporter !== void 0) {
|
46
|
+
this.addReporter(opts.reporter);
|
47
|
+
} else {
|
48
|
+
if ('withCredentials' in new global.XMLHttpRequest()) {
|
49
|
+
reporter = 'compat';
|
50
|
+
} else {
|
51
|
+
reporter = 'jsonp';
|
52
|
+
}
|
53
|
+
this.addReporter(reporter);
|
54
|
+
}
|
55
|
+
this.addFilter(require('./internal/default_filter'));
|
56
|
+
this.onerror = makeOnErrorHandler(this);
|
57
|
+
if (global.onerror == null) {
|
58
|
+
global.onerror = this.onerror;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
Client.prototype.setProject = function(id, key) {
|
63
|
+
this._projectId = id;
|
64
|
+
return this._projectKey = key;
|
65
|
+
};
|
66
|
+
|
67
|
+
Client.prototype.setHost = function(host) {
|
68
|
+
return this._host = host;
|
69
|
+
};
|
70
|
+
|
71
|
+
Client.prototype.addContext = function(context) {
|
72
|
+
if (typeof console !== "undefined" && console !== null) {
|
73
|
+
if (typeof console.warn === "function") {
|
74
|
+
console.warn('airbrake: addContext is deprecated, please use addFilter');
|
75
|
+
}
|
76
|
+
}
|
77
|
+
return this.addFilter(function(notice) {
|
78
|
+
notice.context = merge({}, context, notice.context);
|
79
|
+
return notice;
|
80
|
+
});
|
81
|
+
};
|
82
|
+
|
83
|
+
Client.prototype.setEnvironmentName = function(envName) {
|
84
|
+
if (typeof console !== "undefined" && console !== null) {
|
85
|
+
if (typeof console.warn === "function") {
|
86
|
+
console.warn('airbrake: setEnvironmentName is deprecated, please use addFilter');
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return this.addFilter(function(notice) {
|
90
|
+
if (notice.context.environment == null) {
|
91
|
+
notice.context.environment = envName;
|
92
|
+
}
|
93
|
+
return notice;
|
94
|
+
});
|
95
|
+
};
|
96
|
+
|
97
|
+
Client.prototype.addParams = function(params) {
|
98
|
+
if (typeof console !== "undefined" && console !== null) {
|
99
|
+
if (typeof console.warn === "function") {
|
100
|
+
console.warn('airbrake: addParams is deprecated, please use addFilter');
|
101
|
+
}
|
102
|
+
}
|
103
|
+
return this.addFilter(function(notice) {
|
104
|
+
notice.params = merge({}, params, notice.params);
|
105
|
+
return notice;
|
106
|
+
});
|
107
|
+
};
|
108
|
+
|
109
|
+
Client.prototype.addEnvironment = function(env) {
|
110
|
+
if (typeof console !== "undefined" && console !== null) {
|
111
|
+
if (typeof console.warn === "function") {
|
112
|
+
console.warn('airbrake: addEnvironment is deprecated, please use addFilter');
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return this.addFilter(function(notice) {
|
116
|
+
notice.environment = merge({}, env, notice.environment);
|
117
|
+
return notice;
|
118
|
+
});
|
119
|
+
};
|
120
|
+
|
121
|
+
Client.prototype.addSession = function(session) {
|
122
|
+
if (typeof console !== "undefined" && console !== null) {
|
123
|
+
if (typeof console.warn === "function") {
|
124
|
+
console.warn('airbrake: addSession is deprecated, please use addFilter');
|
125
|
+
}
|
126
|
+
}
|
127
|
+
return this.addFilter(function(notice) {
|
128
|
+
notice.session = merge({}, session, notice.session);
|
129
|
+
return notice;
|
130
|
+
});
|
131
|
+
};
|
132
|
+
|
133
|
+
Client.prototype.addReporter = function(reporter) {
|
134
|
+
switch (reporter) {
|
135
|
+
case 'compat':
|
136
|
+
reporter = require('./reporters/compat');
|
137
|
+
break;
|
138
|
+
case 'xhr':
|
139
|
+
reporter = require('./reporters/xhr');
|
140
|
+
break;
|
141
|
+
case 'jsonp':
|
142
|
+
reporter = require('./reporters/jsonp');
|
143
|
+
}
|
144
|
+
return this._reporters.push(reporter);
|
145
|
+
};
|
146
|
+
|
147
|
+
Client.prototype.addFilter = function(filter) {
|
148
|
+
return this._filters.push(filter);
|
149
|
+
};
|
150
|
+
|
151
|
+
Client.prototype.notify = function(err) {
|
152
|
+
var defContext, promise, ref;
|
153
|
+
defContext = {
|
154
|
+
language: 'JavaScript',
|
155
|
+
sourceMapEnabled: true
|
156
|
+
};
|
157
|
+
if ((ref = global.navigator) != null ? ref.userAgent : void 0) {
|
158
|
+
defContext.userAgent = global.navigator.userAgent;
|
159
|
+
}
|
160
|
+
if (global.location) {
|
161
|
+
defContext.url = String(global.location);
|
162
|
+
defContext.rootDirectory = global.location.protocol + '//' + global.location.host;
|
163
|
+
}
|
164
|
+
promise = new Promise();
|
165
|
+
this._processor(err.error || err, (function(_this) {
|
166
|
+
return function(processorName, errInfo) {
|
167
|
+
var filterFn, j, k, len, len1, n, notice, opts, ref1, ref2, reporterFn;
|
168
|
+
notice = {
|
169
|
+
errors: [errInfo],
|
170
|
+
context: merge(defContext, err.context),
|
171
|
+
params: err.params || {},
|
172
|
+
environment: err.environment || {},
|
173
|
+
session: err.session || {}
|
174
|
+
};
|
175
|
+
notice.context.notifier = {
|
176
|
+
name: 'airbrake-js-' + processorName,
|
177
|
+
version: '0.5.6',
|
178
|
+
url: 'https://github.com/airbrake/airbrake-js'
|
179
|
+
};
|
180
|
+
ref1 = _this._filters;
|
181
|
+
for (j = 0, len = ref1.length; j < len; j++) {
|
182
|
+
filterFn = ref1[j];
|
183
|
+
n = filterFn(notice);
|
184
|
+
if (n === null || n === false) {
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
if (n.errors != null) {
|
188
|
+
notice = n;
|
189
|
+
} else {
|
190
|
+
if (typeof console !== "undefined" && console !== null) {
|
191
|
+
if (typeof console.warn === "function") {
|
192
|
+
console.warn('airbrake: filter must return notice or null to ignore the notice');
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
197
|
+
opts = {
|
198
|
+
projectId: _this._projectId,
|
199
|
+
projectKey: _this._projectKey,
|
200
|
+
host: _this._host
|
201
|
+
};
|
202
|
+
ref2 = _this._reporters;
|
203
|
+
for (k = 0, len1 = ref2.length; k < len1; k++) {
|
204
|
+
reporterFn = ref2[k];
|
205
|
+
reporterFn(notice, opts, promise);
|
206
|
+
}
|
207
|
+
};
|
208
|
+
})(this));
|
209
|
+
return promise;
|
210
|
+
};
|
211
|
+
|
212
|
+
Client.prototype.push = function(err) {
|
213
|
+
if (typeof console !== "undefined" && console !== null) {
|
214
|
+
if (typeof console.warn === "function") {
|
215
|
+
console.warn('airbrake: push is deprecated, please use notify');
|
216
|
+
}
|
217
|
+
}
|
218
|
+
return this.notify(err);
|
219
|
+
};
|
220
|
+
|
221
|
+
Client.prototype._wrapArguments = function(args) {
|
222
|
+
var arg, i, j, len;
|
223
|
+
for (i = j = 0, len = args.length; j < len; i = ++j) {
|
224
|
+
arg = args[i];
|
225
|
+
if (typeof arg === 'function') {
|
226
|
+
args[i] = this.wrap(arg);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
return args;
|
230
|
+
};
|
231
|
+
|
232
|
+
Client.prototype.wrap = function(fn) {
|
233
|
+
var airbrakeWrapper, prop, self;
|
234
|
+
if (fn.__airbrake__) {
|
235
|
+
return fn;
|
236
|
+
}
|
237
|
+
self = this;
|
238
|
+
airbrakeWrapper = function() {
|
239
|
+
var args, exc;
|
240
|
+
args = self._wrapArguments(arguments);
|
241
|
+
try {
|
242
|
+
return fn.apply(this, args);
|
243
|
+
} catch (_error) {
|
244
|
+
exc = _error;
|
245
|
+
args = Array.prototype.slice.call(arguments);
|
246
|
+
self.notify({
|
247
|
+
error: exc,
|
248
|
+
params: {
|
249
|
+
"arguments": args
|
250
|
+
}
|
251
|
+
});
|
252
|
+
return null;
|
253
|
+
}
|
254
|
+
};
|
255
|
+
for (prop in fn) {
|
256
|
+
if (fn.hasOwnProperty(prop)) {
|
257
|
+
airbrakeWrapper[prop] = fn[prop];
|
258
|
+
}
|
259
|
+
}
|
260
|
+
airbrakeWrapper.__airbrake__ = true;
|
261
|
+
airbrakeWrapper.__inner__ = fn;
|
262
|
+
return airbrakeWrapper;
|
263
|
+
};
|
264
|
+
|
265
|
+
return Client;
|
266
|
+
|
267
|
+
})();
|
268
|
+
|
269
|
+
module.exports = Client;
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
274
|
+
},{"./internal/compat":2,"./internal/default_filter":3,"./internal/merge":5,"./internal/promise":6,"./processors/stack":8,"./reporters/compat":9,"./reporters/jsonp":10,"./reporters/xhr":11}],2:[function(require,module,exports){
|
275
|
+
var base;
|
276
|
+
|
277
|
+
if ((base = Array.prototype).indexOf == null) {
|
278
|
+
base.indexOf = function(obj, start) {
|
279
|
+
var i, j, ref, ref1;
|
280
|
+
start = start || 0;
|
281
|
+
for (i = j = ref = start, ref1 = this.length; ref <= ref1 ? j < ref1 : j > ref1; i = ref <= ref1 ? ++j : --j) {
|
282
|
+
if (this[i] === obj) {
|
283
|
+
return i;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
return -1;
|
287
|
+
};
|
288
|
+
}
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
},{}],3:[function(require,module,exports){
|
293
|
+
var IGNORED_MESSAGES, filter,
|
294
|
+
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
295
|
+
|
296
|
+
IGNORED_MESSAGES = ['Script error', 'Script error.'];
|
297
|
+
|
298
|
+
filter = function(notice) {
|
299
|
+
var msg;
|
300
|
+
msg = notice.errors[0].message;
|
301
|
+
if (indexOf.call(IGNORED_MESSAGES, msg) >= 0) {
|
302
|
+
return null;
|
303
|
+
}
|
304
|
+
return notice;
|
305
|
+
};
|
306
|
+
|
307
|
+
module.exports = filter;
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
},{}],4:[function(require,module,exports){
|
312
|
+
var jsonifyNotice, truncate, truncateObj;
|
313
|
+
|
314
|
+
truncate = require('./truncate');
|
315
|
+
|
316
|
+
truncateObj = function(obj, n) {
|
317
|
+
var dst, key;
|
318
|
+
if (n == null) {
|
319
|
+
n = 1000;
|
320
|
+
}
|
321
|
+
dst = {};
|
322
|
+
for (key in obj) {
|
323
|
+
dst[key] = truncate(obj[key], n = n);
|
324
|
+
}
|
325
|
+
return dst;
|
326
|
+
};
|
327
|
+
|
328
|
+
jsonifyNotice = function(notice, n, maxLength) {
|
329
|
+
var err, s;
|
330
|
+
if (n == null) {
|
331
|
+
n = 1000;
|
332
|
+
}
|
333
|
+
if (maxLength == null) {
|
334
|
+
maxLength = 64000;
|
335
|
+
}
|
336
|
+
while (true) {
|
337
|
+
notice.params = truncateObj(notice.params, n = n);
|
338
|
+
notice.environment = truncateObj(notice.environment, n = n);
|
339
|
+
notice.session = truncateObj(notice.session, n = n);
|
340
|
+
s = JSON.stringify(notice);
|
341
|
+
if (s.length < maxLength) {
|
342
|
+
return s;
|
343
|
+
}
|
344
|
+
if (n === 0) {
|
345
|
+
break;
|
346
|
+
}
|
347
|
+
n = Math.floor(n / 2);
|
348
|
+
}
|
349
|
+
err = new Error("airbrake-js: cannot jsonify notice (length=" + s.length + " maxLength=" + maxLength + ")");
|
350
|
+
err.params = {
|
351
|
+
json: s.slice(0, +Math.floor(n / 2) + 1 || 9e9) + '...'
|
352
|
+
};
|
353
|
+
throw err;
|
354
|
+
};
|
355
|
+
|
356
|
+
module.exports = jsonifyNotice;
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
},{"./truncate":7}],5:[function(require,module,exports){
|
361
|
+
var merge;
|
362
|
+
|
363
|
+
merge = function() {
|
364
|
+
var dst, i, key, len, obj, objs;
|
365
|
+
objs = Array.prototype.slice.call(arguments);
|
366
|
+
dst = objs.shift() || {};
|
367
|
+
for (i = 0, len = objs.length; i < len; i++) {
|
368
|
+
obj = objs[i];
|
369
|
+
for (key in obj) {
|
370
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
371
|
+
dst[key] = obj[key];
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
return dst;
|
376
|
+
};
|
377
|
+
|
378
|
+
module.exports = merge;
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
},{}],6:[function(require,module,exports){
|
383
|
+
var Promise;
|
384
|
+
|
385
|
+
Promise = (function() {
|
386
|
+
function Promise(executor) {
|
387
|
+
var reject, resolve;
|
388
|
+
this._onResolved = [];
|
389
|
+
this._onRejected = [];
|
390
|
+
resolve = (function(_this) {
|
391
|
+
return function() {
|
392
|
+
return _this.resolve.apply(_this, arguments);
|
393
|
+
};
|
394
|
+
})(this);
|
395
|
+
reject = (function(_this) {
|
396
|
+
return function() {
|
397
|
+
return _this.reject.apply(_this, arguments);
|
398
|
+
};
|
399
|
+
})(this);
|
400
|
+
if (executor != null) {
|
401
|
+
executor(resolve, reject);
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
Promise.prototype.then = function(onResolved, onRejected) {
|
406
|
+
if (onResolved) {
|
407
|
+
if (this._resolvedWith != null) {
|
408
|
+
onResolved(this._resolvedWith);
|
409
|
+
}
|
410
|
+
this._onResolved.push(onResolved);
|
411
|
+
}
|
412
|
+
if (onRejected) {
|
413
|
+
if (this._rejectedWith != null) {
|
414
|
+
onRejected(this._resolvedWith);
|
415
|
+
}
|
416
|
+
this._onRejected.push(onRejected);
|
417
|
+
}
|
418
|
+
return this;
|
419
|
+
};
|
420
|
+
|
421
|
+
Promise.prototype["catch"] = function(onRejected) {
|
422
|
+
if (this._rejectedWith != null) {
|
423
|
+
onRejected(this._rejectedWith);
|
424
|
+
}
|
425
|
+
this._onRejected.push(onRejected);
|
426
|
+
return this;
|
427
|
+
};
|
428
|
+
|
429
|
+
Promise.prototype.resolve = function() {
|
430
|
+
var fn, i, len, ref;
|
431
|
+
this._resolvedWith = arguments;
|
432
|
+
ref = this._onResolved;
|
433
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
434
|
+
fn = ref[i];
|
435
|
+
fn.apply(this, this._resolvedWith);
|
436
|
+
}
|
437
|
+
return this;
|
438
|
+
};
|
439
|
+
|
440
|
+
Promise.prototype.reject = function() {
|
441
|
+
var fn, i, len, ref;
|
442
|
+
this._rejectedWith = arguments;
|
443
|
+
ref = this._onRejected;
|
444
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
445
|
+
fn = ref[i];
|
446
|
+
fn.apply(this, this._rejectedWith);
|
447
|
+
}
|
448
|
+
return this;
|
449
|
+
};
|
450
|
+
|
451
|
+
return Promise;
|
452
|
+
|
453
|
+
})();
|
454
|
+
|
455
|
+
module.exports = Promise;
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
},{}],7:[function(require,module,exports){
|
460
|
+
var getAttr, truncate;
|
461
|
+
|
462
|
+
getAttr = function(obj, attr) {
|
463
|
+
var exc;
|
464
|
+
try {
|
465
|
+
return obj[attr];
|
466
|
+
} catch (_error) {
|
467
|
+
exc = _error;
|
468
|
+
return void 0;
|
469
|
+
}
|
470
|
+
};
|
471
|
+
|
472
|
+
truncate = function(value, n, depth) {
|
473
|
+
var fn, getPath, keys, nn, seen;
|
474
|
+
if (n == null) {
|
475
|
+
n = 1000;
|
476
|
+
}
|
477
|
+
if (depth == null) {
|
478
|
+
depth = 5;
|
479
|
+
}
|
480
|
+
nn = 0;
|
481
|
+
keys = [];
|
482
|
+
seen = [];
|
483
|
+
getPath = function(value) {
|
484
|
+
var i, index, j, path, ref;
|
485
|
+
index = seen.indexOf(value);
|
486
|
+
path = [keys[index]];
|
487
|
+
for (i = j = ref = index; ref <= 0 ? j <= 0 : j >= 0; i = ref <= 0 ? ++j : --j) {
|
488
|
+
if (seen[i] && getAttr(seen[i], path[0]) === value) {
|
489
|
+
value = seen[i];
|
490
|
+
path.unshift(keys[i]);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
return '~' + path.join('.');
|
494
|
+
};
|
495
|
+
fn = function(value, key, dd) {
|
496
|
+
var dst, el, i, j, len, val;
|
497
|
+
if (key == null) {
|
498
|
+
key = '';
|
499
|
+
}
|
500
|
+
if (dd == null) {
|
501
|
+
dd = 0;
|
502
|
+
}
|
503
|
+
nn++;
|
504
|
+
if (nn > n) {
|
505
|
+
return '[Truncated]';
|
506
|
+
}
|
507
|
+
if (value === null || value === void 0) {
|
508
|
+
return value;
|
509
|
+
}
|
510
|
+
switch (typeof value) {
|
511
|
+
case 'boolean':
|
512
|
+
case 'number':
|
513
|
+
case 'string':
|
514
|
+
case 'function':
|
515
|
+
return value;
|
516
|
+
case 'object':
|
517
|
+
break;
|
518
|
+
default:
|
519
|
+
return String(value);
|
520
|
+
}
|
521
|
+
if (value instanceof Boolean || value instanceof Number || value instanceof String || value instanceof Date || value instanceof RegExp) {
|
522
|
+
return value;
|
523
|
+
}
|
524
|
+
if (seen.indexOf(value) >= 0) {
|
525
|
+
return "[Circular " + (getPath(value)) + "]";
|
526
|
+
}
|
527
|
+
dd++;
|
528
|
+
if (dd > depth) {
|
529
|
+
return '[Truncated]';
|
530
|
+
}
|
531
|
+
keys.push(key);
|
532
|
+
seen.push(value);
|
533
|
+
nn--;
|
534
|
+
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
535
|
+
dst = [];
|
536
|
+
for (i = j = 0, len = value.length; j < len; i = ++j) {
|
537
|
+
el = value[i];
|
538
|
+
nn++;
|
539
|
+
if (nn >= n) {
|
540
|
+
break;
|
541
|
+
}
|
542
|
+
dst.push(fn(el, key = i, dd));
|
543
|
+
}
|
544
|
+
return dst;
|
545
|
+
}
|
546
|
+
dst = {};
|
547
|
+
for (key in value) {
|
548
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) {
|
549
|
+
continue;
|
550
|
+
}
|
551
|
+
nn++;
|
552
|
+
if (nn >= n) {
|
553
|
+
break;
|
554
|
+
}
|
555
|
+
val = getAttr(value, key);
|
556
|
+
if (val !== void 0) {
|
557
|
+
dst[key] = fn(val, key = key, dd);
|
558
|
+
}
|
559
|
+
}
|
560
|
+
return dst;
|
561
|
+
};
|
562
|
+
return fn(value);
|
563
|
+
};
|
564
|
+
|
565
|
+
module.exports = truncate;
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
},{}],8:[function(require,module,exports){
|
570
|
+
var processor, rules, typeMessageRe;
|
571
|
+
|
572
|
+
rules = [
|
573
|
+
{
|
574
|
+
name: 'v8',
|
575
|
+
re: /^\s*at\s(.+?)\s\((?:(?:(.+):(\d+):(\d+))|(.+))\)$/,
|
576
|
+
fn: function(m) {
|
577
|
+
return {
|
578
|
+
"function": m[1],
|
579
|
+
file: m[2] || m[5],
|
580
|
+
line: m[3] && parseInt(m[3], 10) || 0,
|
581
|
+
column: m[4] && parseInt(m[4], 10) || 0
|
582
|
+
};
|
583
|
+
}
|
584
|
+
}, {
|
585
|
+
name: 'firefox30',
|
586
|
+
re: /^(.*)@(.+):(\d+):(\d+)$/,
|
587
|
+
fn: function(m) {
|
588
|
+
var evaledRe, file, func, mm;
|
589
|
+
func = m[1];
|
590
|
+
file = m[2];
|
591
|
+
evaledRe = /^(\S+)\s(line\s\d+\s>\seval.*)$/;
|
592
|
+
if (mm = file.match(evaledRe)) {
|
593
|
+
if (func.length > 0) {
|
594
|
+
func = func + ' ' + mm[2];
|
595
|
+
} else {
|
596
|
+
func = mm[2];
|
597
|
+
}
|
598
|
+
file = mm[1];
|
599
|
+
}
|
600
|
+
return {
|
601
|
+
"function": func,
|
602
|
+
file: file,
|
603
|
+
line: parseInt(m[3], 10),
|
604
|
+
column: parseInt(m[4], 10)
|
605
|
+
};
|
606
|
+
}
|
607
|
+
}, {
|
608
|
+
name: 'firefox14',
|
609
|
+
re: /^(.*)@(.+):(\d+)$/,
|
610
|
+
fn: function(m, i, e) {
|
611
|
+
var column;
|
612
|
+
if (i === 0) {
|
613
|
+
column = e.columnNumber || 0;
|
614
|
+
} else {
|
615
|
+
column = 0;
|
616
|
+
}
|
617
|
+
return {
|
618
|
+
"function": m[1],
|
619
|
+
file: m[2],
|
620
|
+
line: parseInt(m[3], 10),
|
621
|
+
column: column
|
622
|
+
};
|
623
|
+
}
|
624
|
+
}, {
|
625
|
+
name: 'v8-short',
|
626
|
+
re: /^\s*at\s(.+):(\d+):(\d+)$/,
|
627
|
+
fn: function(m) {
|
628
|
+
return {
|
629
|
+
"function": '',
|
630
|
+
file: m[1],
|
631
|
+
line: parseInt(m[2], 10),
|
632
|
+
column: parseInt(m[3], 10)
|
633
|
+
};
|
634
|
+
}
|
635
|
+
}, {
|
636
|
+
name: 'phantomjs',
|
637
|
+
re: /^\s*at\s(.+):(\d+)$/,
|
638
|
+
fn: function(m) {
|
639
|
+
return {
|
640
|
+
"function": '',
|
641
|
+
file: m[1],
|
642
|
+
line: parseInt(m[2], 10),
|
643
|
+
column: 0
|
644
|
+
};
|
645
|
+
}
|
646
|
+
}, {
|
647
|
+
name: 'default',
|
648
|
+
re: /.+/,
|
649
|
+
fn: function(m) {
|
650
|
+
return {
|
651
|
+
"function": m[0],
|
652
|
+
file: '',
|
653
|
+
line: 0,
|
654
|
+
column: 0
|
655
|
+
};
|
656
|
+
}
|
657
|
+
}
|
658
|
+
];
|
659
|
+
|
660
|
+
typeMessageRe = /^\S+:\s.+$/;
|
661
|
+
|
662
|
+
processor = function(e, cb) {
|
663
|
+
var backtrace, i, j, k, len, len1, line, lines, m, msg, processorName, rule, stack, type, uncaughtExcRe;
|
664
|
+
processorName = 'nostack';
|
665
|
+
stack = e.stack || '';
|
666
|
+
lines = stack.split('\n');
|
667
|
+
backtrace = [];
|
668
|
+
for (i = j = 0, len = lines.length; j < len; i = ++j) {
|
669
|
+
line = lines[i];
|
670
|
+
if (line === '') {
|
671
|
+
continue;
|
672
|
+
}
|
673
|
+
for (k = 0, len1 = rules.length; k < len1; k++) {
|
674
|
+
rule = rules[k];
|
675
|
+
m = line.match(rule.re);
|
676
|
+
if (!m) {
|
677
|
+
continue;
|
678
|
+
}
|
679
|
+
processorName = rule.name;
|
680
|
+
backtrace.push(rule.fn(m, i, e));
|
681
|
+
break;
|
682
|
+
}
|
683
|
+
}
|
684
|
+
if ((processorName === 'v8' || processorName === 'v8-short') && backtrace.length > 0 && backtrace[0]["function"].match(typeMessageRe)) {
|
685
|
+
backtrace = backtrace.slice(1);
|
686
|
+
}
|
687
|
+
if (backtrace.length === 0 && ((e.fileName != null) || (e.lineNumber != null) || (e.columnNumber != null))) {
|
688
|
+
backtrace.push({
|
689
|
+
"function": '',
|
690
|
+
file: e.fileName || '',
|
691
|
+
line: parseInt(e.lineNumber, 10) || 0,
|
692
|
+
column: parseInt(e.columnNumber, 10) || 0
|
693
|
+
});
|
694
|
+
}
|
695
|
+
if (backtrace.length === 0 && ((e.filename != null) || (e.lineno != null) || (e.column != null) || (e.colno != null))) {
|
696
|
+
backtrace.push({
|
697
|
+
"function": '',
|
698
|
+
file: e.filename || '',
|
699
|
+
line: parseInt(e.lineno, 10) || 0,
|
700
|
+
column: parseInt(e.column || e.colno, 10) || 0
|
701
|
+
});
|
702
|
+
}
|
703
|
+
if (e.message != null) {
|
704
|
+
msg = e.message;
|
705
|
+
} else {
|
706
|
+
msg = String(e);
|
707
|
+
}
|
708
|
+
if ((e.name != null) && e.name !== '') {
|
709
|
+
type = e.name;
|
710
|
+
msg = type + ': ' + msg;
|
711
|
+
} else {
|
712
|
+
uncaughtExcRe = /^Uncaught\s(.+?):\s.+$/;
|
713
|
+
m = msg.match(uncaughtExcRe);
|
714
|
+
if (m) {
|
715
|
+
type = m[1];
|
716
|
+
} else {
|
717
|
+
type = '';
|
718
|
+
}
|
719
|
+
}
|
720
|
+
return cb(processorName, {
|
721
|
+
'type': type,
|
722
|
+
'message': msg,
|
723
|
+
'backtrace': backtrace
|
724
|
+
});
|
725
|
+
};
|
726
|
+
|
727
|
+
module.exports = processor;
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
},{}],9:[function(require,module,exports){
|
732
|
+
(function (global){
|
733
|
+
var jsonifyNotice, report;
|
734
|
+
|
735
|
+
jsonifyNotice = require('../internal/jsonify_notice');
|
736
|
+
|
737
|
+
report = function(notice, opts, promise) {
|
738
|
+
var payload, req, url;
|
739
|
+
url = opts.host + "/api/v3/projects/" + opts.projectId + "/create-notice?key=" + opts.projectKey;
|
740
|
+
payload = jsonifyNotice(notice);
|
741
|
+
req = new global.XMLHttpRequest();
|
742
|
+
req.open('POST', url, true);
|
743
|
+
req.send(payload);
|
744
|
+
return req.onreadystatechange = function() {
|
745
|
+
var resp;
|
746
|
+
if (req.readyState === 4 && req.status === 200) {
|
747
|
+
resp = JSON.parse(req.responseText);
|
748
|
+
notice.id = resp.id;
|
749
|
+
return promise.resolve(notice);
|
750
|
+
}
|
751
|
+
};
|
752
|
+
};
|
753
|
+
|
754
|
+
module.exports = report;
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
759
|
+
},{"../internal/jsonify_notice":4}],10:[function(require,module,exports){
|
760
|
+
(function (global){
|
761
|
+
var cbCount, jsonifyNotice, report;
|
762
|
+
|
763
|
+
jsonifyNotice = require('../internal/jsonify_notice');
|
764
|
+
|
765
|
+
cbCount = 0;
|
766
|
+
|
767
|
+
report = function(notice, opts, promise) {
|
768
|
+
var cbName, document, head, payload, removeScript, script, url;
|
769
|
+
cbCount++;
|
770
|
+
cbName = 'airbrakeCb' + String(cbCount);
|
771
|
+
global[cbName] = function(resp) {
|
772
|
+
var _;
|
773
|
+
notice.id = resp.id;
|
774
|
+
promise.resolve(notice);
|
775
|
+
try {
|
776
|
+
return delete global[cbName];
|
777
|
+
} catch (_error) {
|
778
|
+
_ = _error;
|
779
|
+
return global[cbName] = void 0;
|
780
|
+
}
|
781
|
+
};
|
782
|
+
payload = encodeURIComponent(jsonifyNotice(notice));
|
783
|
+
url = opts.host + "/api/v3/projects/" + opts.projectId + "/create-notice?key=" + opts.projectKey + "&callback=" + cbName + "&body=" + payload;
|
784
|
+
document = global.document;
|
785
|
+
head = document.getElementsByTagName('head')[0];
|
786
|
+
script = document.createElement('script');
|
787
|
+
script.src = url;
|
788
|
+
removeScript = function() {
|
789
|
+
return head.removeChild(script);
|
790
|
+
};
|
791
|
+
script.onload = removeScript;
|
792
|
+
script.onerror = removeScript;
|
793
|
+
return head.appendChild(script);
|
794
|
+
};
|
795
|
+
|
796
|
+
module.exports = report;
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
801
|
+
},{"../internal/jsonify_notice":4}],11:[function(require,module,exports){
|
802
|
+
(function (global){
|
803
|
+
var jsonifyNotice, report;
|
804
|
+
|
805
|
+
jsonifyNotice = require('../internal/jsonify_notice');
|
806
|
+
|
807
|
+
report = function(notice, opts, promise) {
|
808
|
+
var payload, req, url;
|
809
|
+
url = opts.host + "/api/v3/projects/" + opts.projectId + "/notices?key=" + opts.projectKey;
|
810
|
+
payload = jsonifyNotice(notice);
|
811
|
+
req = new global.XMLHttpRequest();
|
812
|
+
req.open('POST', url, true);
|
813
|
+
req.setRequestHeader('Content-Type', 'application/json');
|
814
|
+
req.send(payload);
|
815
|
+
return req.onreadystatechange = function() {
|
816
|
+
var resp;
|
817
|
+
if (req.readyState === 4 && req.status === 201) {
|
818
|
+
resp = JSON.parse(req.responseText);
|
819
|
+
notice.id = resp.id;
|
820
|
+
return promise.resolve(notice);
|
821
|
+
}
|
822
|
+
};
|
823
|
+
};
|
824
|
+
|
825
|
+
module.exports = report;
|
826
|
+
|
827
|
+
|
828
|
+
|
829
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
830
|
+
},{"../internal/jsonify_notice":4}]},{},[1])(1)
|
831
|
+
});
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opal-airbrake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michał Kalbarczyk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: airbrake-js wrapper for opal
|
42
|
+
email: fazibear@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- ".codeclimate.yml"
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.md
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/opal-airbrake.rb
|
54
|
+
- opal-airbrake.gemspec
|
55
|
+
- opal/airbrake.rb
|
56
|
+
- opal/opal-airbrake.rb
|
57
|
+
- opal/vendor/airbrake.js
|
58
|
+
homepage: http://github.com/fazibear/opal-airbrake
|
59
|
+
licenses: []
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.4.8
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: airbrake-js wrapper for opal
|
81
|
+
test_files: []
|