trackets 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 672666de6f3aa1d0a7cd8864000996cc3b510582
4
- data.tar.gz: e4a847516c94688548110edccc542c886175f808
3
+ metadata.gz: b7d548db30dc736130eda8fc2b503d74b43a467b
4
+ data.tar.gz: 8b35ff2ab836564178cc7a745acf582f41484f5a
5
5
  SHA512:
6
- metadata.gz: 20a6b18843d0be48d895cff4cb2a18efd0935fc34f47a5b8e7753f0fd7cebaeafa9091720a3032542ba62b176f4a5ae0efb71b1af5873a314b57386e22ba3d3b
7
- data.tar.gz: b2cde6f4ff46f8cab19bb1a8faf5e1bcfe475b89b9c6ee5d58d4854c368aa6699277794fca4c4a7c43a4748431e3ceeb7993e5c80c3ebe7b976d3d77ccc75c78
6
+ metadata.gz: 8c631c43b76d4c45a27bdb357ec3d39bf23eb80068ae1bee9f7cd4dd4f65fcf7883e8329b5bc5791a621582e5f9958be8272e57f25890d49e98ca065ad7bb95b
7
+ data.tar.gz: ce27dad218703ac4153629e0d64484b96b430962e380909cb1a56ecfd80c6ff33f86decebadcbf60d51281e30266e917522bc60aa0aba8d789a13a141acab291
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.2
7
+ gemfile:
8
+ - Gemfile
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Trackets
1
+ # Trackets [![Build Status](https://travis-ci.org/sensible/trackets-ruby.svg?branch=master)](https://travis-ci.org/sensible/trackets-ruby)
2
2
 
3
3
  WIP gem for Trackets.com service
4
4
 
@@ -25,6 +25,17 @@ To include JavaScript tracking code in your app just add this line to your `app/
25
25
  <%= trackets_include_tag %>
26
26
  ```
27
27
 
28
+ ### Configuration
29
+
30
+ Can be found in `config/initializers/trackets.rb`
31
+
32
+ ```ruby
33
+ Trackets.setup do |config|
34
+ config.api_key = "ebf6d706b29ca4e176012a3dc3b017a8" # API key for your Project
35
+ config.async = true # [Default: false] Send notification in a separate thread (Uses Sucker Punch gem)
36
+ end
37
+ ```
38
+
28
39
  ## Rack
29
40
 
30
41
  Simple `example.ru`
data/Rakefile CHANGED
@@ -1,2 +1,15 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ begin
4
+ require 'cucumber/rake/task'
5
+ rescue LoadError
6
+ $stderr.puts "Cucumber not installed, please run"
7
+ $stderr.puts "$ gem install cucumber"
8
+ exit 1
9
+ end
10
+
11
+ Cucumber::Rake::Task.new(:cucumber) do |t|
12
+ t.fork = true
13
+ end
14
+
15
+ task :default => :cucumber
@@ -51,12 +51,12 @@ end
51
51
 
52
52
  Then(/^last notice params should (?:(not ))?contain "(.*?)"$/) do |negator, string|
53
53
  if negator
54
- last_notice_serialized_data.should_not match string
54
+ expect(last_notice_serialized_data).to_not match string
55
55
  else
56
- last_notice_serialized_data.should match string
56
+ expect(last_notice_serialized_data).to match string
57
57
  end
58
58
  end
59
59
 
60
60
  Then(/^last notice params for key "(.*?)" is "(.*?)"$/) do |key, val|
61
- last_notice_params_for(key).should eq val
61
+ expect(last_notice_params_for(key)).to eq val
62
62
  end
@@ -5,5 +5,5 @@ TEMPLATES_DIR = File.join(ROOT, 'features', 'support', 'templates')
5
5
 
6
6
  Before do
7
7
  @dirs = ["tmp", "aruba"]
8
- @aruba_timeout_seconds = 5
8
+ @aruba_timeout_seconds = 15
9
9
  end
