asana_exception_notifier 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.travis.yml +0 -15
- data/Gemfile +1 -1
- data/Rakefile +18 -18
- data/examples/sinatra/sinatra_app.rb +2 -2
- data/lib/asana_exception_notifier/classes/asana.rb +18 -13
- data/lib/asana_exception_notifier/classes/error_page.rb +15 -6
- data/lib/asana_exception_notifier/helpers/application_helper.rb +1 -2
- data/lib/asana_exception_notifier/initializers/hash.rb +6 -2
- data/lib/asana_exception_notifier/version.rb +1 -1
- metadata +2 -5
- data/gemfiles/rails_4.0.0.gemfile +0 -8
- data/gemfiles/rails_4.1.1.gemfile +0 -8
- data/gemfiles/rails_4.2.0.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7146f3fe811fe1909ad84cc008c280b582243ac4
|
4
|
+
data.tar.gz: ed259cf7bde745cca8e6216f3ed4f74feee61c69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa1c417b693b4cd76af610efd4899d549711d528ab29d40a558e503799782a640ebc4caf0400efdc7c22b258bb749b87df33c8dde6045458a9de09b39edd9f9
|
7
|
+
data.tar.gz: a5dd37f5b20524553ff4ff1cca5abf304cf9b0333c80a01d8d71cf327f057ef4a24053245a6b066f28245ffb3ba2639f38b3c056e2b7935312b0f0288b1e53f7
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -7,25 +7,10 @@ bundler_args: "--no-deployment"
|
|
7
7
|
script:
|
8
8
|
- echo $BUNDLE_GEMFILE
|
9
9
|
- bundle exec rake
|
10
|
-
gemfile:
|
11
|
-
- gemfiles/rails_4.0.0.gemfile
|
12
|
-
- gemfiles/rails_4.1.1.gemfile
|
13
|
-
- gemfiles/rails_4.2.0.gemfile
|
14
10
|
rvm:
|
15
11
|
- 2.0.0
|
16
12
|
- 2.1.5
|
17
|
-
- 2.1.8
|
18
|
-
- 2.2.2
|
19
13
|
- 2.2.3
|
20
|
-
- 2.3.0
|
21
14
|
- 2.3.1
|
22
|
-
matrix:
|
23
|
-
exclude:
|
24
|
-
- rvm: 2.0.0
|
25
|
-
gemfile: gemfiles/rails_5.0.0.gemfile
|
26
|
-
- rvm: 2.1.5
|
27
|
-
gemfile: gemfiles/rails_5.0.0.gemfile
|
28
|
-
- rvm: 2.1.8
|
29
|
-
gemfile: gemfiles/rails_5.0.0.gemfile
|
30
15
|
notifications:
|
31
16
|
email: false
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -7,25 +7,25 @@ require 'yard'
|
|
7
7
|
Coveralls::RakeTask.new
|
8
8
|
|
9
9
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
default_options = ['--colour']
|
11
|
+
default_options.concat(['--backtrace', '--fail-fast']) if ENV['DEBUG']
|
12
|
+
spec.rspec_opts = default_options
|
13
|
+
spec.verbose = true
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
YARD::Config.options[:load_plugins] = true
|
17
|
+
YARD::Config.load_plugins
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# dirty hack for YardocTask
|
20
|
+
::Rake.application.class.class_eval do
|
21
|
+
alias_method :last_comment, :last_description
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
YARD::Rake::YardocTask.new do |t|
|
25
|
+
t.files = ['lib/**/*.rb', 'spec/**/*_spec.rb'] # optional
|
26
|
+
t.options = ['--any', '--extra', '--opts', '--markup-provider=redcarpet', '--markup=markdown', '--debug'] # optional
|
27
|
+
t.stats_options = ['--list-undoc'] # optional
|
28
|
+
end
|
29
29
|
|
30
30
|
desc 'Default: run the unit tests.'
|
31
31
|
task default: [:all]
|
@@ -38,10 +38,10 @@ task :all do |_t|
|
|
38
38
|
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
39
39
|
appraisal_name = ENV['BUNDLE_GEMFILE'].scan(/rails\_(.*)\.gemfile/).flatten.first
|
40
40
|
command_prefix = "appraisal rails-#{appraisal_name}"
|
41
|
-
exec
|
41
|
+
exec("#{command_prefix} bundle install && #{command_prefix} bundle exec rspec && bundle exec rake coveralls:push ")
|
42
42
|
else
|
43
43
|
exec(' bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
44
|
-
|
44
|
+
end
|
45
45
|
else
|
46
46
|
exec('bundle exec appraisal install && bundle exec rake appraisal spec')
|
47
47
|
end
|
@@ -38,8 +38,8 @@ class SinatraApp < Sinatra::Base
|
|
38
38
|
get '/background_notification' do
|
39
39
|
begin
|
40
40
|
1/0
|
41
|
-
rescue Exception =>
|
42
|
-
ExceptionNotifier.notify_exception(
|
41
|
+
rescue Exception => exception
|
42
|
+
ExceptionNotifier.notify_exception(exception, :data => {:msg => "Cannot divide by zero!"})
|
43
43
|
end
|
44
44
|
'Check notification at <a href="http://asana.com">Asana</a>.'
|
45
45
|
end
|
@@ -16,16 +16,19 @@ module ExceptionNotifier
|
|
16
16
|
parse_options(@initial_options)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
19
|
def asana_client
|
21
|
-
@asana_client = Asana::Client.new do |
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
@asana_client = Asana::Client.new do |config|
|
21
|
+
config.authentication :access_token, asana_api_key
|
22
|
+
config.debug_mode
|
23
|
+
config.faraday_adapter :typhoeus
|
24
|
+
faraday_configuration(config)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def faraday_configuration(config)
|
29
|
+
config.configure_faraday do |conn|
|
30
|
+
conn.request :url_encoded
|
31
|
+
conn.response :logger
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
@@ -90,7 +93,7 @@ module ExceptionNotifier
|
|
90
93
|
).symbolize_keys!
|
91
94
|
end
|
92
95
|
|
93
|
-
#
|
96
|
+
#
|
94
97
|
#
|
95
98
|
# @return [void]
|
96
99
|
def create_asana_task(error_page)
|
@@ -109,9 +112,11 @@ module ExceptionNotifier
|
|
109
112
|
|
110
113
|
def upload_archive(zip, task)
|
111
114
|
return if task.blank?
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
+
task.attach(
|
116
|
+
filename: zip,
|
117
|
+
mime: 'application/zip'
|
118
|
+
)
|
119
|
+
FileUtils.rm_rf([zip])
|
115
120
|
end
|
116
121
|
end
|
117
122
|
end
|
@@ -36,7 +36,8 @@ module AsanaExceptionNotifier
|
|
36
36
|
template_extension: template_extension
|
37
37
|
)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
|
+
# :reek:TooManyStatements: { max_statements: 10 }
|
40
41
|
def parse_exception_options
|
41
42
|
@template_params ||= {
|
42
43
|
basic_info: fetch_basic_info,
|
@@ -77,10 +78,10 @@ module AsanaExceptionNotifier
|
|
77
78
|
end
|
78
79
|
|
79
80
|
def exception_service
|
80
|
-
hash
|
81
|
+
hash = {}
|
81
82
|
@exception.instance_variables.select do |ivar|
|
82
83
|
attr_value = @exception.instance_variable_get(ivar)
|
83
|
-
|
84
|
+
hash[ivar.to_s] = attr_value if attr_value.present?
|
84
85
|
end
|
85
86
|
hash
|
86
87
|
end
|
@@ -123,21 +124,29 @@ module AsanaExceptionNotifier
|
|
123
124
|
hash
|
124
125
|
end
|
125
126
|
|
126
|
-
def
|
127
|
+
def build_template_params_hash(hash)
|
127
128
|
@template_params.each_with_parent do |parent, key, value|
|
128
129
|
next if value.blank? || key.blank?
|
129
130
|
parent_name = set_fieldset_key(hash, parent, 'system_info')
|
130
131
|
hash[parent_name][key] = value
|
131
132
|
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def fetch_fieldsets(hash = {})
|
136
|
+
build_template_params_hash(hash)
|
132
137
|
hash.keys.map(&:to_s).sort
|
133
138
|
hash
|
134
139
|
end
|
135
140
|
|
141
|
+
def setup_template_params_for_rendering
|
142
|
+
@template_params[:fieldsets] = fieldsets
|
143
|
+
@template_params[:fieldsets_links] = fieldsets_links
|
144
|
+
end
|
145
|
+
|
136
146
|
def render_template(template = nil)
|
137
147
|
execute_with_rescue do
|
138
148
|
current_template = template.present? ? template : @template_path
|
139
|
-
|
140
|
-
@template_params[:fieldsets_links] = fieldsets_links
|
149
|
+
setup_template_params_for_rendering
|
141
150
|
Tilt.new(current_template).render(self, @template_params.stringify_keys)
|
142
151
|
end
|
143
152
|
end
|
@@ -69,7 +69,7 @@ module AsanaExceptionNotifier
|
|
69
69
|
#
|
70
70
|
# @api public
|
71
71
|
def logger
|
72
|
-
@logger ||= (
|
72
|
+
@logger ||= (defined?(Rails) && rails_logger.present? ? rails_logger : ExceptionNotifier.logger)
|
73
73
|
@logger = @logger.present? ? @logger : Logger.new(STDOUT)
|
74
74
|
end
|
75
75
|
|
@@ -192,7 +192,6 @@ module AsanaExceptionNotifier
|
|
192
192
|
}
|
193
193
|
end
|
194
194
|
|
195
|
-
|
196
195
|
def split_archive(archive, partial_name, segment_size)
|
197
196
|
indexes = Zip::File.split(archive, segment_size, true, partial_name)
|
198
197
|
archives = Array.new(indexes) do |index|
|
@@ -3,10 +3,14 @@ class Hash
|
|
3
3
|
def each_with_parent(parent = nil, &block)
|
4
4
|
each do |key, value|
|
5
5
|
if value.is_a?(Hash)
|
6
|
-
value
|
7
|
-
|
6
|
+
deep_hash_with_parent(value, key, &block)
|
7
|
+
elsif block_given?
|
8
8
|
yield(parent, key, value)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def deep_hash_with_parent(value, key, &block)
|
14
|
+
value.each_with_parent(key, &block)
|
15
|
+
end
|
12
16
|
end
|
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: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -408,9 +408,6 @@ files:
|
|
408
408
|
- examples/sinatra/README.md
|
409
409
|
- examples/sinatra/config.ru
|
410
410
|
- examples/sinatra/sinatra_app.rb
|
411
|
-
- gemfiles/rails_4.0.0.gemfile
|
412
|
-
- gemfiles/rails_4.1.1.gemfile
|
413
|
-
- gemfiles/rails_4.2.0.gemfile
|
414
411
|
- init.rb
|
415
412
|
- lib/asana_exception_notifier.rb
|
416
413
|
- lib/asana_exception_notifier/classes/asana.rb
|