trackets 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7d548db30dc736130eda8fc2b503d74b43a467b
4
- data.tar.gz: 8b35ff2ab836564178cc7a745acf582f41484f5a
3
+ metadata.gz: 7a1a1bb64fefef5fed193ddc3bcaf4fadae73357
4
+ data.tar.gz: 0637da6c7ebeaada21f452977c4ec89d455b3f6c
5
5
  SHA512:
6
- metadata.gz: 8c631c43b76d4c45a27bdb357ec3d39bf23eb80068ae1bee9f7cd4dd4f65fcf7883e8329b5bc5791a621582e5f9958be8272e57f25890d49e98ca065ad7bb95b
7
- data.tar.gz: ce27dad218703ac4153629e0d64484b96b430962e380909cb1a56ecfd80c6ff33f86decebadcbf60d51281e30266e917522bc60aa0aba8d789a13a141acab291
6
+ metadata.gz: bdb504ecf7ebb7d08689c6048d5d143806c6ad9eb49a6695560683ac1ff5dfdeb5ceeba58080eef722b01b4c5ab5a8a5b5d3f6883a7045c5dc9e481e3df92dc0
7
+ data.tar.gz: c7d041c91ea0c9a6fb9b70e0eb1a8a7a2e2ed48b0ac07c7928aacf4d5c81f20a8d8c790a1785f12857ff6c4e9125b1c0408f1a9fb59c2b5887e96afade945c17
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Jan Votava
1
+ Copyright (c) 2014 Trackets.com
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # Trackets [![Build Status](https://travis-ci.org/sensible/trackets-ruby.svg?branch=master)](https://travis-ci.org/sensible/trackets-ruby)
1
+ # Trackets [![Build Status](https://travis-ci.org/sensible/trackets-ruby.svg?branch=master)](https://travis-ci.org/sensible/trackets-ruby) [![Code Climate](https://codeclimate.com/github/sensible/trackets-ruby.png)](https://codeclimate.com/github/sensible/trackets-ruby)
2
2
 