data/lib/trackets.rb CHANGED
@@ -2,13 +2,16 @@ require "trackets/version"
2
2
  require "trackets/railtie" if defined?(Rails)
3
3
  require "trackets/middleware/rack_exception_handler"
4
4
  require "trackets/configuration"
5
- require "trackets/client"
5
+ require "trackets/plugins/sidekiq"
6
+ require "trackets/jobs/notice_job"
6
7
 
7
8
  module Trackets
8
9
  class << self
9
10
 
10
11
  def setup
11
12
  yield(configuration)
13
+
14
+ Plugins::Sidekiq.new if defined?(::Sidekiq)
12
15
  end
13
16
 
14
17
  def configuration
@@ -16,7 +19,10 @@ module Trackets
16
19
  end
17
20
 
18
21
  def notify(exception, env = nil)
19
- Client.notify(exception, env)
22
+ job = NoticeJob.new
23
+ job = job.async if Trackets.configuration.async?
24
+
25
+ job.perform(exception, env)
20
26
  end
21
27
 
22
28
  class TracketsCustomException < StandardError; end
@@ -27,12 +27,14 @@ module Trackets
27
27
 
28
28
  DEFAULT_API_URL = "https://trackets.com"
29
29
 
30
- attr_accessor :api_url, :api_key, :environment_name, :project_root, :framework, :whitelisted_env, :blacklisted_params
30
+ attr_accessor :api_url, :api_key, :environment_name, :project_root, :framework, :whitelisted_env, :blacklisted_params, :async
31
+ alias_method :async?, :async
31
32
 
32
33
  def initialize
33
34
  @api_url = DEFAULT_API_URL
34
35
  @whitelisted_env = DEFAULT_WHITELISTED_ENV_KEYS
35
36
  @blacklisted_params = DEFAULT_BLACKLISTED_PARAMS
37
+ @async = false
36
38
  end
37
39
 
38
40
  def rack_filter_keys(rack_env = nil)
@@ -0,0 +1,14 @@
1
+ require "sucker_punch"
2
+ require "trackets/client"
3
+
4
+ module Trackets
5
+ class NoticeJob
6
+
7
+ include SuckerPunch::Job
8
+
9
+ def perform(exception, env)
10
+ Client.notify(exception, env)
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module Trackets
2
+ module Plugins
3
+ class Sidekiq
4
+
5
+ def initialize
6
+ ::Sidekiq.configure_server do |config|
7
+ config.error_handlers << Proc.new {|ex,ctx_hash| Trackets.notify(ex) }
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Trackets
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/trackets.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "json"
22
22
  spec.add_runtime_dependency "httparty", "~> 0.13"
23
23
  spec.add_runtime_dependency "rack"
24
+ spec.add_runtime_dependency "sucker_punch", "~> 1.0.5"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.6"
26
27
  spec.add_development_dependency "cucumber-rails", "~> 1.4.1"
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
4
+ version: 0.0.5
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-09 00:00:00.000000000 Z
11
+ date: 2014-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sucker_punch
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.5
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.5
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +144,7 @@ extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
146
  - ".gitignore"
147
+ - ".travis.yml"
133
148
  - Gemfile
134
149
  - LICENSE.txt
135
150
  - README.md
@@ -148,9 +163,11 @@ files:
148
163
  - lib/trackets/backtrace.rb
149
164
  - lib/trackets/client.rb
150
165
  - lib/trackets/configuration.rb
166
+ - lib/trackets/jobs/notice_job.rb
151
167
  - lib/trackets/middleware/rack_exception_handler.rb
152
168
  - lib/trackets/null_env.rb
153
169
  - lib/trackets/params.rb
170
+ - lib/trackets/plugins/sidekiq.rb
154
171
  - lib/trackets/rack_env_sanitizer.rb
155
172
  - lib/trackets/railtie.rb
156
173
  - lib/trackets/version.rb