asana_exception_notifier 0.0.6 → 0.0.7

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: 6324de78b9f41b71b8e8d6384a772719f291decd
4
- data.tar.gz: 23c376c63a84ca5d6c9161474b13d17ffae082c6
3
+ metadata.gz: a86f7ce7e4c4e1f4ff8dc107525100e8fdd0a2ce
4
+ data.tar.gz: 1c3823e58d70cc8579595e3bab70daf49aa0f652
5
5
  SHA512:
6
- metadata.gz: f50b8bc0c3eba11770f1689e31db4fc458026fdf7decfe1c796762c6717926d52869add49fe031effa01cc34d9d423cbdf73389d3b5db9289cb369fbe12fbe13
7
- data.tar.gz: ba8cd7b6fbd9cad58dbe9223f1879bd20a94e535015acfa7a69c79d71a394d2dacda7dbcb1d1a7706b345736811493dca919e4b6b534535b9e56030b9e2477d6
6
+ metadata.gz: 51c5bc58e1b873a1fd6472ea0fe311b04fbdb156b08837af45cc0d97f231a0eebf2b0376ac2948e3f9153a4bb4ca6ec8195f40db039dc4c54dbc7abc45230c20
7
+ data.tar.gz: bd7631649f3843c1e60d937aacc37855ba37485a57a67d8107b4474a6beb6f194bf87b0f7791c5d198f3e9b3cc7e182ac796aafe2d5203a68bf1388ab59719de
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asana_exception_notifier (0.0.5)
4
+ asana_exception_notifier (0.0.7)
5
5
  activesupport (>= 4.0, < 5)
6
6
  em-http-request (~> 1.1, >= 1.1.2)
7
7
  eventmachine (~> 1.0, >= 1.0.7)
@@ -172,7 +172,7 @@ DEPENDENCIES
172
172
  rake (~> 10.5, >= 10.5)
173
173
  redcarpet (~> 3.3, >= 3.3)
174
174
  rspec (~> 3.4, >= 3.4)
175
- simplecov (~> 0.10, >= 0.10)
175
+ simplecov (~> 0.11, >= 0.10)
176
176
  simplecov-summary (~> 0.0.4, >= 0.0.4)
177
177
  yard (~> 0.8, >= 0.8.7)
178
178
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- asana_exception_notifier (0.0.1)
4
+ asana_exception_notifier (0.0.7)
5
5
  activesupport (>= 4.0, < 5)
6
6
  em-http-request (~> 1.1, >= 1.1.2)
7
7
  eventmachine (~> 1.0, >= 1.0.7)
@@ -1 +1 @@
1
- web: bundle exec thin start --port 3000
1
+ web: bundle exec thin start --port ${PORT:-3000} -e ${RACK_ENV:-development}
@@ -39,20 +39,33 @@ module AsanaExceptionNotifier
39
39
 
40
40
  def parse_exception_options
41
41
  @template_params ||= {
42
- server: Socket.gethostname,
42
+ basic_info: fetch_basic_info,
43
43
  exception: @exception,
44
44
  request: @request,
45
- environment: @request.respond_to?(:filtered_env) ? @request.filtered_env : @env,
46
- rails_root: defined?(Rails) ? Rails.root : nil,
47
- process: $PROCESS_ID,
45
+ env: @request.respond_to?(:filtered_env) ? @request.filtered_env : @env,
48
46
  data: (@env.blank? ? {} : @env.fetch(:'exception_notifier.exception_data', {})).merge(@options[:data] || {}),
49
47
  exception_data: exception_data,
50
48
  exception_service_data: exception_service,
51
49
  request_data: setup_env_params,
50
+ parameters: @request.respond_to?(:filtered_parameters) ? filter_params(@request.filtered_parameters) : filter_params(request_params),
51
+ session: session.respond_to?(:to_hash) ? session.to_hash : session.to_h,
52
+ cookies: @request.cookies.to_h
53
+ }.merge(@options).reject { |_key, value| value.blank? }
54
+ end
55
+
56
+ def session
57
+ @request.session
58
+ end
59
+
60
+ def fetch_basic_info
61
+ {
62
+ server: Socket.gethostname,
63
+ rails_root: defined?(Rails) ? Rails.root : nil,
64
+ process: $PROCESS_ID,
52
65
  uname: Sys::Uname.uname,
53
66
  timestamp: @timestamp,
54
67
  pwd: File.expand_path($PROGRAM_NAME)
55
- }.merge(@options).reject { |_key, value| value.blank? }
68
+ }
56
69
  end
57
70
 
58
71
  def exception_data
@@ -79,15 +92,12 @@ module AsanaExceptionNotifier
79
92
  referrer: @request.referer,
80
93
  http_method: action_dispatch? ? @request.method : @request.request_method,
81
94
  ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,
82
- parameters: @request.respond_to?(:filtered_parameters) ? filter_params(@request.filtered_parameters) : filter_params(request_params),
83
- session: @request.session,
84
- cookies: @request.cookies,
85
95
  user_agent: @request.user_agent
86
96
  }
87
97
  end
88
98
 
89
99
  def filter_params(params)
90
- AsanaExceptionNotifier::UnsafeFilter.new(params, @options.fetch(:unsafe_options, []))
100
+ AsanaExceptionNotifier::UnsafeFilter.new(params, @options.fetch(:unsafe_options, [])).arguments
91
101
  end
92
102
 
93
103
  def request_params
