asana_exception_notifier 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/asana_exception_notifier.gemspec +1 -1
- data/lib/asana_exception_notifier/version.rb +1 -1
- data/spec/manual_tests/subscribers/base.rb +20 -0
- data/spec/manual_tests/subscribers/metrics.rb +18 -0
- data/spec/manual_tests/test_notification.rb +43 -0
- metadata +12 -12
- data/spec/subscribers/base.rb +0 -16
- data/spec/subscribers/metrics.rb +0 -14
- data/spec/test_notification.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa87992120947537e88ed0a57ece081af0956d7c
|
4
|
+
data.tar.gz: f3f6796daf10ce205baff850595b10e457bc4eb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 540f261a4d38ee7698df548166dd1a57023a05b297be4abb3c8933d422f9d771768c9800e48cf6c0fa79b6f762ba5642b1d1f2074a0ffb819744db199775dd23
|
7
|
+
data.tar.gz: de084279d2b3dea1231d088a133af6007e8cd67ecaf225e1f01def94c65df12f4dd8cbc3d51077755ba9c826d0ddda2d479b3308c417ea1f438970d467405dbe
|
data/.travis.yml
CHANGED
@@ -31,6 +31,12 @@ matrix:
|
|
31
31
|
gemfile: gemfiles/rails_4.1.1.gemfile
|
32
32
|
- rvm: 2.4.0
|
33
33
|
gemfile: gemfiles/rails_4.2.0.gemfile
|
34
|
+
- rvm: 2.4.1
|
35
|
+
gemfile: gemfiles/rails_4.0.0.gemfile
|
36
|
+
- rvm: 2.4.1
|
37
|
+
gemfile: gemfiles/rails_4.1.1.gemfile
|
38
|
+
- rvm: 2.4.1
|
39
|
+
gemfile: gemfiles/rails_4.2.0.gemfile
|
34
40
|
rvm:
|
35
41
|
- 2.2.2
|
36
42
|
- 2.2.5
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency 'typhoeus', '~> 1.1', '>= 1.1.2'
|
32
32
|
s.add_runtime_dependency 'exception_notification', '~> 4.2', '>= 4.2.1'
|
33
33
|
s.add_runtime_dependency 'tilt', '>= 1.4', '< 3'
|
34
|
-
s.add_runtime_dependency 'rack', '>= 1.5', '
|
34
|
+
s.add_runtime_dependency 'rack', '>= 1.5', '< 3.0'
|
35
35
|
s.add_runtime_dependency 'rubyzip', '~> 1.2', '>= 1.2.0' # will load new rubyzip version
|
36
36
|
s.add_runtime_dependency 'zip-zip', '~> 0.3', '>= 0.3' # will load compatibility for old rubyzip API
|
37
37
|
s.add_runtime_dependency 'sys-uname', '~> 1.0', '>= 1.0.3'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# IMPORTANT !!!! DON'T use code from this file , this is done so that manually testing the gem would be easier.
|
2
|
+
# Manual tests are done with command: ruby spec/manual_tests/test_notification.rb , which should send a notification to Asana
|
3
|
+
# about an error occuring , if the system has configured properly the ASANA_API_KEY and ASANA_WORKSPACE_ID environment variables
|
4
|
+
|
5
|
+
module Subscribers
|
6
|
+
class Base
|
7
|
+
|
8
|
+
attr_reader :event
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
12
|
+
process
|
13
|
+
end
|
14
|
+
|
15
|
+
def process
|
16
|
+
raise NotImplementedError
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# IMPORTANT !!!! DON'T use code from this file , this is done so that manually testing the gem would be easier.
|
2
|
+
# Manual tests are done with command: ruby spec/manual_tests/test_notification.rb , which should send a notification to Asana
|
3
|
+
# about an error occuring , if the system has configured properly the ASANA_API_KEY and ASANA_WORKSPACE_ID environment variables
|
4
|
+
|
5
|
+
require_relative './base'
|
6
|
+
module Subscribers
|
7
|
+
class Metrics < Base
|
8
|
+
|
9
|
+
def process
|
10
|
+
payload = event.payload
|
11
|
+
dur = event.duration
|
12
|
+
url = payload[:url]
|
13
|
+
http_method = payload[:method].to_s.upcase
|
14
|
+
$stderr.puts '[%s] %s %s (%.3f s)' % [url.host, http_method, url.request_uri, dur]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative '../../lib/asana_exception_notifier'
|
2
|
+
|
3
|
+
# IMPORTANT !!!! DON'T use code from this file , this is done so that manually testing the gem would be easier.
|
4
|
+
# Manual tests are done with command: ruby spec/manual_tests/test_notification.rb , which should send a notification to Asana
|
5
|
+
# about an error occuring , if the system has configured properly the ASANA_API_KEY and ASANA_WORKSPACE_ID environment variables
|
6
|
+
|
7
|
+
|
8
|
+
# DON'T use this Code from this file. This is done so that manual testing the gem would be easier.
|
9
|
+
# The initialize method is overriden here so that we can see the resulting HTML generated before it gets archived
|
10
|
+
# This helps when modifying the error page template manually and trying to see if the result is the expected one.
|
11
|
+
AsanaExceptionNotifier::ErrorPage.class_eval do
|
12
|
+
alias_method :original_initialize, :initialize
|
13
|
+
|
14
|
+
def initialize(*args)
|
15
|
+
original_initialize(*args)
|
16
|
+
debug_html_template if ENV['DEBUG_ASANA_TEMPLATE']
|
17
|
+
end
|
18
|
+
|
19
|
+
def debug_html_template
|
20
|
+
_filename, path = create_tempfile
|
21
|
+
system("google-chrome #{path}")
|
22
|
+
sleep until 0 == 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# DON'T require this manually, this is done here so that the gem will be configured with defaults while manually testing the gem
|
27
|
+
# This should already be included in your app if you have followed the Readme and executed "rails g asana_exception_notifier:install"
|
28
|
+
require_relative '../../lib/generators/asana_exception_notifier/templates/asana_exception_notifier'
|
29
|
+
|
30
|
+
# Constructing the error we want to send during our manual tests
|
31
|
+
exception = StandardError.new
|
32
|
+
|
33
|
+
|
34
|
+
# FOR manual tests we are interested in duration of each request so we are registering subscribers for request.
|
35
|
+
# This should not be done for production applications. This is used only for testing connections
|
36
|
+
require_relative './subscribers/metrics'
|
37
|
+
ActiveSupport::Notifications.subscribe('request.faraday') do |*args|
|
38
|
+
Subscribers::Metrics.new(*args)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Finally send our notification manually
|
42
|
+
# This can be done manually in applications too, when rescueing from an exception
|
43
|
+
ExceptionNotifier.notify_exception(exception, notifiers: :asana)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asana_exception_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -111,9 +111,9 @@ dependencies:
|
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '1.5'
|
114
|
-
- - "
|
114
|
+
- - "<"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '3'
|
116
|
+
version: '3.0'
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -121,9 +121,9 @@ dependencies:
|
|
121
121
|
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '1.5'
|
124
|
-
- - "
|
124
|
+
- - "<"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: '3'
|
126
|
+
version: '3.0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: rubyzip
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -436,10 +436,10 @@ files:
|
|
436
436
|
- lib/generators/asana_exception_notifier/install_generator.rb
|
437
437
|
- lib/generators/asana_exception_notifier/templates/asana_exception_notifier.rb
|
438
438
|
- spec/lib/asana_exception_notifier/classes/asana_spec.rb
|
439
|
+
- spec/manual_tests/subscribers/base.rb
|
440
|
+
- spec/manual_tests/subscribers/metrics.rb
|
441
|
+
- spec/manual_tests/test_notification.rb
|
439
442
|
- spec/spec_helper.rb
|
440
|
-
- spec/subscribers/base.rb
|
441
|
-
- spec/subscribers/metrics.rb
|
442
|
-
- spec/test_notification.rb
|
443
443
|
homepage: http://github.com/bogdanRada/asana_exception_notifier
|
444
444
|
licenses:
|
445
445
|
- MIT
|
@@ -470,8 +470,8 @@ summary: Simple ruby implementation to send notifications to Asana when a except
|
|
470
470
|
to the task
|
471
471
|
test_files:
|
472
472
|
- spec/lib/asana_exception_notifier/classes/asana_spec.rb
|
473
|
+
- spec/manual_tests/subscribers/base.rb
|
474
|
+
- spec/manual_tests/subscribers/metrics.rb
|
475
|
+
- spec/manual_tests/test_notification.rb
|
473
476
|
- spec/spec_helper.rb
|
474
|
-
- spec/subscribers/base.rb
|
475
|
-
- spec/subscribers/metrics.rb
|
476
|
-
- spec/test_notification.rb
|
477
477
|
has_rdoc:
|
data/spec/subscribers/base.rb
DELETED
data/spec/subscribers/metrics.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative './base'
|
2
|
-
module Subscribers
|
3
|
-
class Metrics < Base
|
4
|
-
|
5
|
-
def process
|
6
|
-
payload = event.payload
|
7
|
-
dur = event.duration
|
8
|
-
url = payload[:url]
|
9
|
-
http_method = payload[:method].to_s.upcase
|
10
|
-
$stderr.puts '[%s] %s %s (%.3f s)' % [url.host, http_method, url.request_uri, dur]
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
data/spec/test_notification.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require_relative '../lib/asana_exception_notifier'
|
2
|
-
|
3
|
-
AsanaExceptionNotifier::ErrorPage.class_eval do
|
4
|
-
alias_method :original_initialize, :initialize
|
5
|
-
|
6
|
-
def initialize(*args)
|
7
|
-
original_initialize(*args)
|
8
|
-
debug_html_template if ENV['DEBUG_ASANA_TEMPLATE']
|
9
|
-
end
|
10
|
-
|
11
|
-
def debug_html_template
|
12
|
-
_filename, path = create_tempfile
|
13
|
-
system("google-chrome #{path}")
|
14
|
-
sleep until 0 == 1
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
require_relative '../lib/generators/asana_exception_notifier/templates/asana_exception_notifier'
|
19
|
-
exception = StandardError.new
|
20
|
-
|
21
|
-
require_relative './subscribers/metrics'
|
22
|
-
|
23
|
-
ActiveSupport::Notifications.subscribe('request.faraday') do |*args|
|
24
|
-
Subscribers::Metrics.new(*args)
|
25
|
-
end
|
26
|
-
|
27
|
-
ExceptionNotifier.notify_exception(exception, notifiers: :asana)
|