bug_hunter 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/bug_hunter.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bug_hunter}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David A. Cuadrado"]
12
- s.date = %q{2011-05-28}
12
+ s.date = %q{2011-05-29}
13
13
  s.default_executable = %q{bug_hunter}
14
14
  s.description = %q{sinatra app to manage web app exceptions}
15
15
  s.email = %q{krawek@gmail.com}
@@ -62,6 +62,12 @@ module BugHunter
62
62
  @error = BugHunter::Error.minimal.find(params[:id])
63
63
  @error.resolve!
64
64
 
65
+ if params[:include_similar] == "1"
66
+ @error.similar_errors.each do |err|
67
+ err.resolve!
68
+ end
69
+ end
70
+
65
71
  redirect error_path(@error)
66
72
  end
67
73
 
@@ -49,7 +49,7 @@ module BugHunter
49
49
  end
50
50
 
51
51
  def similar_errors
52
- self.class.where(:message => unique_error_selector[:message], :_id.ne => self.id)
52
+ self.class.where(:message => partial_message, :_id.ne => self.id)
53
53
  end
54
54
 
55
55
  def add_comment(from, message, ip)
@@ -81,20 +81,33 @@ module BugHunter
81
81
  end
82
82
 
83
83
  def unique_error_selector
84
- msg = self[:message]
85
- if msg.match(/#<.+>/)
86
- msg = /^#{Regexp.escape($`)}/
87
- end
88
-
89
84
  {
90
85
  :resolved => false,
91
- :message => msg,
86
+ :message => partial_message,
92
87
  :file => self.file,
93
88
  :line => self.line,
94
89
  :method => self.method
95
90
  }
96
91
  end
97
92
 
93
+ def partial_message(regex = true)
94
+ msg = self[:message]
95
+ if msg.match(/#<.+>/) && $`.length > 10
96
+ if regex
97
+ msg = /^#{Regexp.escape($`)}/
98
+ else
99
+ msg = $`
100
+ end
101
+ elsif msg.match(/\{.+\}/) && $`.length > 10
102
+ if regex
103
+ msg = /^#{Regexp.escape($`)}/
104
+ else
105
+ msg = $`
106
+ end
107
+ end
108
+
109
+ msg
110
+ end
98
111
 
99
112
  def self.build_from(env, exception)
100
113
  doc = self.new
@@ -80,3 +80,8 @@
80
80
  -else
81
81
  %a(href="#{error_path(@error)}/resolve" data-icon="check" data-theme="e")
82
82
  Resolve this error
83
+ %a(href="#{error_path(@error)}/resolve?include_similar=1" data-icon="alert" data-theme="d")
84
+ Resolve all similar errors
85
+
86
+ %a(href="http://google.com/search?q=#{@error.partial_message(false).gsub(" ", "+")}" data-icon="search" data-theme="c" rel="external" target="_blank")
87
+ Google This Error
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - David A. Cuadrado
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-28 00:00:00 -05:00
17
+ date: 2011-05-29 00:00:00 -05:00
18
18
  default_executable: bug_hunter
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -231,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  requirements:
232
232
  - - ">="
233
233
  - !ruby/object:Gem::Version
234
- hash: 3061019457110582907
234
+ hash: -1435399183817290328
235
235
  segments:
236
236
  - 0
237
237
  version: "0"