lena 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lena.coffee +4 -7
- data/app/controllers/lena/lena_controller.rb +2 -2
- data/config/routes.rb +1 -1
- data/lib/lena/engine.rb +3 -3
- data/lib/lena/routing.rb +1 -1
- data/lib/lena/version.rb +1 -1
- data/spec/dummy/log/test.log +956 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1c6fd1c437c9411ba952f11bacc0320f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b7a52d401e731277ea560db378ef97c3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/features/lena_spec.rb +42 -22
- metadata +2 -5
- data/README.rdoc +0 -48
- data/spec/dummy/config/initializers/lena.rb +0 -10
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/features/lena_spec.rb
CHANGED
@@ -1,30 +1,50 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe '
|
4
|
-
it 'includes data attributes' do
|
5
|
-
visit root_path
|
6
|
-
expect(page.body).to include('data-lena-url')
|
7
|
-
expect(page.body).to include('data-lena-destination')
|
8
|
-
end
|
3
|
+
describe 'lena test app' do
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
expect(event[:stacktrace]).to eq("unsupported")
|
5
|
+
context 'with default capture' do
|
6
|
+
it 'throws exceptions' do
|
7
|
+
expect { visit lena.report_path }.to raise_error(Lena::ClientError)
|
8
|
+
end
|
15
9
|
end
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
context 'with custom capture', js: true do
|
12
|
+
before do
|
13
|
+
@report_handler = Lena::Engine.config.report_handler
|
14
|
+
@events = []
|
15
|
+
handler = Proc.new { |params| @events << params }
|
16
|
+
Lena.setup { |config| config.report_handler = handler }
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
Lena::Engine.config.report_handler = @report_handler
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'includes data attributes' do
|
24
|
+
visit root_path
|
25
|
+
expect(page.body).to include('data-lena-remote-url')
|
26
|
+
expect(page.body).to include('data-lena-destination')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'reports errors for log' do
|
30
|
+
expect { visit log_path }.to change { @events.length }.by(1)
|
31
|
+
event = @events[-1]
|
32
|
+
expect(event[:message]).to eq("Simple error log")
|
33
|
+
expect(event[:stacktrace]).to eq("unsupported")
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'reports errors for exceptions' do
|
37
|
+
expect { visit throw_path }.to change { @events.length }.by(1)
|
38
|
+
event = @events[-1]
|
39
|
+
expect(event[:message]).to eq("Error: Simple error throw\nResource: undefined:0")
|
40
|
+
expect(event[:stacktrace]).to be_nil
|
41
|
+
end
|
23
42
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
43
|
+
it 'reports errors when nested, but cannot provide stack trace' do
|
44
|
+
expect { visit throw_callstack_path }.to change { @events.length }.by(1)
|
45
|
+
event = @events[-1]
|
46
|
+
expect(event[:message]).to eq("ReferenceError: Can't find variable: undefinedFunctionCall\nResource: undefined:0")
|
47
|
+
expect(event[:stacktrace]).to be_nil
|
48
|
+
end
|
29
49
|
end
|
30
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lena
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Whitney Young
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -139,7 +139,6 @@ files:
|
|
139
139
|
- lib/lena.rb
|
140
140
|
- MIT-LICENSE
|
141
141
|
- Rakefile
|
142
|
-
- README.rdoc
|
143
142
|
- spec/dummy/app/assets/javascripts/application.js
|
144
143
|
- spec/dummy/app/controllers/application_controller.rb
|
145
144
|
- spec/dummy/app/views/application/index.html
|
@@ -155,7 +154,6 @@ files:
|
|
155
154
|
- spec/dummy/config/environment.rb
|
156
155
|
- spec/dummy/config/environments/development.rb
|
157
156
|
- spec/dummy/config/environments/test.rb
|
158
|
-
- spec/dummy/config/initializers/lena.rb
|
159
157
|
- spec/dummy/config/initializers/secret_token.rb
|
160
158
|
- spec/dummy/config/routes.rb
|
161
159
|
- spec/dummy/config.ru
|
@@ -216,7 +214,6 @@ test_files:
|
|
216
214
|
- spec/dummy/config/environment.rb
|
217
215
|
- spec/dummy/config/environments/development.rb
|
218
216
|
- spec/dummy/config/environments/test.rb
|
219
|
-
- spec/dummy/config/initializers/lena.rb
|
220
217
|
- spec/dummy/config/initializers/secret_token.rb
|
221
218
|
- spec/dummy/config/routes.rb
|
222
219
|
- spec/dummy/config.ru
|
data/README.rdoc
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
= Leña {<img src="https://secure.travis-ci.org/wbyoung/lena.png"/>}[http://travis-ci.org/wbyoung/lena] {<img src="https://codeclimate.com/github/wbyoung/lena.png"/>}[https://codeclimate.com/github/wbyoung/lena] {<img src="https://coveralls.io/repos/wbyoung/lena/badge.png"/>}[https://coveralls.io/r/wbyoung/lena]
|
2
|
-
|
3
|
-
Leña provides simple server-side JavaScript error logging for production Rails applications. This allows you to better track errors that occur in your front-end code.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
Add the following to your +application.js+:
|
8
|
-
|
9
|
-
//= require lena
|
10
|
-
|
11
|
-
Add the following to your +routes.rb+:
|
12
|
-
|
13
|
-
mount Lena::Engine => "/lena"
|
14
|
-
|
15
|
-
Update your +application.html.erb+:
|
16
|
-
|
17
|
-
<%= javascript_include_tag "application", lena.configuration %>
|
18
|
-
|
19
|
-
If you use Turbolinks or provide other options for your javascript include, you can merge them: <tt>lena.configuration.merge("data-something" => true)</tt>.
|
20
|
-
|
21
|
-
== Usage Client Side
|
22
|
-
|
23
|
-
Leña will now track all exceptions that are thrown in your application. You can also use Leña to log individual errors without throwing an exception. In your JavaScript, simply:
|
24
|
-
|
25
|
-
lena.log('My Error Message')
|
26
|
-
|
27
|
-
== Usage Server Side
|
28
|
-
|
29
|
-
Leña will simply throw an exception, <tt>Lena::JavaScriptError</tt>, when it receives a log message. Why? Because you should be using {something}[https://github.com/smartinez87/exception_notification] to report server errors when they occur. Also that's basically what's happening on the client side, so why not throw an exception on the server?
|
30
|
-
|
31
|
-
If you need to configure what Leña does, you can add +config/initializers/lena.rb+:
|
32
|
-
|
33
|
-
Lena.setup do |config|
|
34
|
-
config.javascript_handler = Proc.new do |params|
|
35
|
-
# Custom handling of log message here
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
== Alternative Setup
|
41
|
-
|
42
|
-
An alternative to setting up Leña on your +application.js+ file is to import Leña separately. This may impact performance, but it will catch compiler errors in any scripts included after it:
|
43
|
-
|
44
|
-
<%= javascript_include_tag "lena", lena.configuration %>
|
45
|
-
|
46
|
-
== License
|
47
|
-
|
48
|
-
This project is distributed under the MIT-LICENSE.
|