newshound 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 65debb3ae756e51f870de0872ff54d2332ee71e9c05aa6ac174c9525336c46b5
4
- data.tar.gz: 8667bbc9ff8695b5191bccbbe066190bb9e6f86f7c7ef0d6508a312420258167
3
+ metadata.gz: 17482571ea8f7d999aa1325c6263939d19d2028f8b1ee493dbf937db079ca7cb
4
+ data.tar.gz: 60fb33436b5c573feae6c5fbbf85c4e5c0b5e7a402f4ebb4af0a6d9627aaee27
5
5
  SHA512:
6
- metadata.gz: 7bb18eaf72c010172a7c80c13f782b6736620cef9855ee81f0faaa2ad32d1659b02d0970a4381adad7b42d72eb80663b8c93e0eefebd58d61ec75d45c2c31081
7
- data.tar.gz: '07722335323043284857b615205ec4def0f167f4f77308ffce3eeb1911afe85c963e6a62987f88d88d59e8385a4998d30e33835211c6c7d70f52e111f46ae5bb'
6
+ metadata.gz: b1d0e8d16a32eec46f8053cd86b2d0bcef597724eef9075e227b054ef3b41fe562bc821c70cad5360b7151ead08599a226a4591c485811d90ebca7d7599261ee
7
+ data.tar.gz: bceefac2030c25e5a833f6b0e4debdc69cc30412b2af500f7cd3e0164b46300eb301f3fbf54aad3c277452f3ea8ae3e7856f105c9040a38cedad0f3d70399380
data/CHANGELOG.md CHANGED
@@ -5,45 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.2.2] - 2025-10-23
9
-
10
- ### Added
11
-
12
- - CI workflow to run tests on Ruby 3.0-3.4 (b3ebc7a)
13
- - Separate linter job for RuboCop (b3ebc7a)
14
- - Coverage reporting with SimpleCov (b3ebc7a)
15
- - CI workflow to run tests on Ruby 3.0-3.4 (782cc57)
16
- - Separate linter job for RuboCop (782cc57)
17
- - Coverage reporting with SimpleCov (782cc57)
18
- - .claude/settings.local.json to .gitignore (701d802)
19
- - Reissue gem dependency for automated versioning (feac98a)
20
- - Git trailer support for changelog management (feac98a)
21
- - Initial CHANGELOG.md with Keep a Changelog format (feac98a)
22
- - CODEOWNERS file for SOFware/engineers (1a0a1f5)
23
- - Newshound::Exceptions::Base for standard API to interact with exception data (9dce846)
24
- - Configuration exception_source to allow for future alternative exception backends (9dce846)
25
- - SolidErrors support (8b5b48a)
26
-
27
- ### Changed
28
-
29
- - Replaced RuboCop with StandardRB for simpler linting (09292ed)
30
- - Updated GitHub Actions workflow to use standardrb (09292ed)
31
- - Auto-corrected all StandardRB violations (09292ed)
32
- - Simplified test setup by removing unused mocks (701d802)
33
- - Rakefile to use reissue tasks instead of manual versioning (feac98a)
34
- - Removed Ruby 3.0 from test matrix (now testing 3.1-3.4) (4beafd2)
35
- - Updated gemspec required_ruby_version to >= 3.1.0 (4beafd2)
8
+ ## [0.2.3] - 2025-10-29
36
9
 
37
10
  ### Fixed
38
11
 
39
- - Workflow now only runs once per PR (removed duplicate triggers) (09292ed)
40
- - Mock ActiveRecord::Base.connection and its methods (701d802)
41
- - Mock connection.execute to return database-like results (701d802)
42
- - Mock connection.quote and connection.select_value properly (701d802)
43
- - Name and email in gemspec authors (ab44f30)
44
-
45
- ### Removed
12
+ - Updated styling in banner injector to attempt to keep newshound banner above other application's menus, instead of hovering over them.
46
13
 
47
- - Dependency on exception-track (8b5b48a)
14
+ ### Changed
48
15
 
