stenotype 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -2
- data/CHANGELOG.md +26 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +111 -60
- data/README.md +5 -5
- data/Rakefile +2 -2
- data/TODO.md +18 -0
- data/bin/console +3 -3
- data/lib/generators/USAGE +8 -0
- data/lib/generators/stenotype/initializer/initializer_generator.rb +23 -0
- data/lib/generators/stenotype/initializer/templates/initializer.rb.erb +65 -0
- data/lib/stenotype.rb +24 -85
- data/lib/stenotype/adapters.rb +3 -3
- data/lib/stenotype/adapters/base.rb +10 -0
- data/lib/stenotype/adapters/google_cloud.rb +53 -21
- data/lib/stenotype/adapters/stdout_adapter.rb +23 -1
- data/lib/stenotype/configuration.rb +91 -36
- data/lib/stenotype/context_handlers.rb +6 -8
- data/lib/stenotype/context_handlers/base.rb +14 -3
- data/lib/stenotype/context_handlers/collection.rb +78 -34
- data/lib/stenotype/context_handlers/rails/active_job.rb +3 -11
- data/lib/stenotype/context_handlers/rails/controller.rb +10 -11
- data/lib/stenotype/dispatcher.rb +1 -2
- data/lib/stenotype/emitter.rb +162 -0
- data/lib/stenotype/event.rb +8 -9
- data/lib/stenotype/event_serializer.rb +25 -5
- data/lib/stenotype/frameworks/rails/action_controller.rb +41 -19
- data/lib/stenotype/frameworks/rails/active_job.rb +3 -5
- data/lib/stenotype/railtie.rb +37 -0
- data/lib/stenotype/version.rb +1 -1
- data/stenotype.gemspec +30 -26
- metadata +69 -19
- data/lib/stenotype/exceptions.rb +0 -31
- data/lib/stenotype/frameworks/object_ext.rb +0 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cad5a62bd56d635becd56bf9bae4d6421879d29952473fd507ae60885ea4723e
|
4
|
+
data.tar.gz: 0b2d65ef6e1f9a84bd369d908f4133f3787156fcc5a6b46a194b4193fa735411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c025894e106d650dcfe1bab82cf878b89a561eaae8a7eb23246a8d01a34800460a17734f55da518602d504a554b41648f6039d3174b2747d093dba8fbfbb0f26
|
7
|
+
data.tar.gz: 790e1a50a3fabff8db4c62017a556532b8acf3f1df6a330b91dfafba0e1af1701335f8463688fb8d201b75420542fd6cbba054939d33cd80e400e87b07100ed3
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
*Release Date*: 2019/11/21
|
4
|
+
|
5
|
+
### 0.1.1: 2019/11/25
|
6
|
+
|
7
|
+
* Moves all error into top level namespace definition file.
|
8
|
+
* Introduces a root class for all gem specific errors.
|
9
|
+
* Renames ObjectExt to an Eventable concern.
|
10
|
+
* Changes the aggressive extension of Object, forces a user to include the Eventable module only where necessary.
|
11
|
+
* Moves all rails specific logic into a Railtie, which is required only if in Rails universe.
|
12
|
+
* Adds more examples to yard documentation of the classes.
|
13
|
+
* Adds a TODO list based on the feedback.
|
14
|
+
* Grinds a huge GoogleCloud adapter method into smaller ones.
|
15
|
+
* Add two 'on/off' configuration options for Rails specific components.
|
16
|
+
* Switches to using rails specific delegate method where possible (in rails components extensions).
|
17
|
+
|
18
|
+
### 0.1.0: The Big Bang
|
19
|
+
|
20
|
+
* Rails controller and active job adapters
|
21
|
+
* Generic event method
|
22
|
+
* Handlers for GCP Pub/Sub and STDOUT
|
23
|
+
* Initial commit
|
24
|
+
|
25
|
+
|
26
|
+
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,50 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stenotype (0.1.
|
4
|
+
stenotype (0.1.1)
|
5
5
|
activesupport (>= 5.0.0)
|
6
6
|
google-cloud-pubsub (~> 1.0.0)
|
7
|
+
spicery (>= 0.19.0, < 1.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
actioncable (5.2.
|
12
|
-
actionpack (= 5.2.
|
12
|
+
actioncable (5.2.4)
|
13
|
+
actionpack (= 5.2.4)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailer (5.2.
|
16
|
-
actionpack (= 5.2.
|
17
|
-
actionview (= 5.2.
|
18
|
-
activejob (= 5.2.
|
16
|
+
actionmailer (5.2.4)
|
17
|
+
actionpack (= 5.2.4)
|
18
|
+
actionview (= 5.2.4)
|
19
|
+
activejob (= 5.2.4)
|
19
20
|
mail (~> 2.5, >= 2.5.4)
|
20
21
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.2.
|
22
|
-
actionview (= 5.2.
|
23
|
-
activesupport (= 5.2.
|
22
|
+
actionpack (5.2.4)
|
23
|
+
actionview (= 5.2.4)
|
24
|
+
activesupport (= 5.2.4)
|
24
25
|
rack (~> 2.0)
|
25
26
|
rack-test (>= 0.6.3)
|
26
27
|
rails-dom-testing (~> 2.0)
|
27
28
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.2.
|
29
|
-
activesupport (= 5.2.
|
29
|
+
actionview (5.2.4)
|
30
|
+
activesupport (= 5.2.4)
|
30
31
|
builder (~> 3.1)
|
31
32
|
erubi (~> 1.4)
|
32
33
|
rails-dom-testing (~> 2.0)
|
33
34
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.2.
|
35
|
-
activesupport (= 5.2.
|
35
|
+
activejob (5.2.4)
|
36
|
+
activesupport (= 5.2.4)
|
36
37
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.2.
|
38
|
-
activesupport (= 5.2.
|
39
|
-
activerecord (5.2.
|
40
|
-
activemodel (= 5.2.
|
41
|
-
activesupport (= 5.2.
|
38
|
+
activemodel (5.2.4)
|
39
|
+
activesupport (= 5.2.4)
|
40
|
+
activerecord (5.2.4)
|
41
|
+
activemodel (= 5.2.4)
|
42
|
+
activesupport (= 5.2.4)
|
42
43
|
arel (>= 9.0)
|
43
|
-
activestorage (5.2.
|
44
|
-
actionpack (= 5.2.
|
45
|
-
activerecord (= 5.2.
|
44
|
+
activestorage (5.2.4)
|
45
|
+
actionpack (= 5.2.4)
|
46
|
+
activerecord (= 5.2.4)
|
46
47
|
marcel (~> 0.3.1)
|
47
|
-
activesupport (5.2.
|
48
|
+
activesupport (5.2.4)
|
48
49
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
50
|
i18n (>= 0.7, < 2)
|
50
51
|
minitest (~> 5.1)
|
@@ -52,17 +53,29 @@ GEM
|
|
52
53
|
addressable (2.7.0)
|
53
54
|
public_suffix (>= 2.0.2, < 5.0)
|
54
55
|
arel (9.0.0)
|
56
|
+
around_the_world (0.19.2)
|
57
|
+
activesupport (>= 5.2.1)
|
55
58
|
ast (2.4.0)
|
56
59
|
builder (3.2.3)
|
57
60
|
coderay (1.1.2)
|
61
|
+
collectible (0.19.2)
|
62
|
+
activesupport (>= 5.2.1)
|
63
|
+
short_circu_it (= 0.19.2)
|
64
|
+
tablesalt (= 0.19.2)
|
58
65
|
concurrent-ruby (1.1.5)
|
66
|
+
conjunction (0.19.2)
|
67
|
+
activesupport (>= 5.2.1)
|
59
68
|
crass (1.0.5)
|
60
69
|
diff-lcs (1.3)
|
61
70
|
docile (1.3.2)
|
62
71
|
erubi (1.9.0)
|
72
|
+
facet (0.19.2)
|
73
|
+
activesupport (>= 5.2.1)
|
74
|
+
short_circu_it (= 0.19.2)
|
75
|
+
tablesalt (= 0.19.2)
|
63
76
|
faker (1.9.6)
|
64
77
|
i18n (>= 0.7)
|
65
|
-
faraday (0.17.
|
78
|
+
faraday (0.17.1)
|
66
79
|
multipart-post (>= 1.2, < 3)
|
67
80
|
github-markup (3.0.4)
|
68
81
|
globalid (0.4.2)
|
@@ -83,7 +96,7 @@ GEM
|
|
83
96
|
googleauth (~> 0.9)
|
84
97
|
grpc (~> 1.24)
|
85
98
|
rly (~> 0.2.3)
|
86
|
-
google-protobuf (3.
|
99
|
+
google-protobuf (3.11.1)
|
87
100
|
googleapis-common-protos (1.3.9)
|
88
101
|
google-protobuf (~> 3.0)
|
89
102
|
googleapis-common-protos-types (~> 1.0)
|
@@ -97,7 +110,7 @@ GEM
|
|
97
110
|
multi_json (~> 1.11)
|
98
111
|
os (>= 0.9, < 2.0)
|
99
112
|
signet (~> 0.12)
|
100
|
-
grpc (1.25.0
|
113
|
+
grpc (1.25.0)
|
101
114
|
google-protobuf (~> 3.8)
|
102
115
|
googleapis-common-protos-types (~> 1.0)
|
103
116
|
grpc-google-iam-v1 (0.6.9)
|
@@ -108,26 +121,26 @@ GEM
|
|
108
121
|
jaro_winkler (1.5.4)
|
109
122
|
json (2.2.0)
|
110
123
|
jwt (2.2.1)
|
111
|
-
loofah (2.
|
124
|
+
loofah (2.4.0)
|
112
125
|
crass (~> 1.0.2)
|
113
126
|
nokogiri (>= 1.5.9)
|
114
127
|
mail (2.7.1)
|
115
128
|
mini_mime (>= 0.1.1)
|
116
129
|
marcel (0.3.3)
|
117
130
|
mimemagic (~> 0.3.2)
|
118
|
-
memoist (0.16.
|
131
|
+
memoist (0.16.2)
|
119
132
|
method_source (0.9.2)
|
120
133
|
mimemagic (0.3.3)
|
121
134
|
mini_mime (1.0.2)
|
122
135
|
mini_portile2 (2.4.0)
|
123
|
-
minitest (5.
|
136
|
+
minitest (5.13.0)
|
124
137
|
multi_json (1.14.1)
|
125
138
|
multipart-post (2.1.1)
|
126
139
|
nio4r (2.5.2)
|
127
|
-
nokogiri (1.10.
|
140
|
+
nokogiri (1.10.7)
|
128
141
|
mini_portile2 (~> 2.4.0)
|
129
142
|
os (1.0.1)
|
130
|
-
parallel (1.
|
143
|
+
parallel (1.19.1)
|
131
144
|
parser (2.6.5.0)
|
132
145
|
ast (~> 2.4.0)
|
133
146
|
pry (0.12.2)
|
@@ -137,58 +150,73 @@ GEM
|
|
137
150
|
rack (2.0.7)
|
138
151
|
rack-test (1.1.0)
|
139
152
|
rack (>= 1.0, < 3)
|
140
|
-
rails (5.2.
|
141
|
-
actioncable (= 5.2.
|
142
|
-
actionmailer (= 5.2.
|
143
|
-
actionpack (= 5.2.
|
144
|
-
actionview (= 5.2.
|
145
|
-
activejob (= 5.2.
|
146
|
-
activemodel (= 5.2.
|
147
|
-
activerecord (= 5.2.
|
148
|
-
activestorage (= 5.2.
|
149
|
-
activesupport (= 5.2.
|
153
|
+
rails (5.2.4)
|
154
|
+
actioncable (= 5.2.4)
|
155
|
+
actionmailer (= 5.2.4)
|
156
|
+
actionpack (= 5.2.4)
|
157
|
+
actionview (= 5.2.4)
|
158
|
+
activejob (= 5.2.4)
|
159
|
+
activemodel (= 5.2.4)
|
160
|
+
activerecord (= 5.2.4)
|
161
|
+
activestorage (= 5.2.4)
|
162
|
+
activesupport (= 5.2.4)
|
150
163
|
bundler (>= 1.3.0)
|
151
|
-
railties (= 5.2.
|
164
|
+
railties (= 5.2.4)
|
152
165
|
sprockets-rails (>= 2.0.0)
|
153
166
|
rails-dom-testing (2.0.3)
|
154
167
|
activesupport (>= 4.2.0)
|
155
168
|
nokogiri (>= 1.6)
|
156
169
|
rails-html-sanitizer (1.3.0)
|
157
170
|
loofah (~> 2.3)
|
158
|
-
railties (5.2.
|
159
|
-
actionpack (= 5.2.
|
160
|
-
activesupport (= 5.2.
|
171
|
+
railties (5.2.4)
|
172
|
+
actionpack (= 5.2.4)
|
173
|
+
activesupport (= 5.2.4)
|
161
174
|
method_source
|
162
175
|
rake (>= 0.8.7)
|
163
176
|
thor (>= 0.19.0, < 2.0)
|
164
177
|
rainbow (3.0.0)
|
165
178
|
rake (10.5.0)
|
166
179
|
redcarpet (3.5.0)
|
180
|
+
redis (4.1.3)
|
181
|
+
redis_hash (0.19.2)
|
182
|
+
activesupport (>= 5.2.1)
|
183
|
+
redis (>= 3.0)
|
184
|
+
tablesalt (= 0.19.2)
|
167
185
|
rly (0.2.3)
|
168
|
-
rspec (3.
|
169
|
-
rspec-core (~> 3.
|
170
|
-
rspec-expectations (~> 3.
|
171
|
-
rspec-mocks (~> 3.
|
172
|
-
rspec-core (3.
|
173
|
-
rspec-support (~> 3.
|
174
|
-
rspec-expectations (3.
|
186
|
+
rspec (3.9.0)
|
187
|
+
rspec-core (~> 3.9.0)
|
188
|
+
rspec-expectations (~> 3.9.0)
|
189
|
+
rspec-mocks (~> 3.9.0)
|
190
|
+
rspec-core (3.9.0)
|
191
|
+
rspec-support (~> 3.9.0)
|
192
|
+
rspec-expectations (3.9.0)
|
175
193
|
diff-lcs (>= 1.2.0, < 2.0)
|
176
|
-
rspec-support (~> 3.
|
177
|
-
rspec-mocks (3.
|
194
|
+
rspec-support (~> 3.9.0)
|
195
|
+
rspec-mocks (3.9.0)
|
178
196
|
diff-lcs (>= 1.2.0, < 2.0)
|
179
|
-
rspec-support (~> 3.
|
180
|
-
rspec-support (3.
|
181
|
-
rspice (0.
|
182
|
-
faker (
|
197
|
+
rspec-support (~> 3.9.0)
|
198
|
+
rspec-support (3.9.0)
|
199
|
+
rspice (0.19.2)
|
200
|
+
faker (>= 1.8, < 2.0)
|
183
201
|
rspec (~> 3.0)
|
184
|
-
rubocop (0.
|
202
|
+
rubocop (0.74.0)
|
185
203
|
jaro_winkler (~> 1.5.1)
|
186
204
|
parallel (~> 1.10)
|
187
205
|
parser (>= 2.6)
|
188
206
|
rainbow (>= 2.2.2, < 4.0)
|
189
207
|
ruby-progressbar (~> 1.7)
|
190
208
|
unicode-display_width (>= 1.4.0, < 1.7)
|
209
|
+
rubocop-performance (1.4.1)
|
210
|
+
rubocop (>= 0.71.0)
|
211
|
+
rubocop-rails (2.3.0)
|
212
|
+
rack (>= 1.1)
|
213
|
+
rubocop (>= 0.72.0)
|
214
|
+
rubocop-rspec (1.35.0)
|
215
|
+
rubocop (>= 0.60.0)
|
191
216
|
ruby-progressbar (1.10.1)
|
217
|
+
short_circu_it (0.19.2)
|
218
|
+
activesupport (>= 5.2.1)
|
219
|
+
around_the_world (= 0.19.2)
|
192
220
|
signet (0.12.0)
|
193
221
|
addressable (~> 2.3)
|
194
222
|
faraday (~> 0.9)
|
@@ -199,6 +227,22 @@ GEM
|
|
199
227
|
json (>= 1.8, < 3)
|
200
228
|
simplecov-html (~> 0.10.0)
|
201
229
|
simplecov-html (0.10.2)
|
230
|
+
spicerack (0.19.2)
|
231
|
+
around_the_world (= 0.19.2)
|
232
|
+
redis_hash (= 0.19.2)
|
233
|
+
short_circu_it (= 0.19.2)
|
234
|
+
tablesalt (= 0.19.2)
|
235
|
+
technologic (= 0.19.2)
|
236
|
+
spicerack-styleguide (0.19.2)
|
237
|
+
rubocop (= 0.74)
|
238
|
+
rubocop-performance (= 1.4.1)
|
239
|
+
rubocop-rails (= 2.3.0)
|
240
|
+
rubocop-rspec (= 1.35.0)
|
241
|
+
spicery (0.19.2)
|
242
|
+
collectible (= 0.19.2)
|
243
|
+
conjunction (= 0.19.2)
|
244
|
+
facet (= 0.19.2)
|
245
|
+
spicerack (= 0.19.2)
|
202
246
|
sprockets (4.0.0)
|
203
247
|
concurrent-ruby (~> 1.0)
|
204
248
|
rack (> 1, < 3)
|
@@ -206,6 +250,13 @@ GEM
|
|
206
250
|
actionpack (>= 4.0)
|
207
251
|
activesupport (>= 4.0)
|
208
252
|
sprockets (>= 3.0.0)
|
253
|
+
tablesalt (0.19.2)
|
254
|
+
activemodel (>= 5.2.1)
|
255
|
+
activesupport (>= 5.2.1)
|
256
|
+
technologic (0.19.2)
|
257
|
+
activesupport (>= 5.2.1)
|
258
|
+
railties (>= 5.2.1)
|
259
|
+
short_circu_it (= 0.19.2)
|
209
260
|
thor (0.20.3)
|
210
261
|
thread_safe (0.3.6)
|
211
262
|
timecop (0.9.1)
|
@@ -229,8 +280,8 @@ DEPENDENCIES
|
|
229
280
|
redcarpet (~> 3.5)
|
230
281
|
rspec (~> 3.0)
|
231
282
|
rspice
|
232
|
-
rubocop (~> 0.76)
|
233
283
|
simplecov (~> 0.17)
|
284
|
+
spicerack-styleguide (>= 0.19.0, < 1.0)
|
234
285
|
stenotype!
|
235
286
|
timecop (~> 0.9)
|
236
287
|
yard (~> 0.9)
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ This gem is a tool providing extensions to several rails components in order to
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem
|
10
|
+
gem "Stenotype"
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -32,9 +32,9 @@ Stenotype.configure do |config|
|
|
32
32
|
|
33
33
|
config.uuid_generator = SecureRandom
|
34
34
|
config.dispatcher = Stenotype::Dispatcher.new
|
35
|
-
config.gc_project_id =
|
36
|
-
config.gc_credentials =
|
37
|
-
config.gc_topic =
|
35
|
+
config.gc_project_id = "google_cloud_project_id"
|
36
|
+
config.gc_credentials = "path_to_key_json"
|
37
|
+
config.gc_topic = "google_cloud_topic"
|
38
38
|
config.gc_mode = :async # either :sync or :async
|
39
39
|
end
|
40
40
|
```
|
@@ -150,7 +150,7 @@ class BaseClass
|
|
150
150
|
attr_reader :local_state
|
151
151
|
|
152
152
|
def initialize
|
153
|
-
@local_state =
|
153
|
+
@local_state = "some state"
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -15,3 +15,21 @@
|
|
15
15
|
- [ ] Figure out the params for plain ruby class context handler.
|
16
16
|
- [ ] Consider `ContextHandlers::ActiveJob` params. How to deal with \_args? It won't necessarily respond to `#as_json`.
|
17
17
|
- [ ] Consider a way to switch from evaluating ruby code to using plain modules extension.
|
18
|
+
|
19
|
+
Feedback TODO:
|
20
|
+
|
21
|
+
- [x] Move all exceptions into root module Stenotype. **Moved exceptions into root module**
|
22
|
+
- [x] Inherit gem specific error from a root error object specific for the gem. **All gem specific error inherit from Stenotype::Errors**
|
23
|
+
- [x] Inherit the root error from standard error. **Stenotype::Errors inherits from StandardError**
|
24
|
+
- [x] Utilize concerns and allow gem users to extend the code they need with a concern rather than aggressively extend Object. **Added an Stenotype::Emitter module instead of aggressively including it into Object**
|
25
|
+
- [x] Use Railtie to introduce rails specific logic instead of checking whether Rails is defined in the root module. **Added a Railtie, active only in Rails world**
|
26
|
+
- [?] Use delegation instead of defining tiny methods. Do not forget about Demeter's. **Rails `delegate` method is used in Rails specific extensions. Otherwise simple methods are used**
|
27
|
+
- [x] Add more examples to yard documentation, consider collecting README.md from the yard doc. **Covered most of the classes/modules with yard examples**
|
28
|
+
- [x] Enable on-off triggers in the configuration to enable/disable framework specific features. Like whether we want to extend ActiveJob or not. **Added two configuration options for currently implemented Rails extensions**
|
29
|
+
- [x] Memoization! **Not actually needed**
|
30
|
+
- [ ] Consider potential double wrapping in the meta-programming stuff. Take a look at around-the-world and consider switching to using it.
|
31
|
+
- [ ] Utilize input objects for attr_readers (what was the name of the tool?)
|
32
|
+
- [ ] Consider configurable for configuration instead of implementing custom configuration object
|
33
|
+
- [ ] Consider using collectible gem to handle collection of context handlers
|
34
|
+
- [ ] Consider naming (e.g. #as_json => #to_h), try to be more specific to not pollute the namespace or introduce any ambiguity.
|
35
|
+
- [ ] Remove freshly mentions from the gem.
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "bundler/setup"
|
5
|
+
require "stenotype"
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require 'stenotype'
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require "pry"
|
15
15
|
Pry.start(__FILE__)
|