trackets 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/trackets/middleware/rack_exception_handler.rb +20 -2
- data/lib/trackets/railtie.rb +0 -1
- data/lib/trackets/version.rb +1 -1
- data/lib/trackets.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 672666de6f3aa1d0a7cd8864000996cc3b510582
|
4
|
+
data.tar.gz: e4a847516c94688548110edccc542c886175f808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a6b18843d0be48d895cff4cb2a18efd0935fc34f47a5b8e7753f0fd7cebaeafa9091720a3032542ba62b176f4a5ae0efb71b1af5873a314b57386e22ba3d3b
|
7
|
+
data.tar.gz: b2cde6f4ff46f8cab19bb1a8faf5e1bcfe475b89b9c6ee5d58d4854c368aa6699277794fca4c4a7c43a4748431e3ceeb7993e5c80c3ebe7b976d3d77ccc75c78
|
data/README.md
CHANGED
@@ -15,6 +15,7 @@ And then execute:
|
|
15
15
|
## Usage
|
16
16
|
|
17
17
|
$ rails g trackets:install API_KEY
|
18
|
+
$ rake trackets:test # To send testing exception
|
18
19
|
|
19
20
|
## Rails
|
20
21
|
|
@@ -24,6 +25,29 @@ To include JavaScript tracking code in your app just add this line to your `app/
|
|
24
25
|
<%= trackets_include_tag %>
|
25
26
|
```
|
26
27
|
|
28
|
+
## Rack
|
29
|
+
|
30
|
+
Simple `example.ru`
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
require 'rack'
|
34
|
+
require 'trackets'
|
35
|
+
|
36
|
+
Trackets.setup do |config|
|
37
|
+
config.api_key = "insert-valid-api-key"
|
38
|
+
end
|
39
|
+
|
40
|
+
app = Rack::Builder.app do
|
41
|
+
run lambda { |env| raise "Testing Error" }
|
42
|
+
end
|
43
|
+
|
44
|
+
use Trackets::Middleware::RackExceptionHandler
|
45
|
+
run app
|
46
|
+
```
|
47
|
+
|
48
|
+
## Rake tasks
|
49
|
+
$ rake trackets:notify MESSAGE="Custom message from Rake"
|
50
|
+
|
27
51
|
## Contributing
|
28
52
|
|
29
53
|
1. Fork it ( https://github.com/[my-github-username]/trackets/fork )
|
@@ -1,3 +1,21 @@
|
|
1
|
+
# Middleware for Rack applications
|
2
|
+
#
|
3
|
+
# Example of a basic Rack app
|
4
|
+
#
|
5
|
+
# require 'rack'
|
6
|
+
# require 'trackets'
|
7
|
+
#
|
8
|
+
# Trackets.setup do |config|
|
9
|
+
# config.api_key = "insert-valid-api-key"
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# app = Rack::Builder.app do
|
13
|
+
# run lambda { |env| raise "Testing Error" }
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# use Trackets::Middleware::RackExceptionHandler
|
17
|
+
# run app
|
18
|
+
|
1
19
|
module Trackets
|
2
20
|
module Middleware
|
3
21
|
class RackExceptionHandler
|
@@ -8,9 +26,9 @@ module Trackets
|
|
8
26
|
|
9
27
|
def call(env)
|
10
28
|
response = @app.call(env)
|
11
|
-
rescue
|
29
|
+
rescue Exception => exception
|
12
30
|
Trackets.notify(exception, env)
|
13
|
-
raise
|
31
|
+
raise
|
14
32
|
end
|
15
33
|
|
16
34
|
end
|
data/lib/trackets/railtie.rb
CHANGED
data/lib/trackets/version.rb
CHANGED
data/lib/trackets.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Votava
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|