Skip to content
This repository
Browse code

Added gem backtrace pretty priting (Juan Lupión) [#1497 state:committed]

  • Loading branch information...
commit f9a02b12d15bdbd3c2ed18b16b31b712a77027bc 1 parent 4dcd8f0
David Heinemeier Hansson authored

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. 3  railties/lib/rails/backtrace_cleaner.rb
3  railties/lib/rails/backtrace_cleaner.rb
@@ -9,6 +9,8 @@ class BacktraceCleaner < ActiveSupport::BacktraceCleaner
9 9
     RAILS_NOISE  = %w( script/server )
10 10
     RUBY_NOISE   = %w( rubygems/custom_require benchmark.rb )
11 11
 
  12
+    GEMS_DIR     = Gem.default_dir
  13
+
12 14
     ALL_NOISE    = VENDOR_DIRS + SERVER_DIRS + RAILS_NOISE + RUBY_NOISE
13 15
 
14 16
     def initialize
@@ -16,6 +18,7 @@ def initialize
16 18
       add_filter   { |line| line.sub(RAILS_ROOT, '') }
17 19
       add_filter   { |line| line.sub(ERB_METHOD_SIG, '') }
18 20
       add_filter   { |line| line.sub('./', '/') } # for tests
  21
+      add_filter   { |line| line.sub(/(#{GEMS_DIR})\/gems\/([a-z]+)-([0-9.]+)\/(.*)/, '\2 (\3) \4')} # http://gist.github.com/30430
19 22
       add_silencer { |line| ALL_NOISE.any? { |dir| line.include?(dir) } }
20 23
     end
21 24
   end

0 notes on commit f9a02b1

Please sign in to comment.
Something went wrong with that request. Please try again.