squash_ruby 1.0.1 → 1.1.0
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.
- data/README.md +5 -2
- data/lib/squash/ruby.rb +41 -7
- data/lib/squash/ruby/exception_additions.rb +0 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Squash Client Library: Ruby
|
|
4
4
|
This client library reports exceptions to Squash, the Squarish exception
|
5
5
|
reporting and management system.
|
6
6
|
|
7
|
+
[](https://travis-ci.org/SquareSquash/ruby)
|
8
|
+
|
7
9
|
Documentation
|
8
10
|
-------------
|
9
11
|
|
@@ -160,12 +162,13 @@ only one of the following configuration keys:
|
|
160
162
|
|
161
163
|
* `revision_file`: The path to a file storing the SHA1 of the current Git
|
162
164
|
revision. This is the revision of the code that is currently running.
|
165
|
+
* `revision`: The 40-character SHA1 of the current deployed revision.
|
163
166
|
* `repository_root`: The path to the working directory of the Git repository
|
164
167
|
that is currently running. Use this option if your deployed code is a working
|
165
168
|
Git repository.
|
166
169
|
|
167
|
-
By default, `repository_root` is assumed and is set to `Dir.getwd`.
|
168
|
-
|
170
|
+
By default, `repository_root` is assumed and is set to `Dir.getwd`. Other
|
171
|
+
options override `repository_root`.
|
169
172
|
|
170
173
|
### Error Transmission
|
171
174
|
|
data/lib/squash/ruby.rb
CHANGED
@@ -382,7 +382,7 @@ module Squash
|
|
382
382
|
|
383
383
|
def self.prepare_backtrace(bt)
|
384
384
|
if defined?(JRuby)
|
385
|
-
bt.map do |element|
|
385
|
+
bt.map(&:strip).map do |element|
|
386
386
|
if element =~ /^((?:[a-z0-9_$]+\.)*(?:[a-z0-9_$]+))\.(\w+)\((\w+.java):(\d+)\)$/i
|
387
387
|
# special JRuby backtrace element of the form "org.jruby.RubyHash$27.visit(RubyHash.java:1646)"
|
388
388
|
{
|
@@ -392,6 +392,35 @@ module Squash
|
|
392
392
|
'symbol' => $2,
|
393
393
|
'class' => $1
|
394
394
|
}
|
395
|
+
elsif element =~ /^(.+?)\.(\w+)\(Native Method\)$/
|
396
|
+
{
|
397
|
+
'type' => 'java_native',
|
398
|
+
'symbol' => $2,
|
399
|
+
'class' => $1
|
400
|
+
}
|
401
|
+
elsif element =~ /^rubyjit[$.](.+?)\$\$(\w+?[?!]?)_[0-9A-F]{40}.+?__(?:file|ensure)__\.call\(.+\)$/
|
402
|
+
{
|
403
|
+
'type' => 'jruby_block',
|
404
|
+
'class' => $1,
|
405
|
+
'symbol' => $2
|
406
|
+
}
|
407
|
+
elsif element =~ /^rubyjit[$.](.+?)\$\$(\w+?[?!]?)_[0-9A-F]{40}.+?__(?:file|ensure)__\((.+?):(\d+)\)$/
|
408
|
+
{
|
409
|
+
'file' => $3,
|
410
|
+
'line' => $4.to_i,
|
411
|
+
'symbol' => "#{$1}##{$2}"
|
412
|
+
}
|
413
|
+
elsif element =~ /^.+\.call\(.+?(\w+)\.gen\)$/
|
414
|
+
{
|
415
|
+
'type' => 'asm_invoker',
|
416
|
+
'file' => $1 + '.gen'
|
417
|
+
}
|
418
|
+
elsif element =~ /^rubyjit[$.](.+?)\$\$(\w+?[?!]?)_[0-9A-F]{40}.+?__(?:file|ensure)__\((.+?)\)$/
|
419
|
+
{
|
420
|
+
'file' => $3,
|
421
|
+
'type' => 'jruby_noline',
|
422
|
+
'symbol' => "#{$1}##{$2}"
|
423
|
+
}
|
395
424
|
else
|
396
425
|
if element.include?(' at ')
|
397
426
|
method, fileline = element.split(' at ')
|
@@ -460,16 +489,19 @@ module Squash
|
|
460
489
|
elsif instance.kind_of?(Array) && elements_only
|
461
490
|
instance.map { |i| valueify(i) }
|
462
491
|
else
|
463
|
-
filtered
|
464
|
-
yaml
|
465
|
-
json
|
492
|
+
filtered = value_filter(instance)
|
493
|
+
yaml = begin filtered.to_yaml; rescue Exception; nil end
|
494
|
+
json = begin filtered.to_json; rescue Exception; nil end
|
495
|
+
inspect_result = begin filtered.inspect; rescue Exception => e; "[#{e.class}: #{e} raised when calling #inspect]" end
|
496
|
+
to_s_result = begin filtered.to_s; rescue Exception => e; "[#{e.class}: #{e} raised when calling #to_s]" end
|
497
|
+
|
466
498
|
{
|
467
499
|
'language' => 'ruby',
|
468
500
|
'class_name' => filtered.class.to_s,
|
469
|
-
'inspect' =>
|
501
|
+
'inspect' => inspect_result,
|
470
502
|
'yaml' => yaml,
|
471
503
|
'json' => json,
|
472
|
-
'to_s' =>
|
504
|
+
'to_s' => to_s_result
|
473
505
|
}
|
474
506
|
end
|
475
507
|
end
|
@@ -530,7 +562,9 @@ module Squash
|
|
530
562
|
|
531
563
|
# @private
|
532
564
|
def self.current_revision
|
533
|
-
revision = if configuration(:
|
565
|
+
revision = if configuration(:revision)
|
566
|
+
configuration(:revision)
|
567
|
+
elsif configuration(:revision_file)
|
534
568
|
File.read(configuration(:revision_file)).chomp.strip
|
535
569
|
else
|
536
570
|
head_file = File.join(configuration(:repository_root), '.git', 'HEAD')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squash_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Morgan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-02-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|