chat_notifier 0.2.4 → 0.2.5
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 +4 -4
- data/CHANGELOG.md +15 -6
- data/README.md +1 -9
- data/lib/chat_notifier/chatter.rb +5 -5
- data/lib/chat_notifier/messenger.rb +1 -1
- data/lib/chat_notifier/version.rb +1 -1
- data/lib/chat_notifier.rb +23 -18
- data/lib/minitest/chat_notifier_plugin.rb +2 -2
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a442afb94e03ba8a40be94d62cb0043abe9a4a88430028bb79a5655ebe2d1f7e
|
|
4
|
+
data.tar.gz: 2070d04462fc7d9fec4daf08b25e900f03d5d7ce735aa5ac51eace3acc6429c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e892f14d366c45b01b3665523ee7b47eba8ad9b15021351b3f626763a08bacce3b72bdd5a6425338e5e1a5b3d94c3ae2294c3c92809060607b9bfa9b8aeaa273
|
|
7
|
+
data.tar.gz: 4a7cdd3397d62a9c7a9e25ea9b1bbf669a9e1c92eac97b95900764df0bc62b878cbd7e7942612852199a8ecd6efff13b0c6ed3604a7160b3d40b8da709e86c3d
|
data/CHANGELOG.md
CHANGED
|
@@ -5,15 +5,24 @@ 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.
|
|
8
|
+
## [0.2.5] - 2026-02-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Dependabot configuration with weekly updates
|
|
9
13
|
|
|
10
14
|
### Changed
|
|
11
15
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
16
|
+
- Moved ENV variable setting `NOTIFY_APP_NAME` into the test helper
|
|
17
|
+
- Refactored method signatures for easier testing
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
### Removed
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
- OpenStruct dependency
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
## [0.2.4] - 2025-01-16
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Add support for Ruby 3.4
|
|
28
|
+
- Check for Rails application before using Rails.application
|
data/README.md
CHANGED
|
@@ -79,12 +79,4 @@ end
|
|
|
79
79
|
|
|
80
80
|
## Contributing
|
|
81
81
|
|
|
82
|
-
This gem is managed with [Reissue](https://github.com/SOFware/reissue).
|
|
83
|
-
|
|
84
|
-
Releasing a new version:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
rake build:checksum
|
|
88
|
-
rake release
|
|
89
|
-
git push
|
|
90
|
-
```
|
|
82
|
+
This gem is managed with [Reissue](https://github.com/SOFware/reissue). Releases are automated via the [shared release workflow](https://github.com/SOFware/reissue/blob/main/.github/workflows/SHARED_WORKFLOW_README.md). Trigger a release by running the "Release gem to RubyGems.org" workflow from the Actions tab.
|
|
@@ -13,7 +13,7 @@ module ChatNotifier
|
|
|
13
13
|
@environment = environment
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
attr_reader :settings, :repository, :environment
|
|
17
17
|
|
|
18
18
|
class << self
|
|
19
19
|
def handlers
|
|
@@ -45,16 +45,16 @@ module ChatNotifier
|
|
|
45
45
|
def body
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
def post(messenger)
|
|
48
|
+
def post(messenger, process: Net::HTTP.method(:post))
|
|
49
49
|
uri = URI(webhook_url)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
process.call(uri, payload(messenger))
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def conditional_post(messenger)
|
|
54
|
+
def conditional_post(messenger, process: Net::HTTP.method(:post))
|
|
55
55
|
return if messenger.success? && !verbose?
|
|
56
56
|
|
|
57
|
-
post(messenger)
|
|
57
|
+
post(messenger, process:)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def verbose?
|
data/lib/chat_notifier.rb
CHANGED
|
@@ -16,25 +16,32 @@ module ChatNotifier
|
|
|
16
16
|
class << self
|
|
17
17
|
attr_accessor :logger
|
|
18
18
|
|
|
19
|
-
def app
|
|
20
|
-
if defined?(::Rails) && Rails.respond_to?(:application)
|
|
19
|
+
def app(env: ENV, name: env.fetch("NOTIFY_APP_NAME"))
|
|
20
|
+
name ||= if defined?(::Rails) && Rails.respond_to?(:application)
|
|
21
21
|
Rails.application.class.module_parent
|
|
22
22
|
else
|
|
23
|
-
|
|
23
|
+
raise "No app name provided and Rails is not defined"
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
STANDARDS = {
|
|
28
|
+
repository: Repository,
|
|
29
|
+
environment: TestEnvironment,
|
|
30
|
+
chatter: Chatter,
|
|
31
|
+
messenger: Messenger
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
# In order to test this locally see `rake chat_notifier:debug`
|
|
28
|
-
def debug!(env, summary:, notifier: :Debug)
|
|
29
|
-
repository =
|
|
30
|
-
environment =
|
|
35
|
+
def debug!(env, summary:, notifier: :Debug, **kwargs)
|
|
36
|
+
repository = (kwargs[:repository] || STANDARDS[:repository]).for(env)
|
|
37
|
+
environment = (kwargs[:environment] || STANDARDS[:environment]).for(env)
|
|
31
38
|
|
|
32
|
-
chatter =
|
|
39
|
+
chatter = (kwargs[:chatter] || STANDARDS[:chatter]).const_get(notifier).new(
|
|
33
40
|
settings: env,
|
|
34
41
|
repository: repository,
|
|
35
42
|
environment: environment
|
|
36
43
|
)
|
|
37
|
-
messenger =
|
|
44
|
+
messenger = (kwargs[:messenger] || STANDARDS[:messenger]).for(
|
|
38
45
|
summary,
|
|
39
46
|
app:,
|
|
40
47
|
repository:,
|
|
@@ -44,16 +51,16 @@ module ChatNotifier
|
|
|
44
51
|
chatter.post(messenger)
|
|
45
52
|
end
|
|
46
53
|
|
|
47
|
-
def call(summary
|
|
48
|
-
repository =
|
|
49
|
-
environment =
|
|
50
|
-
chatter =
|
|
54
|
+
def call(summary:, **kwargs)
|
|
55
|
+
repository = (kwargs[:repository] || STANDARDS[:repository]).for(ENV)
|
|
56
|
+
environment = (kwargs[:environment] || STANDARDS[:environment]).for(ENV)
|
|
57
|
+
chatter = (kwargs[:chatter] || STANDARDS[:chatter]).handling(
|
|
51
58
|
ENV,
|
|
52
59
|
repository:,
|
|
53
60
|
environment:
|
|
54
61
|
)
|
|
55
62
|
|
|
56
|
-
messenger =
|
|
63
|
+
messenger = (kwargs[:messenger] || STANDARDS[:messenger]).for(
|
|
57
64
|
summary,
|
|
58
65
|
app:,
|
|
59
66
|
repository:,
|
|
@@ -61,11 +68,9 @@ module ChatNotifier
|
|
|
61
68
|
)
|
|
62
69
|
|
|
63
70
|
chatter.each do |box|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
logger.error("ChatNotifier: #{box.webhook_url} #{exception.class}: #{exception.message}")
|
|
68
|
-
end
|
|
71
|
+
box.conditional_post(messenger)
|
|
72
|
+
rescue => exception
|
|
73
|
+
logger.error("ChatNotifier: #{box.webhook_url} #{exception.class}: #{exception.message}")
|
|
69
74
|
end
|
|
70
75
|
end
|
|
71
76
|
end
|
|
@@ -8,8 +8,8 @@ module Minitest
|
|
|
8
8
|
ExceptionLocation = Data.define(:location)
|
|
9
9
|
Summary = Data.define(:failed_examples)
|
|
10
10
|
def report
|
|
11
|
-
summary = Summary[(results.map{ |result| ExceptionLocation[result.source_location] })]
|
|
11
|
+
summary = Summary[(results.map { |result| ExceptionLocation[result.source_location] })]
|
|
12
12
|
::ChatNotifier.call(summary:)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
|
-
end
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chat_notifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jim Gay
|
|
8
8
|
- Savannah Albanez
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies: []
|
|
14
13
|
description: Send test results to chat
|
|
15
14
|
email:
|
|
@@ -36,12 +35,10 @@ files:
|
|
|
36
35
|
- lib/chat_notifier/test_environment/github.rb
|
|
37
36
|
- lib/chat_notifier/version.rb
|
|
38
37
|
- lib/minitest/chat_notifier_plugin.rb
|
|
39
|
-
homepage:
|
|
40
38
|
licenses: []
|
|
41
39
|
metadata:
|
|
42
40
|
source_code_uri: https://github.com/SOFware/chat_notifier.git
|
|
43
41
|
changelog_uri: https://github.com/SOFWare/chat_notifier/blob/master/CHANGELOG.md
|
|
44
|
-
post_install_message:
|
|
45
42
|
rdoc_options: []
|
|
46
43
|
require_paths:
|
|
47
44
|
- lib
|
|
@@ -56,8 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
56
53
|
- !ruby/object:Gem::Version
|
|
57
54
|
version: '0'
|
|
58
55
|
requirements: []
|
|
59
|
-
rubygems_version: 3.
|
|
60
|
-
signing_key:
|
|
56
|
+
rubygems_version: 3.6.9
|
|
61
57
|
specification_version: 4
|
|
62
58
|
summary: Notify chat of test results
|
|
63
59
|
test_files: []
|