@@ -100,32 +110,35 @@ module AsanaExceptionNotifier
100
110
  fieldsets.map { |key, _value| link_helper(key.to_s) }.join(' | ')
101
111
  end
102
112
 
103
- def fetch_fieldsets(hash, links = {}, prefix = nil)
104
- return unless hash.is_a?(Hash)
105
- hash.each do |key, value|
106
- if value.is_a?(Hash)
107
- fetch_fieldsets(value, links, key)
108
- else
109
- add_to_links(links, prefix, key: key, value: value)
110
- end
111
- end
112
- links
113
+ def fieldsets
114
+ @fieldsets ||= mount_tables_for_fieldsets
115
+ @fieldsets
113
116
  end
114
117
 
115
- def add_to_links(links, prefix, options = {})
116
- expected_value = parse_fieldset_value(options)
117
- return unless expected_value.present?
118
- prefix_name = set_fieldset_key(links, prefix, 'basic_info')
119
- links[prefix_name][options[:key]] = expected_value
118
+ def mount_tables_for_fieldsets
119
+ hash = fetch_fieldsets
120
+ hash.each do |key, value|
121
+ html = mount_table_for_hash(value)
122
+ hash[key] = html if html.present?
123
+ end
124
+ hash
120
125
  end
121
126
 
122
- def fieldsets
123
- @fieldsets ||= fetch_fieldsets(parse_exception_options).except(:env)
127
+ def fetch_fieldsets(hash = {})
128
+ @template_params.each_with_parent do |parent, key, value|
129
+ next if value.blank? || key.blank?
130
+ parent_name = set_fieldset_key(hash, parent, 'system_info')
131
+ hash[parent_name][key] = value
132
+ end
133
+ hash.keys.map(&:to_s).sort
134
+ hash
124
135
  end
125
136
 
126
137
  def render_template(template = nil)
127
138
  execute_with_rescue do
128
139
  current_template = template.present? ? template : @template_path
140
+ @template_params[:fieldsets] = fieldsets
141
+ @template_params[:fieldsets_links] = fieldsets_links
129
142
  Tilt.new(current_template).render(self, @template_params.stringify_keys)
130
143
  end
131
144
  end
@@ -124,12 +124,12 @@ module AsanaExceptionNotifier
124
124
  File.exist?(path)
125
125
  end
126
126
 
127
- def get_hash_rows(hash, rows = [], prefix = '')
127
+ def get_hash_rows(hash, rows = [], _prefix = '')
128
128
  hash.each do |key, value|
129
129
  if value.is_a?(Hash)
130
- get_hash_rows(value, rows, key)
130
+ get_object_rows(value, rows)
131
131
  else
132
- rows.push(["#{prefix}#{key}".inspect, escape(inspect_value(value).inspect)])
132
+ rows.push([key.inspect, escape(inspect_value(value).inspect)])
133
133
  end
134
134
  end
135
135
  rows
@@ -0,0 +1,12 @@
1
+ # override Hash class
2
+ class Hash
3
+ def each_with_parent(parent = nil, &block)
4
+ each do |key, value|
5
+ if value.is_a?(Hash)
6
+ value.each_with_parent(key, &block)
7
+ else
8
+ yield(parent, key, value)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -26,7 +26,7 @@
26
26
  <fieldset class='ajax_exception_notifier_fieldset' id='<%= key %>' style="<%= fieldsets.keys.first != key ? "display:none" : '' %>">
27
27
  <legend>Debug Information for <%= key.to_s.camelize %></legend>
28
28
  <div>
29
- <%= mount_table_for_hash(value) %>
29
+ <%= value %>
30
30
  </div>
31
31
  </fieldset>
32
32
  <% end %>
@@ -11,11 +11,11 @@ Request URI: <%= request_data[:url] %>
11
11
  <% if request_data[:referrer].present? %>
12
12
  Referer: <%= request_data[:referrer] %>
13
13
  <% end %>
14
- PID: <%= process %>
15
- PWD: <%= pwd %>
16
- Uname: <%= uname %>
17
- Server: <%= server %>
18
- Error time: <%= timestamp %>
14
+ PID: <%= basic_info[:process] %>
15
+ PWD: <%= basic_info[:pwd] %>
16
+ Uname: <%= basic_info[:uname] %>
17
+ Server: <%= basic_info[:server] %>
18
+ Error time: <%= basic_info[:timestamp] %>
19
19
  <% if request_data[:user_agent].present? %>
20
20
  User Agent: <%= request_data[:user_agent] %>
21
21
  <% end %>
@@ -17,7 +17,7 @@ module AsanaExceptionNotifier
17
17
  # minor release version
18
18
  MINOR = 0
19
19
  # tiny release version
20
- TINY = 6
20
+ TINY = 7
21
21
  # prelease version ( set this only if it is a prelease)
22
22
  PRE = nil
23
23
 
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.0.6
4
+ version: 0.0.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-02-04 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -422,6 +422,7 @@ files:
422
422
  - lib/asana_exception_notifier/classes/unsafe_filter.rb
423
423
  - lib/asana_exception_notifier/helpers/application_helper.rb
424
424
  - lib/asana_exception_notifier/helpers/heredoc_helper.rb
425
+ - lib/asana_exception_notifier/initializers/hash.rb
425
426
  - lib/asana_exception_notifier/initializers/zip.rb
426
427
  - lib/asana_exception_notifier/request/client.rb
427
428
  - lib/asana_exception_notifier/request/core.rb