-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust the backtrace to look more like rails. Adds the enhancement requested in #29. #152
Conversation
… the gem before it's file path. Adds the enhancement requested in #29.
I like it, I've been wanting to have this done myself. Thanks for the contribution. |
Adjust the backtrace to look more like rails. Adds the enhancement requested in #29.
@@ -50,7 +50,7 @@ def gem? | |||
def gem_path | |||
Gem.path.each do |path| | |||
if filename.index(path) == 0 | |||
return filename.gsub("#{path}/gems/", "(gem) ") | |||
return filename.gsub(%r{#{path}/gems/([^/]+)-([\w.]+)/}, '\1 (\2) ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if path
contains special regex characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh, you're right, the dot is especially vulnerable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me fix that in a commit, hold on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on it, don't worry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay cool, go ahead then. :) Sorry I glanced over that hole.
Oh wow, didn't think of that. Sorry about that guys. |
This reverts commit e08eccf.
As requested in issue #29, this enhances the backtrace to look more like Rails. It outputs the gem name, it's version (in parentheses) followed by the file path.