aether_observatory 1.0.0 → 1.0.1
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/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +31 -0
- data/Gemfile.lock +165 -0
- data/docs/CHANGELOG.md +8 -1
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_6_0.gemfile.lock +11 -9
- data/gemfiles/rails_6_1.gemfile.lock +11 -9
- data/gemfiles/rails_7_0.gemfile.lock +11 -9
- data/gemfiles/rails_7_1.gemfile.lock +11 -9
- data/lib/aether_observatory/backend/memory.rb +30 -0
- data/lib/aether_observatory/backend/notifications.rb +25 -0
- data/lib/aether_observatory/configuration.rb +1 -3
- data/lib/aether_observatory/event_base.rb +11 -9
- data/lib/aether_observatory/observer_base.rb +5 -5
- data/lib/aether_observatory/railtie.rb +9 -0
- data/lib/aether_observatory/rspec/event_helper.rb +49 -0
- data/lib/aether_observatory/rspec.rb +3 -0
- data/lib/aether_observatory/version.rb +1 -1
- data/lib/aether_observatory.rb +2 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25570ca275bf9937545f69eac39d58e13f2003c775336196ac5c8869ff25a9ed
|
4
|
+
data.tar.gz: d7b321209d6ecdf93697c8e60235e748a8a5441deb74b08e4cddc854eadb3b79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2253bc3dfa01dff1b80bbeb89b53da11373ceda822d13e497249fe7f083e48e88f2ad74f56c406ed46fd62e5ea017de5c6473067b26254936b3cf8813095bd
|
7
|
+
data.tar.gz: f503ef77b7519af39651c70f55069e2b6d873110422f01e5c000907967456682b5bcdccc69ee83093c7109b5226531ad54ad31e251c344d7cb158c5ffaeb1cf5
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-03-19 14:04:23 UTC using RuboCop version 1.74.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Rails/EnvironmentVariableAccess:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/spec_helper.rb'
|
13
|
+
|
14
|
+
# Offense count: 7
|
15
|
+
Rails/HelperInstanceVariable:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/aether_observatory/event_base.rb'
|
18
|
+
- 'lib/aether_observatory/observer_base.rb'
|
19
|
+
|
20
|
+
# Offense count: 1
|
21
|
+
# This cop supports safe autocorrection (--autocorrect).
|
22
|
+
Rails/Output:
|
23
|
+
Exclude:
|
24
|
+
- 'Rakefile'
|
25
|
+
|
26
|
+
# Offense count: 9
|
27
|
+
# This cop supports safe autocorrection (--autocorrect).
|
28
|
+
Rails/SaveBang:
|
29
|
+
Exclude:
|
30
|
+
- 'spec/aether_observatory/event_base_spec.rb'
|
31
|
+
- 'spec/aether_observatory/observer_base_spec.rb'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../rubocop-powerhome
|
3
|
+
specs:
|
4
|
+
rubocop-powerhome (0.5.5)
|
5
|
+
rubocop (= 1.74.0)
|
6
|
+
rubocop-performance
|
7
|
+
rubocop-rails
|
8
|
+
rubocop-rake
|
9
|
+
rubocop-rspec
|
10
|
+
|
11
|
+
PATH
|
12
|
+
remote: .
|
13
|
+
specs:
|
14
|
+
aether_observatory (1.0.1)
|
15
|
+
activemodel (>= 6.0.6.1)
|
16
|
+
activesupport (>= 6.0.6.1)
|
17
|
+
|
18
|
+
GEM
|
19
|
+
remote: https://rubygems.org/
|
20
|
+
specs:
|
21
|
+
activemodel (8.0.2)
|
22
|
+
activesupport (= 8.0.2)
|
23
|
+
activesupport (8.0.2)
|
24
|
+
base64
|
25
|
+
benchmark (>= 0.3)
|
26
|
+
bigdecimal
|
27
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
28
|
+
connection_pool (>= 2.2.5)
|
29
|
+
drb
|
30
|
+
i18n (>= 1.6, < 2)
|
31
|
+
logger (>= 1.4.2)
|
32
|
+
minitest (>= 5.1)
|
33
|
+
securerandom (>= 0.3)
|
34
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
35
|
+
uri (>= 0.13.1)
|
36
|
+
appraisal (2.5.0)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
thor (>= 0.14.0)
|
40
|
+
ast (2.4.2)
|
41
|
+
base64 (0.2.0)
|
42
|
+
benchmark (0.4.0)
|
43
|
+
bigdecimal (3.1.9)
|
44
|
+
byebug (11.1.3)
|
45
|
+
coderay (1.1.3)
|
46
|
+
concurrent-ruby (1.3.5)
|
47
|
+
connection_pool (2.5.0)
|
48
|
+
csv (3.3.2)
|
49
|
+
diff-lcs (1.6.0)
|
50
|
+
docile (1.1.5)
|
51
|
+
drb (2.2.1)
|
52
|
+
i18n (1.14.7)
|
53
|
+
concurrent-ruby (~> 1.0)
|
54
|
+
json (2.10.2)
|
55
|
+
language_server-protocol (3.17.0.4)
|
56
|
+
license_finder (7.2.1)
|
57
|
+
bundler
|
58
|
+
csv (~> 3.2)
|
59
|
+
rubyzip (>= 1, < 3)
|
60
|
+
thor (~> 1.2)
|
61
|
+
tomlrb (>= 1.3, < 2.1)
|
62
|
+
with_env (= 1.1.0)
|
63
|
+
xml-simple (~> 1.1.9)
|
64
|
+
lint_roller (1.1.0)
|
65
|
+
logger (1.6.6)
|
66
|
+
method_source (1.1.0)
|
67
|
+
minitest (5.25.5)
|
68
|
+
parallel (1.26.3)
|
69
|
+
parser (3.3.7.1)
|
70
|
+
ast (~> 2.4.1)
|
71
|
+
racc
|
72
|
+
pry (0.14.2)
|
73
|
+
coderay (~> 1.1)
|
74
|
+
method_source (~> 1.0)
|
75
|
+
pry-byebug (3.10.1)
|
76
|
+
byebug (~> 11.0)
|
77
|
+
pry (>= 0.13, < 0.15)
|
78
|
+
racc (1.8.1)
|
79
|
+
rack (3.1.12)
|
80
|
+
rainbow (3.1.1)
|
81
|
+
rake (13.2.1)
|
82
|
+
regexp_parser (2.10.0)
|
83
|
+
rexml (3.4.1)
|
84
|
+
rspec (3.13.0)
|
85
|
+
rspec-core (~> 3.13.0)
|
86
|
+
rspec-expectations (~> 3.13.0)
|
87
|
+
rspec-mocks (~> 3.13.0)
|
88
|
+
rspec-core (3.13.3)
|
89
|
+
rspec-support (~> 3.13.0)
|
90
|
+
rspec-expectations (3.13.3)
|
91
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
92
|
+
rspec-support (~> 3.13.0)
|
93
|
+
rspec-mocks (3.13.2)
|
94
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
95
|
+
rspec-support (~> 3.13.0)
|
96
|
+
rspec-support (3.13.2)
|
97
|
+
rubocop (1.74.0)
|
98
|
+
json (~> 2.3)
|
99
|
+
language_server-protocol (~> 3.17.0.2)
|
100
|
+
lint_roller (~> 1.1.0)
|
101
|
+
parallel (~> 1.10)
|
102
|
+
parser (>= 3.3.0.2)
|
103
|
+
rainbow (>= 2.2.2, < 4.0)
|
104
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
105
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
106
|
+
ruby-progressbar (~> 1.7)
|
107
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
108
|
+
rubocop-ast (1.39.0)
|
109
|
+
parser (>= 3.3.1.0)
|
110
|
+
rubocop-performance (1.24.0)
|
111
|
+
lint_roller (~> 1.1)
|
112
|
+
rubocop (>= 1.72.1, < 2.0)
|
113
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
114
|
+
rubocop-rails (2.30.3)
|
115
|
+
activesupport (>= 4.2.0)
|
116
|
+
lint_roller (~> 1.1)
|
117
|
+
rack (>= 1.1)
|
118
|
+
rubocop (>= 1.72.1, < 2.0)
|
119
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
120
|
+
rubocop-rake (0.7.1)
|
121
|
+
lint_roller (~> 1.1)
|
122
|
+
rubocop (>= 1.72.1)
|
123
|
+
rubocop-rspec (3.5.0)
|
124
|
+
lint_roller (~> 1.1)
|
125
|
+
rubocop (~> 1.72, >= 1.72.1)
|
126
|
+
ruby-progressbar (1.13.0)
|
127
|
+
rubyzip (2.4.1)
|
128
|
+
securerandom (0.4.1)
|
129
|
+
simplecov (0.15.1)
|
130
|
+
docile (~> 1.1.0)
|
131
|
+
json (>= 1.8, < 3)
|
132
|
+
simplecov-html (~> 0.10.0)
|
133
|
+
simplecov-html (0.10.2)
|
134
|
+
thor (1.3.2)
|
135
|
+
tomlrb (2.0.3)
|
136
|
+
tzinfo (2.0.6)
|
137
|
+
concurrent-ruby (~> 1.0)
|
138
|
+
unicode-display_width (3.1.4)
|
139
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
140
|
+
unicode-emoji (4.0.4)
|
141
|
+
uri (1.0.3)
|
142
|
+
with_env (1.1.0)
|
143
|
+
xml-simple (1.1.9)
|
144
|
+
rexml
|
145
|
+
yard (0.9.21)
|
146
|
+
|
147
|
+
PLATFORMS
|
148
|
+
arm64-darwin-24
|
149
|
+
ruby
|
150
|
+
|
151
|
+
DEPENDENCIES
|
152
|
+
aether_observatory!
|
153
|
+
appraisal (~> 2.5.0)
|
154
|
+
bundler (~> 2.1)
|
155
|
+
license_finder (~> 7.0)
|
156
|
+
pry (>= 0.14)
|
157
|
+
pry-byebug (= 3.10.1)
|
158
|
+
rake (~> 13.0)
|
159
|
+
rspec (~> 3.0)
|
160
|
+
rubocop-powerhome!
|
161
|
+
simplecov (= 0.15.1)
|
162
|
+
yard (= 0.9.21)
|
163
|
+
|
164
|
+
BUNDLED WITH
|
165
|
+
2.5.23
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
## [1.0.1] - 2025-07-31
|
4
|
+
|
5
|
+
- Add AetherObservatory::Rspec::EventHelper [#333](https://github.com/powerhome/power-tools/pull/333)
|
6
|
+
- Lazily setup default rails logger so it works [#334](https://github.com/powerhome/power-tools/pull/334)
|
7
|
+
|
1
8
|
## [0.0.1] - 2024-12-06
|
2
9
|
|
3
|
-
- Extracts AetherObservatory from Talkbox engine.
|
10
|
+
- Extracts AetherObservatory from Talkbox engine.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../rubocop-powerhome
|
3
3
|
specs:
|
4
|
-
rubocop-powerhome (0.5.
|
5
|
-
rubocop (= 1.
|
4
|
+
rubocop-powerhome (0.5.5)
|
5
|
+
rubocop (= 1.74.0)
|
6
6
|
rubocop-performance
|
7
7
|
rubocop-rails
|
8
8
|
rubocop-rake
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
PATH
|
12
12
|
remote: ..
|
13
13
|
specs:
|
14
|
-
aether_observatory (1.0.
|
14
|
+
aether_observatory (1.0.1)
|
15
15
|
activemodel (>= 6.0.6.1)
|
16
16
|
activesupport (>= 6.0.6.1)
|
17
17
|
|
@@ -49,6 +49,7 @@ GEM
|
|
49
49
|
tomlrb (>= 1.3, < 2.1)
|
50
50
|
with_env (= 1.1.0)
|
51
51
|
xml-simple (~> 1.1.9)
|
52
|
+
lint_roller (1.1.0)
|
52
53
|
method_source (1.1.0)
|
53
54
|
minitest (5.25.4)
|
54
55
|
parallel (1.26.3)
|
@@ -80,17 +81,18 @@ GEM
|
|
80
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
82
|
rspec-support (~> 3.13.0)
|
82
83
|
rspec-support (3.13.2)
|
83
|
-
rubocop (1.
|
84
|
+
rubocop (1.74.0)
|
84
85
|
json (~> 2.3)
|
85
|
-
language_server-protocol (
|
86
|
+
language_server-protocol (~> 3.17.0.2)
|
87
|
+
lint_roller (~> 1.1.0)
|
86
88
|
parallel (~> 1.10)
|
87
89
|
parser (>= 3.3.0.2)
|
88
90
|
rainbow (>= 2.2.2, < 4.0)
|
89
|
-
regexp_parser (>= 2.
|
90
|
-
rubocop-ast (>= 1.
|
91
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
92
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
91
93
|
ruby-progressbar (~> 1.7)
|
92
|
-
unicode-display_width (>= 2.4.0, <
|
93
|
-
rubocop-ast (1.
|
94
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
95
|
+
rubocop-ast (1.39.0)
|
94
96
|
parser (>= 3.3.1.0)
|
95
97
|
rubocop-performance (1.23.0)
|
96
98
|
rubocop (>= 1.48.1, < 2.0)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../rubocop-powerhome
|
3
3
|
specs:
|
4
|
-
rubocop-powerhome (0.5.
|
5
|
-
rubocop (= 1.
|
4
|
+
rubocop-powerhome (0.5.5)
|
5
|
+
rubocop (= 1.74.0)
|
6
6
|
rubocop-performance
|
7
7
|
rubocop-rails
|
8
8
|
rubocop-rake
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
PATH
|
12
12
|
remote: ..
|
13
13
|
specs:
|
14
|
-
aether_observatory (1.0.
|
14
|
+
aether_observatory (1.0.1)
|
15
15
|
activemodel (>= 6.0.6.1)
|
16
16
|
activesupport (>= 6.0.6.1)
|
17
17
|
|
@@ -49,6 +49,7 @@ GEM
|
|
49
49
|
tomlrb (>= 1.3, < 2.1)
|
50
50
|
with_env (= 1.1.0)
|
51
51
|
xml-simple (~> 1.1.9)
|
52
|
+
lint_roller (1.1.0)
|
52
53
|
method_source (1.1.0)
|
53
54
|
minitest (5.25.4)
|
54
55
|
parallel (1.26.3)
|
@@ -80,17 +81,18 @@ GEM
|
|
80
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
81
82
|
rspec-support (~> 3.13.0)
|
82
83
|
rspec-support (3.13.2)
|
83
|
-
rubocop (1.
|
84
|
+
rubocop (1.74.0)
|
84
85
|
json (~> 2.3)
|
85
|
-
language_server-protocol (
|
86
|
+
language_server-protocol (~> 3.17.0.2)
|
87
|
+
lint_roller (~> 1.1.0)
|
86
88
|
parallel (~> 1.10)
|
87
89
|
parser (>= 3.3.0.2)
|
88
90
|
rainbow (>= 2.2.2, < 4.0)
|
89
|
-
regexp_parser (>= 2.
|
90
|
-
rubocop-ast (>= 1.
|
91
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
92
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
91
93
|
ruby-progressbar (~> 1.7)
|
92
|
-
unicode-display_width (>= 2.4.0, <
|
93
|
-
rubocop-ast (1.
|
94
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
95
|
+
rubocop-ast (1.39.0)
|
94
96
|
parser (>= 3.3.1.0)
|
95
97
|
rubocop-performance (1.23.0)
|
96
98
|
rubocop (>= 1.48.1, < 2.0)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../rubocop-powerhome
|
3
3
|
specs:
|
4
|
-
rubocop-powerhome (0.5.
|
5
|
-
rubocop (= 1.
|
4
|
+
rubocop-powerhome (0.5.5)
|
5
|
+
rubocop (= 1.74.0)
|
6
6
|
rubocop-performance
|
7
7
|
rubocop-rails
|
8
8
|
rubocop-rake
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
PATH
|
12
12
|
remote: ..
|
13
13
|
specs:
|
14
|
-
aether_observatory (1.0.
|
14
|
+
aether_observatory (1.0.1)
|
15
15
|
activemodel (>= 6.0.6.1)
|
16
16
|
activesupport (>= 6.0.6.1)
|
17
17
|
|
@@ -48,6 +48,7 @@ GEM
|
|
48
48
|
tomlrb (>= 1.3, < 2.1)
|
49
49
|
with_env (= 1.1.0)
|
50
50
|
xml-simple (~> 1.1.9)
|
51
|
+
lint_roller (1.1.0)
|
51
52
|
method_source (1.1.0)
|
52
53
|
minitest (5.25.4)
|
53
54
|
parallel (1.26.3)
|
@@ -79,17 +80,18 @@ GEM
|
|
79
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
81
|
rspec-support (~> 3.13.0)
|
81
82
|
rspec-support (3.13.2)
|
82
|
-
rubocop (1.
|
83
|
+
rubocop (1.74.0)
|
83
84
|
json (~> 2.3)
|
84
|
-
language_server-protocol (
|
85
|
+
language_server-protocol (~> 3.17.0.2)
|
86
|
+
lint_roller (~> 1.1.0)
|
85
87
|
parallel (~> 1.10)
|
86
88
|
parser (>= 3.3.0.2)
|
87
89
|
rainbow (>= 2.2.2, < 4.0)
|
88
|
-
regexp_parser (>= 2.
|
89
|
-
rubocop-ast (>= 1.
|
90
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
91
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
90
92
|
ruby-progressbar (~> 1.7)
|
91
|
-
unicode-display_width (>= 2.4.0, <
|
92
|
-
rubocop-ast (1.
|
93
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
94
|
+
rubocop-ast (1.39.0)
|
93
95
|
parser (>= 3.3.1.0)
|
94
96
|
rubocop-performance (1.23.0)
|
95
97
|
rubocop (>= 1.48.1, < 2.0)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../rubocop-powerhome
|
3
3
|
specs:
|
4
|
-
rubocop-powerhome (0.5.
|
5
|
-
rubocop (= 1.
|
4
|
+
rubocop-powerhome (0.5.5)
|
5
|
+
rubocop (= 1.74.0)
|
6
6
|
rubocop-performance
|
7
7
|
rubocop-rails
|
8
8
|
rubocop-rake
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
PATH
|
12
12
|
remote: ..
|
13
13
|
specs:
|
14
|
-
aether_observatory (1.0.
|
14
|
+
aether_observatory (1.0.1)
|
15
15
|
activemodel (>= 6.0.6.1)
|
16
16
|
activesupport (>= 6.0.6.1)
|
17
17
|
|
@@ -61,6 +61,7 @@ GEM
|
|
61
61
|
tomlrb (>= 1.3, < 2.1)
|
62
62
|
with_env (= 1.1.0)
|
63
63
|
xml-simple (~> 1.1.9)
|
64
|
+
lint_roller (1.1.0)
|
64
65
|
logger (1.6.3)
|
65
66
|
method_source (1.1.0)
|
66
67
|
minitest (5.25.4)
|
@@ -94,17 +95,18 @@ GEM
|
|
94
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
95
96
|
rspec-support (~> 3.13.0)
|
96
97
|
rspec-support (3.13.2)
|
97
|
-
rubocop (1.
|
98
|
+
rubocop (1.74.0)
|
98
99
|
json (~> 2.3)
|
99
|
-
language_server-protocol (
|
100
|
+
language_server-protocol (~> 3.17.0.2)
|
101
|
+
lint_roller (~> 1.1.0)
|
100
102
|
parallel (~> 1.10)
|
101
103
|
parser (>= 3.3.0.2)
|
102
104
|
rainbow (>= 2.2.2, < 4.0)
|
103
|
-
regexp_parser (>= 2.
|
104
|
-
rubocop-ast (>= 1.
|
105
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
106
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
105
107
|
ruby-progressbar (~> 1.7)
|
106
|
-
unicode-display_width (>= 2.4.0, <
|
107
|
-
rubocop-ast (1.
|
108
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
109
|
+
rubocop-ast (1.39.0)
|
108
110
|
parser (>= 3.3.1.0)
|
109
111
|
rubocop-performance (1.23.0)
|
110
112
|
rubocop (>= 1.48.1, < 2.0)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AetherObservatory
|
4
|
+
module Backend
|
5
|
+
module Memory
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def instrumented
|
9
|
+
@instrumented ||= []
|
10
|
+
end
|
11
|
+
|
12
|
+
def subscribed
|
13
|
+
@subscribed ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def instrument(event)
|
17
|
+
instrumented << event
|
18
|
+
end
|
19
|
+
|
20
|
+
def subscribe(topic, event)
|
21
|
+
subscribed[topic] ||= []
|
22
|
+
subscribed[topic] << event
|
23
|
+
end
|
24
|
+
|
25
|
+
def unsubscribe(topic)
|
26
|
+
subscribed.delete(topic)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AetherObservatory
|
4
|
+
module Backend
|
5
|
+
module Notifications
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def instrument(event)
|
9
|
+
event.names.each do |event_name|
|
10
|
+
ActiveSupport::Notifications.instrument(event_name, event)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def subscribe(topic, event, *_args)
|
15
|
+
ActiveSupport::Notifications.subscribe(topic) do |*args|
|
16
|
+
event.name.constantize.new(ActiveSupport::Notifications::Event.new(*args)).process
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def unsubscribe(topic)
|
21
|
+
ActiveSupport::Notifications.unsubscribe(topic)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -7,6 +7,8 @@ module AetherObservatory
|
|
7
7
|
include ActiveModel::AttributeAssignment
|
8
8
|
include ActiveModel::Attributes
|
9
9
|
|
10
|
+
class_attribute :backend, default: AetherObservatory::Backend::Notifications
|
11
|
+
|
10
12
|
class << self
|
11
13
|
def inherited(subclass)
|
12
14
|
super
|
@@ -14,14 +16,7 @@ module AetherObservatory
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def create(**attributes)
|
17
|
-
|
18
|
-
event_names_with_prefix.each do |event_name_parts|
|
19
|
-
event_name = event_name_parts.filter_map do |part|
|
20
|
-
event.instance_exec(&part) unless part.nil?
|
21
|
-
end.join(".")
|
22
|
-
logger.debug("[#{name}] Create event for topic: [#{event_name}]")
|
23
|
-
ActiveSupport::Notifications.instrument(event_name, event)
|
24
|
-
end
|
19
|
+
backend.instrument new(**attributes)
|
25
20
|
|
26
21
|
nil
|
27
22
|
end
|
@@ -51,7 +46,7 @@ module AetherObservatory
|
|
51
46
|
def logger(value = nil)
|
52
47
|
@logger = value if value.present?
|
53
48
|
|
54
|
-
@logger || AetherObservatory.config.logger
|
49
|
+
@logger || AetherObservatory.config.logger || Logger.new(nil)
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
@@ -62,5 +57,12 @@ module AetherObservatory
|
|
62
57
|
super()
|
63
58
|
assign_attributes(attributes) if attributes
|
64
59
|
end
|
60
|
+
|
61
|
+
def names
|
62
|
+
prefix = instance_exec(&self.class.event_prefix) if self.class.event_prefix
|
63
|
+
self.class.event_names.map do |event_name|
|
64
|
+
[prefix, instance_exec(&event_name)].compact.join(".")
|
65
|
+
end
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module AetherObservatory
|
4
4
|
class ObserverBase
|
5
|
+
class_attribute :backend, default: AetherObservatory::Backend::Notifications
|
6
|
+
|
5
7
|
class << self
|
6
8
|
def inherited(subclass)
|
7
9
|
super
|
@@ -74,9 +76,7 @@ module AetherObservatory
|
|
74
76
|
|
75
77
|
logger.debug("[#{name}] Registering subscription to topic: #{topic.inspect}")
|
76
78
|
|
77
|
-
subscriptions[topic] =
|
78
|
-
name.constantize.new(ActiveSupport::Notifications::Event.new(*args)).process
|
79
|
-
end
|
79
|
+
subscriptions[topic] = backend.subscribe(topic, self)
|
80
80
|
end
|
81
81
|
|
82
82
|
def unregister_subscription_to(topic)
|
@@ -84,13 +84,13 @@ module AetherObservatory
|
|
84
84
|
|
85
85
|
logger.debug("[#{name}] Unregistering subscription to topic: #{topic.inspect}")
|
86
86
|
|
87
|
-
|
87
|
+
backend.unsubscribe(subscriptions.delete(topic))
|
88
88
|
end
|
89
89
|
|
90
90
|
def logger(value = nil)
|
91
91
|
@logger = value if value.present?
|
92
92
|
|
93
|
-
@logger || AetherObservatory.config.logger
|
93
|
+
@logger || AetherObservatory.config.logger || Logger.new(nil)
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/expectations"
|
4
|
+
require "aether_observatory/backend/memory"
|
5
|
+
|
6
|
+
RSpec::Matchers.define :create_event do |expected, **attrs|
|
7
|
+
match do |actual|
|
8
|
+
actual.call
|
9
|
+
|
10
|
+
AetherObservatory::Backend::Memory.instrumented.any? do |event|
|
11
|
+
(event.is_a?(expected) && attrs.empty?) || RSpec::Matchers::BuiltIn::HaveAttributes.new(attrs).matches?(event)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
failure_message do |*|
|
16
|
+
"Block did not create a #{expected.inspect} #{attrs_message}"
|
17
|
+
end
|
18
|
+
|
19
|
+
failure_message_when_negated do |*|
|
20
|
+
"Block created event(s) #{expected.inspect} #{attrs_message}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def supports_block_expectations?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def attrs_message
|
28
|
+
return unless expected[1].any?
|
29
|
+
|
30
|
+
expected[1].inspect
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module AetherObservatory
|
35
|
+
module Rspec
|
36
|
+
module EventHelper
|
37
|
+
def self.included(base)
|
38
|
+
base.before { AetherObservatory::Backend::Memory.instrumented.clear }
|
39
|
+
base.around do |example|
|
40
|
+
current_backend = AetherObservatory::EventBase.backend
|
41
|
+
AetherObservatory::EventBase.backend = AetherObservatory::Backend::Memory
|
42
|
+
example.run
|
43
|
+
ensure
|
44
|
+
AetherObservatory::EventBase.backend = current_backend
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/aether_observatory.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/all"
|
4
|
+
require "aether_observatory/backend/notifications"
|
4
5
|
require "aether_observatory/configuration"
|
6
|
+
require "aether_observatory/railtie" if defined?(Rails)
|
5
7
|
|
6
8
|
module AetherObservatory
|
7
9
|
mattr_accessor :configuration, default: Configuration
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aether_observatory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terry Finn
|
8
8
|
- Justin Stanczak
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activemodel
|
@@ -174,13 +173,16 @@ extensions: []
|
|
174
173
|
extra_rdoc_files: []
|
175
174
|
files:
|
176
175
|
- ".rubocop.yml"
|
176
|
+
- ".rubocop_todo.yml"
|
177
177
|
- Appraisals
|
178
178
|
- Gemfile
|
179
|
+
- Gemfile.lock
|
179
180
|
- Rakefile
|
180
181
|
- aether_observatory.gemspec
|
181
182
|
- doc/dependency_decisions.yml
|
182
183
|
- docs/CHANGELOG.md
|
183
184
|
- docs/README.md
|
185
|
+
- gemfiles/.bundle/config
|
184
186
|
- gemfiles/rails_6_0.gemfile
|
185
187
|
- gemfiles/rails_6_0.gemfile.lock
|
186
188
|
- gemfiles/rails_6_1.gemfile
|
@@ -191,9 +193,14 @@ files:
|
|
191
193
|
- gemfiles/rails_7_1.gemfile.lock
|
192
194
|
- lib/aether_observatory.rb
|
193
195
|
- lib/aether_observatory/README.md
|
196
|
+
- lib/aether_observatory/backend/memory.rb
|
197
|
+
- lib/aether_observatory/backend/notifications.rb
|
194
198
|
- lib/aether_observatory/configuration.rb
|
195
199
|
- lib/aether_observatory/event_base.rb
|
196
200
|
- lib/aether_observatory/observer_base.rb
|
201
|
+
- lib/aether_observatory/railtie.rb
|
202
|
+
- lib/aether_observatory/rspec.rb
|
203
|
+
- lib/aether_observatory/rspec/event_helper.rb
|
197
204
|
- lib/aether_observatory/version.rb
|
198
205
|
- mkdocs.yml
|
199
206
|
homepage: https://github.com/powerhome/power-tools
|
@@ -204,7 +211,6 @@ metadata:
|
|
204
211
|
homepage_uri: https://github.com/powerhome/power-tools
|
205
212
|
source_code_uri: https://github.com/powerhome/power-tools
|
206
213
|
changelog_uri: https://github.com/powerhome/power-tools/blob/main/packages/aether_observatory/docs/CHANGELOG.md
|
207
|
-
post_install_message:
|
208
214
|
rdoc_options: []
|
209
215
|
require_paths:
|
210
216
|
- lib
|
@@ -219,8 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
225
|
- !ruby/object:Gem::Version
|
220
226
|
version: '0'
|
221
227
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
223
|
-
signing_key:
|
228
|
+
rubygems_version: 3.6.9
|
224
229
|
specification_version: 4
|
225
230
|
summary: Aether Observatory
|
226
231
|
test_files: []
|