3
- WIP gem for Trackets.com service
3
+ This is a notification gem for [Trackets.com](https://trackets.com). It
4
+ catches all unhandled exceptions and sends them to the Trackets
5
+ servers.
4
6
 
5
7
  ## Installation
6
8
 
@@ -14,15 +16,30 @@ And then execute:
14
16
 
15
17
  ## Usage
16
18
 
17
- $ rails g trackets:install API_KEY
19
+ In order to setup Trackets for Ruby, you need to first find your API
20
+ key. To do this simply [open up your project](https://trackets.com/projects)
21
+ on Trackets, go to settings and copy the API key.
22
+
23
+ $ rails g trackets:install YOUR_API_KEY
18
24
  $ rake trackets:test # To send testing exception
19
25
 
20
- ## Rails
26
+ ## JavaScript
21
27
 
22
- To include JavaScript tracking code in your app just add this line to your `app/views/layout/application.html.erb`
28
+ If you wish to enable JavaScript error tracking, you can do so using a
29
+ helper which this gem provides. **Simply include the following snippet in
30
+ your `app/views/layout/application.html.erb` in the `<head>` tag
31
+ directly above your application JavaScript.**
23
32
 
24
33
  ```erb
25
- <%= trackets_include_tag %>
34
+ <head>
35
+ <%= trackets_include_tag %>
36
+
37
+ <!-- The rest of your JavaScript goes below -->
38
+
39
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
40
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
41
+ ...
42
+ </head>
26
43
  ```
27
44
 
28
45
  ### Configuration
@@ -38,7 +55,7 @@ end
38
55
 
39
56
  ## Rack
40
57
 
41
- Simple `example.ru`
58
+ Here's a sample `config.ru`
42
59
 
43
60
  ```ruby
44
61
  require 'rack'
@@ -57,6 +74,11 @@ run app
57
74
  ```
58
75
 
59
76
  ## Rake tasks
77
+
78
+ Currently there is only one rake task for testing the setup by sending
79
+ an exception to Trackets. You can do this simply by invoking `rake
80
+ trackets:notify` in your application after you've installed the gem.
81
+
60
82
  $ rake trackets:notify MESSAGE="Custom message from Rake"
61
83
 
62
84
  ## Contributing
@@ -12,6 +12,7 @@ When(/^I configure an app to use Trackets$/) do
12
12
 
13
13
  additions =<<-EOS
14
14
  config.api_url = "http://trackets.com"
15
+ config.enabled_env << :development << :test
15
16
  EOS
16
17
 
17
18
  replace_in_file(File.join(@dirs, "config", "initializers", "trackets.rb"), /^end$/, "#{additions}\nend")
@@ -2,7 +2,7 @@ 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/plugins/sidekiq"
5
+ require "trackets/plugins/loader"
6
6
  require "trackets/jobs/notice_job"
7
7
 
8
8
  module Trackets
@@ -11,7 +11,7 @@ module Trackets
11
11
  def setup
12
12
  yield(configuration)
13
13
 
14
- Plugins::Sidekiq.new if defined?(::Sidekiq)
14
+ Plugins::Loader.new
15
15
  end
16
16
 
17
17
  def configuration
@@ -19,6 +19,8 @@ module Trackets
19
19
  end
20
20
 
21
21
  def notify(exception, env = nil)
22
+ return unless Trackets.configuration.enabled?
23
+
22
24
  job = NoticeJob.new
23
25
  job = job.async if Trackets.configuration.async?
24
26
 
@@ -24,10 +24,12 @@ module Trackets
24
24
  "ORIGINAL_FULLPATH"
25
25
  ].freeze
26
26
  DEFAULT_BLACKLISTED_PARAMS = ["password", "password_confirmation", "card_number", "cvv"].freeze
27
-
28
27
  DEFAULT_API_URL = "https://trackets.com"
28
+ DEFAULT_LOAD_PLUGINS = [:sidekiq]
29
+ DEFAULT_ENABLED_ENV = [:production]
29
30
 
30
- attr_accessor :api_url, :api_key, :environment_name, :project_root, :framework, :whitelisted_env, :blacklisted_params, :async
31
+ attr_accessor :api_url, :api_key, :environment_name, :project_root, :framework, :whitelisted_env, :blacklisted_params, :async,
32
+ :load_plugins, :enabled_env
31
33
  alias_method :async?, :async
32
34
 
33
35
  def initialize
@@ -35,6 +37,8 @@ module Trackets
35
37
  @whitelisted_env = DEFAULT_WHITELISTED_ENV_KEYS
36
38
  @blacklisted_params = DEFAULT_BLACKLISTED_PARAMS
37
39
  @async = false
40
+ @load_plugins = DEFAULT_LOAD_PLUGINS
41
+ @enabled_env = DEFAULT_ENABLED_ENV
38
42
  end
39
43
 
40
44
  def rack_filter_keys(rack_env = nil)
@@ -49,5 +53,9 @@ module Trackets
49
53
  blacklisted_keys.include?(key)
50
54
  end
51
55
 
56
+ def enabled?
57
+ enabled_env.include?(environment_name.to_sym)
58
+ end
59
+
52
60
  end
53
61
  end
@@ -0,0 +1,16 @@
1
+ module Trackets
2
+ module Plugins
3
+ class Loader
4
+
5
+ def initialize
6
+ Trackets.configuration.load_plugins.each do |plugin_name|
7
+ require "trackets/plugins/#{plugin_name}"
8
+
9
+ class_name = plugin_name.to_s.split('_').map{|e| e.capitalize}.join
10
+ Trackets::Plugins.const_get(class_name).new
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -3,8 +3,10 @@ module Trackets
3
3
  class Sidekiq
4
4
 
5
5
  def initialize
6
- ::Sidekiq.configure_server do |config|
7
- config.error_handlers << Proc.new {|ex,ctx_hash| Trackets.notify(ex) }
6
+ if defined?(::Sidekiq)
7
+ ::Sidekiq.configure_server do |config|
8
+ config.error_handlers << Proc.new {|ex,ctx_hash| Trackets.notify(ex) }
9
+ end
8
10
  end
9
11
  end
10
12
 
@@ -1,3 +1,3 @@
1
1
  module Trackets
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,7 +1,11 @@
1
1
  module Trackets
2
2
  module ViewHelpers
3
+
3
4
  def trackets_include_tag
4
- javascript_include_tag "//trackets.s3.amazonaws.com/client.js", data: { "trackets-key" => Trackets.configuration.api_key }
5
+ if Trackets.configuration.enabled?
6
+ javascript_include_tag "//trackets.s3.amazonaws.com/client.js", data: { "trackets-key" => Trackets.configuration.api_key }
7
+ end
5
8
  end
9
+
6
10
  end
7
11
  end
@@ -6,11 +6,11 @@ require 'trackets/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "trackets"
8
8
  spec.version = Trackets::VERSION
9
- spec.authors = ["Jan Votava"]
10
- spec.email = ["votava@deployment.cz"]
9
+ spec.authors = ["Trackets"]
10
+ spec.email = ["info@trackets.com"]
11
11
  spec.summary = %q{Trackets.com Ruby support GEM}
12
12
  spec.description = %q{Helpers for Trackets.com error tracking service}
13
- spec.homepage = "http://www.trackets.com"
13
+ spec.homepage = "https://trackets.com"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
- - Jan Votava
7
+ - Trackets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
11
+ date: 2014-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: '0'
139
139
  description: Helpers for Trackets.com error tracking service
140
140
  email:
141
- - votava@deployment.cz
141
+ - info@trackets.com
142
142
  executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
@@ -167,13 +167,14 @@ files:
167
167
  - lib/trackets/middleware/rack_exception_handler.rb
168
168
  - lib/trackets/null_env.rb
169
169
  - lib/trackets/params.rb
170
+ - lib/trackets/plugins/loader.rb
170
171
  - lib/trackets/plugins/sidekiq.rb
171
172
  - lib/trackets/rack_env_sanitizer.rb
172
173
  - lib/trackets/railtie.rb
173
174
  - lib/trackets/version.rb
174
175
  - lib/trackets/view_helpers.rb
175
176
  - trackets.gemspec
176
- homepage: http://www.trackets.com
177
+ homepage: https://trackets.com
177
178
  licenses:
178
179
  - MIT
179
180
  metadata: {}