49
- ## [0.2.2] - Unreleased
16
+ - Consolidated exception data extraction in ExceptionTrack and SolidErrors (55cffd3)
data/README.md CHANGED
@@ -207,7 +207,7 @@ This gem uses [Reissue](https://github.com/rails/reissue) for release management
207
207
  the following steps as you would with any other ruby gem:
208
208
 
209
209
  ```bash
210
- bundle exec rake bump:checksum
210
+ bundle exec rake build:checksum
211
211
  ```
212
212
  And then create a new release:
213
213
  ```bash
@@ -0,0 +1 @@
1
+ 4b38b6628a214ff2cf66a400e184a5659a2ba82ccf46efde37293d93dd77534ffe87d3dd41220e0cac43aabaed66318cbdb70b8cbf66988f744f04ead452bbc5
@@ -12,53 +12,41 @@ module Newshound
12
12
  details = parse_exception_details(exception)
13
13
 
14
14
  <<~TEXT
15
- *#{number}. #{exception_title(exception)}*
15
+ *#{number}. #{details[:title]}*
16
16
  • *Time:* #{exception.created_at.strftime("%I:%M %p")}
17
17
  #{format_controller(details)}
18
- #{format_message(exception, details)}
18
+ #{format_message(details)}
19
19
  TEXT
20
20
  end
21
21
 
22
22
  def format_for_banner(exception)
23
23
  details = parse_exception_details(exception)
24
24
 
25
- # Extract message
26
- message = if details["message"].present?
27
- details["message"].to_s
28
- elsif exception.respond_to?(:message) && exception.message.present?
29
- exception.message.to_s
30
- else
31
- +""
32
- end
33
-
34
- # Extract location
35
- location = if details["controller_name"] && details["action_name"]
36
- "#{details["controller_name"]}##{details["action_name"]}"
37
- else
38
- +""
39
- end
40
-
41
25
  {
42
- title: exception_title(exception),
43
- message: message.truncate(100),
44
- location: location,
26
+ title: details[:title],
27
+ message: details[:message].truncate(100),
28
+ location: details[:location],
45
29
  time: exception.created_at.strftime("%I:%M %p")
46
30
  }
47
31
  end
48
32
 
49
33
  private
50
34
 
51
- def exception_title(exception)
52
- if exception.respond_to?(:title) && exception.title.present?
53
- exception.title
54
- elsif exception.respond_to?(:exception_class) && exception.exception_class.present?
55
- exception.exception_class
56
- else
57
- "Unknown Exception"
58
- end
35
+ def parse_exception_details(exception)
36
+ body_data = parse_body(exception)
37
+ controller_name = body_data["controller_name"]
38
+ action_name = body_data["action_name"]
39
+
40
+ {
41
+ title: exception.try(:title).presence || exception.try(:exception_class).presence || "Unknown Exception",
42
+ message: body_data["message"].presence&.to_s || exception.try(:message).presence&.to_s || +"",
43
+ location: (controller_name && action_name) ? "#{controller_name}##{action_name}" : +"",
44
+ controller_name: controller_name,
45
+ action_name: action_name
46
+ }
59
47
  end
60
48
 
61
- def parse_exception_details(exception)
49
+ def parse_body(exception)
62
50
  return {} unless exception.respond_to?(:body) && exception.body.present?
63
51
 
64
52
  JSON.parse(exception.body)
@@ -67,24 +55,15 @@ module Newshound
67
55
  end
68
56
 
69
57
  def format_controller(details)
70
- return +"" unless details["controller_name"] && details["action_name"]
58
+ return +"" unless details in {controller_name: String, action_name: String}
71
59
 
72
- "• *Controller:* #{details["controller_name"]}##{details["action_name"]}\n"
60
+ "• *Controller:* #{details[:location]}\n"
73
61
  end
74
62
 
75
- def format_message(exception, details = nil)
76
- details ||= parse_exception_details(exception)
77
-
78
- # Try to get message from different sources
79
- message = if details["message"].present?
80
- details["message"]
81
- elsif exception.respond_to?(:message) && exception.message.present?
82
- exception.message
83
- end
84
-
85
- return +"" unless message.present?
63
+ def format_message(details)
64
+ return +"" unless details in {message: String}
86
65
 
87
- message = message.to_s.truncate(100)
66
+ message = details[:message].to_s.truncate(100)
88
67
  "• *Message:* `#{message}`"
89
68
  end
90
69
  end
@@ -9,60 +9,50 @@ module Newshound
9
9
  end
10
10
 
11
11
  def format_for_report(exception, number)
12
- context = parse_context(exception)
12
+ details = parse_exception_details(exception)
13
13
 
14
14
  <<~TEXT
15
- *#{number}. #{exception_title(exception)}*
15
+ *#{number}. #{details[:title]}*
16
16
  • *Time:* #{exception.created_at.strftime("%I:%M %p")}
17
- #{format_controller(context)}
18
- #{format_message(exception, context)}
17
+ #{format_controller(details)}
18
+ #{format_message(details)}
19
19
  TEXT
20
20
  end
21
21
 
22
22
  def format_for_banner(exception)
23
- context = parse_context(exception)
24
-
25
- # Extract message
26
- message = if exception.respond_to?(:message) && exception.message.present?
27
- exception.message.to_s
28
- elsif context["message"].present?
29
- context["message"].to_s
30
- else
31
- +""
32
- end
33
-
34
- # Extract location from context
35
- location = if context["controller"] && context["action"]
36
- "#{context["controller"]}##{context["action"]}"
37
- else
38
- +""
39
- end
23
+ details = parse_exception_details(exception)
40
24
 
41
25
  {
42
- title: exception_title(exception),
43
- message: message.truncate(100),
44
- location: location,
26
+ title: details[:title],
27
+ message: details[:message].truncate(100),
28
+ location: details[:location],
45
29
  time: exception.created_at.strftime("%I:%M %p")
46
30
  }
47
31
  end
48
32
 
49
33
  private
50
34
 
51
- def exception_title(exception)
52
- if exception.respond_to?(:error_class) && exception.error_class.present?
53
- exception.error_class
54
- else
55
- "Unknown Exception"
56
- end
35
+ def parse_exception_details(exception)
36
+ context_data = parse_context(exception)
37
+ controller = context_data["controller"]
38
+ action = context_data["action"]
39
+
40
+ {
41
+ title: exception.try(:error_class).presence || "Unknown Exception",
42
+ message: exception.try(:message).presence&.to_s || context_data["message"].presence&.to_s || +"",
43
+ location: (controller && action) ? "#{controller}##{action}" : +"",
44
+ controller: controller,
45
+ action: action
46
+ }
57
47
  end
58
48
 
59
49
  def parse_context(exception)
60
50
  return {} unless exception.respond_to?(:context) && exception.context.present?
61
51
 
62
- # SolidErrors context might be a hash or JSON string
63
- if exception.context.is_a?(Hash)
52
+ case exception.context
53
+ when Hash
64
54
  exception.context
65
- elsif exception.context.is_a?(String)
55
+ when String
66
56
  JSON.parse(exception.context)
67
57
  else
68
58
  {}
@@ -71,25 +61,16 @@ module Newshound
71
61
  {}
72
62
  end
73
63
 
74
- def format_controller(context)
75
- return +"" unless context["controller"] && context["action"]
64
+ def format_controller(details)
65
+ return +"" unless details in {controller: String, action: String}
76
66
 
77
- "• *Controller:* #{context["controller"]}##{context["action"]}\n"
67
+ "• *Controller:* #{details[:location]}\n"
78
68
  end
79
69
 
80
- def format_message(exception, context = nil)
81
- context ||= parse_context(exception)
82
-
83
- # Try to get message from different sources
84
- message = if exception.respond_to?(:message) && exception.message.present?
85
- exception.message
86
- elsif context["message"].present?
87
- context["message"]
88
- end
89
-
90
- return +"" unless message.present?
70
+ def format_message(details)
71
+ return +"" unless details in {message: String}
91
72
 
92
- message = message.to_s.truncate(100)
73
+ message = details[:message].to_s.truncate(100)
93
74
  "• *Message:* `#{message}`"
94
75
  end
95
76
  end
@@ -117,7 +117,7 @@ module Newshound
117
117
  <<~CSS
118
118
  <style>
119
119
  body {
120
- padding-top: 0;
120
+ padding-top: 50px;
121
121
  transition: padding-top 0.3s ease-out;
122
122
  }
123
123
  .newshound-banner {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Newshound
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newshound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Savannah Moore
@@ -52,6 +52,7 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - TRANSPORT_USAGE.md
55
+ - checksums/newshound-0.2.3.gem.sha512
55
56
  - lib/generators/newshound/install/install_generator.rb
56
57
  - lib/generators/newshound/install/templates/newshound.rb
57
58
  - lib/newshound.rb