open_exception 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +60 -1
- data/VERSION +1 -1
- data/open_exception.gemspec +2 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -12,23 +12,82 @@ in your application code when the exception occurs in a framework or lib.
|
|
12
12
|
If you are on MacOSX and have the [growl gem](http://rubygems.org/gems/growl) installed,
|
13
13
|
you will get a growl notification with the exception message when the file is opened.
|
14
14
|
|
15
|
+
Editors
|
16
|
+
-------
|
17
|
+
|
18
|
+
Out if the box, the gem supports three editors (with the following open commands):
|
19
|
+
|
20
|
+
:emacs => '/usr/bin/emacsclient -n +{line} {file}',
|
21
|
+
:textmate => '/usr/local/bin/mate -a -d -l {line} {file}',
|
22
|
+
:macvim => '/usr/local/bin/mvim +{line} {file}'
|
23
|
+
|
24
|
+
Note: if using emacs, you will need to be running `emacsserver`. To start the server:
|
25
|
+
M-x server-start
|
26
|
+
or add the following to your init:
|
27
|
+
(server-start)
|
28
|
+
|
15
29
|
Configuration
|
16
30
|
-------------
|
17
31
|
|
18
32
|
To configure, pass a block to the configure method:
|
19
33
|
|
20
34
|
OpenException.configure do |oe|
|
35
|
+
# open_with can be one of the built in editors (:emacs, :macvim, :textmate)
|
36
|
+
# or a command to execute to open the file, where {file} and {line} will be replaced
|
37
|
+
# with the file path and line number, respectively. See 'Editors' above for an example.
|
38
|
+
# The default editor is :emacs.
|
39
|
+
|
21
40
|
oe.open_with = :emacs
|
41
|
+
|
42
|
+
# you can add exclusion filters to ignore exceptions. A filter can be an exception class to
|
43
|
+
# ignore, or a proc that is passed the exception, and should evaluate to true if the exception
|
44
|
+
# should be ignored. Be careful with using a class - it uses is_a?, so any subclasses of the
|
45
|
+
# passed class will be ignored as well. The list of filters is [] by default.
|
46
|
+
|
47
|
+
oe.exclusion_filters << SomeErrorClass
|
48
|
+
oe.exclusion_filters << lambda { |exception| true if exception_should_be_excluded }
|
49
|
+
|
50
|
+
# you can scope the search for the file:line to open with a filter as well. A filter can be a
|
51
|
+
# regular expression that is matched against the line, or a proc that is passed the line and
|
52
|
+
# should evaluate to true if the line should be used. The first line that any filter passes for
|
53
|
+
# will be the file:line that is opened. This is useful for opening the point in the stack just
|
54
|
+
# before control passes out of your app code when the exception occurs in an external
|
55
|
+
# lib/framework. The list of filters is [] by default.
|
56
|
+
|
57
|
+
oe.backtrace_line_filters << %r{/app/root/(app|lib)}
|
58
|
+
oe.backtrace_line_filters << lambda { |backtrace_line| true if line_should_be_used }
|
59
|
+
|
22
60
|
end
|
23
61
|
|
62
|
+
|
24
63
|
Rails Integration
|
25
64
|
-----------------
|
26
65
|
|
27
|
-
|
66
|
+
The gem also alias chains in to rails' `ActionController#rescue_action_locally` method to automatically
|
67
|
+
open exceptions in development mode. The gem also adds the following filter to the `:backtrace_line_filters` to scope the opened files to the app:
|
68
|
+
|
69
|
+
%r{#{Rails.root}/(app|lib)}
|
70
|
+
|
71
|
+
To replace or remove this filter, you will need to reset the `:backtrace_line_filters` in your configure
|
72
|
+
block:
|
73
|
+
OpenException.configure do |oe|
|
74
|
+
oe.backtrace_line_filters = []
|
75
|
+
oe.backtrace_line_filters << my_new_filter
|
76
|
+
end
|
77
|
+
|
78
|
+
This has been tested with rails v2.3.5, but should work fine with 2.1 <= rails < 3. It may work with
|
79
|
+
rails 3 as well, I just haven't yet looked at rails 3.
|
28
80
|
|
29
81
|
Standalone/Other Frameworks
|
30
82
|
---------------------------
|
31
83
|
|
84
|
+
To manually open an exception, or wire it up in another framework, you call:
|
85
|
+
|
86
|
+
OpenException.open(exception)
|
87
|
+
|
88
|
+
You can override the default (or configured) options by passing a hash as the second arg:
|
89
|
+
|
90
|
+
OpenException.open(exception, {:open_with => :textmate, :backtrace_line_filters => [filter, another_filter])
|
32
91
|
|
33
92
|
Note on Patches/Pull Requests
|
34
93
|
-----------------------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/open_exception.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{open_exception}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tobias Crawley"]
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
22
|
"LICENSE",
|
23
|
+
"README.md",
|
23
24
|
"Rakefile",
|
24
25
|
"VERSION",
|
25
26
|
"lib/open_exception.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tobias Crawley
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- .document
|
45
45
|
- .gitignore
|
46
46
|
- LICENSE
|
47
|
+
- README.md
|
47
48
|
- Rakefile
|
48
49
|
- VERSION
|
49
50
|
- lib/open_exception.rb
|
@@ -54,7 +55,6 @@ files:
|
|
54
55
|
- spec/open_exception_spec.rb
|
55
56
|
- spec/spec.opts
|
56
57
|
- spec/spec_helper.rb
|
57
|
-
- README.md
|
58
58
|
has_rdoc: true
|
59
59
|
homepage: http://github.com/tobias/open_exception
|
60
60
|
licenses: []
|