cyclone_lariat 0.3.10 → 1.0.0.rc1

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.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/gem-push.yml +4 -4
  3. data/.gitignore +6 -0
  4. data/.rubocop.yml +30 -1
  5. data/CHANGELOG.md +11 -1
  6. data/Gemfile.lock +137 -30
  7. data/Guardfile +42 -0
  8. data/README.md +715 -143
  9. data/Rakefile +2 -5
  10. data/bin/cyclone_lariat +206 -0
  11. data/cyclone_lariat.gemspec +13 -2
  12. data/lib/cyclone_lariat/clients/abstract.rb +40 -0
  13. data/lib/cyclone_lariat/clients/sns.rb +163 -0
  14. data/lib/cyclone_lariat/clients/sqs.rb +114 -0
  15. data/lib/cyclone_lariat/core.rb +21 -0
  16. data/lib/cyclone_lariat/errors.rb +38 -0
  17. data/lib/cyclone_lariat/fake.rb +19 -0
  18. data/lib/cyclone_lariat/generators/command.rb +53 -0
  19. data/lib/cyclone_lariat/generators/event.rb +52 -0
  20. data/lib/cyclone_lariat/generators/queue.rb +30 -0
  21. data/lib/cyclone_lariat/generators/topic.rb +29 -0
  22. data/lib/cyclone_lariat/messages/v1/abstract.rb +139 -0
  23. data/lib/cyclone_lariat/messages/v1/command.rb +20 -0
  24. data/lib/cyclone_lariat/messages/v1/event.rb +20 -0
  25. data/lib/cyclone_lariat/messages/v1/validator.rb +31 -0
  26. data/lib/cyclone_lariat/messages/v2/abstract.rb +149 -0
  27. data/lib/cyclone_lariat/messages/v2/command.rb +20 -0
  28. data/lib/cyclone_lariat/messages/v2/event.rb +20 -0
  29. data/lib/cyclone_lariat/messages/v2/validator.rb +39 -0
  30. data/lib/cyclone_lariat/middleware.rb +9 -5
  31. data/lib/cyclone_lariat/migration.rb +151 -0
  32. data/lib/cyclone_lariat/options.rb +52 -0
  33. data/lib/cyclone_lariat/presenters/graph.rb +54 -0
  34. data/lib/cyclone_lariat/presenters/queues.rb +41 -0
  35. data/lib/cyclone_lariat/presenters/subscriptions.rb +34 -0
  36. data/lib/cyclone_lariat/presenters/topics.rb +40 -0
  37. data/lib/cyclone_lariat/publisher.rb +25 -0
  38. data/lib/cyclone_lariat/repo/active_record/messages.rb +92 -0
  39. data/lib/cyclone_lariat/repo/active_record/versions.rb +28 -0
  40. data/lib/cyclone_lariat/repo/messages.rb +43 -0
  41. data/lib/cyclone_lariat/repo/messages_mapper.rb +49 -0
  42. data/lib/cyclone_lariat/repo/sequel/messages.rb +73 -0
  43. data/lib/cyclone_lariat/repo/sequel/versions.rb +28 -0
  44. data/lib/cyclone_lariat/repo/versions.rb +42 -0
  45. data/lib/cyclone_lariat/resources/queue.rb +167 -0
  46. data/lib/cyclone_lariat/resources/topic.rb +132 -0
  47. data/lib/cyclone_lariat/services/migrate.rb +51 -0
  48. data/lib/cyclone_lariat/services/rollback.rb +51 -0
  49. data/lib/cyclone_lariat/version.rb +1 -1
  50. data/lib/cyclone_lariat.rb +4 -10
  51. data/lib/tasks/console.rake +13 -0
  52. data/lib/tasks/cyclone_lariat.rake +42 -0
  53. data/lib/tasks/db.rake +0 -15
  54. metadata +161 -20
  55. data/config/db.example.rb +0 -9
  56. data/db/migrate/01_add_uuid_extensions.rb +0 -15
  57. data/db/migrate/02_add_events.rb +0 -19
  58. data/docs/_imgs/diagram.png +0 -0
  59. data/docs/_imgs/lariat.jpg +0 -0
  60. data/lib/cyclone_lariat/abstract/client.rb +0 -106
  61. data/lib/cyclone_lariat/abstract/message.rb +0 -83
  62. data/lib/cyclone_lariat/command.rb +0 -13
  63. data/lib/cyclone_lariat/configure.rb +0 -15
  64. data/lib/cyclone_lariat/event.rb +0 -13
  65. data/lib/cyclone_lariat/messages_mapper.rb +0 -46
  66. data/lib/cyclone_lariat/messages_repo.rb +0 -60
  67. data/lib/cyclone_lariat/sns_client.rb +0 -38
  68. data/lib/cyclone_lariat/sqs_client.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: db8b83a45f403749ab3ab2503f22e85af53cce8fc3267a63eb31df0246d30683
4
- data.tar.gz: 31ed6ee400d6778d90adf90ef997cc577df5564b78238cdc36b8067ff9fcaff9
2
+ SHA1:
3
+ metadata.gz: 31cc88737fffda51fb2ba2f1ef8ea792adcd3d7d
4
+ data.tar.gz: 520aef70c935d03db0f7624a253f62ac6dddeaa7
5
5
  SHA512:
6
- metadata.gz: f73b11ffa6189231a1ebd71dcb7db455fbc092aaa00e740b4b1092006dd4db38550ddbb94ccc0266dc1bf4f467d481110a92061344fb1a6fa22e92ef48995b4b
7
- data.tar.gz: d06087c237bbc3946c7e91772a987edf47b787ccd0f8e1c6e0f341f32fa6c7965b1546dcc7e188967baafaac19dd140ddca0d1cdbafb82ce68ab736d965271ef
6
+ metadata.gz: 062f76a7ef10d61bd94e624e4db72619ace3bf3d7ee05ab0ec7b32ecbca8895afda9dc060390aa0c157e1ae843a6e6bce99e815a965c6fde3e49655e9ceb3709
7
+ data.tar.gz: 91adda66efabdd82c60e2e1fb2f1a602a4b3c6f26300c5d3c82ac923466024fee705d5012d5c9cecae671081af0c91cbda52291ef3e896f4d182914f3f125ec1
@@ -13,11 +13,11 @@ jobs:
13
13
  packages: write
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v2
17
- - name: Set up Ruby 2.6
18
- uses: actions/setup-ruby@v1
16
+ - uses: actions/checkout@v3
17
+ - name: Set up Ruby 2.4
18
+ uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 2.6.x
20
+ ruby-version: '2.4.6'
21
21
 
22
22
  - name: Publish to GPR
23
23
  run: |
data/.gitignore CHANGED
@@ -20,3 +20,9 @@ config/db.rb
20
20
  # docker-compose
21
21
  /local/
22
22
  /privatekey
23
+
24
+ # lariat initializer
25
+ config/initializers/cyclone_lariat.rb
26
+
27
+ # lariat migrate
28
+ lariat/**/*
data/.rubocop.yml CHANGED
@@ -18,6 +18,8 @@ Metrics/LineLength:
18
18
  IgnoredPatterns: ['\s*\#\s.*$']
19
19
  Exclude:
20
20
  - 'spec/**/*'
21
+ - 'lib/cyclone_lariat/abstract/client.rb'
22
+ - 'lib/cyclone_lariat/migration.rb'
21
23
 
22
24
  Style/Documentation:
23
25
  Exclude:
@@ -27,17 +29,30 @@ Metrics/ParameterLists:
27
29
  Exclude:
28
30
  - '**/*'
29
31
 
32
+ Metrics/MethodLength:
33
+ Exclude:
34
+ - '**/*'
35
+
30
36
  Style/AccessorGrouping:
31
37
  Exclude:
32
38
  - 'lib/cyclone_lariat/event.rb'
39
+ - 'lib/cyclone_lariat/messages/abstract.rb'
40
+
41
+ Layout/EmptyLinesAroundAttributeAccessor:
42
+ Exclude:
43
+ - 'lib/cyclone_lariat/messages/abstract.rb'
33
44
 
34
45
  Metrics/CyclomaticComplexity:
35
46
  Exclude:
36
47
  - 'lib/cyclone_lariat/event.rb'
37
- -
48
+ - 'lib/cyclone_lariat/messages/abstract.rb'
49
+ - 'lib/cyclone_lariat/migration.rb'
50
+
38
51
  Metrics/PerceivedComplexity:
39
52
  Exclude:
40
53
  - 'lib/cyclone_lariat/event.rb'
54
+ - 'lib/cyclone_lariat/messages/abstract.rb'
55
+ - 'lib/cyclone_lariat/migration.rb'
41
56
 
42
57
  Metrics/AbcSize:
43
58
  Exclude:
@@ -46,3 +61,17 @@ Metrics/AbcSize:
46
61
  Metrics/BlockLength:
47
62
  Exclude:
48
63
  - '**/*'
64
+ -
65
+ Layout/FirstHashElementIndentation:
66
+ Exclude:
67
+ - '**/*'
68
+
69
+ Metrics/ClassLength:
70
+ Exclude:
71
+ - 'lib/cyclone_lariat/migration.rb'
72
+ - 'lib/cyclone_lariat/abstract/client.rb'
73
+ - 'lib/cyclone_lariat/sns.rb'
74
+
75
+ Lint/RescueException:
76
+ Exclude:
77
+ - 'lib/cyclone_lariat/middleware.rb'
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.4.0]
8
+ Changed
9
+ - rename `topic` to `queue` for SQS operations, in fact it changed only in methods `publish_event`, `publish_command`
10
+ if you defined custom queue name
11
+ - rename client_id to account_id
12
+ - send_at no iso8601 format
13
+ - A lot of changes, see README.md
14
+ Added
15
+ - Migrations for create, delete and subscribe topics and queues
16
+ - request_id for Event and Command
17
+
7
18
  ## [0.3.10] - 2022-10-05
8
19
  Added
9
20
  - Added aws_client_od options
@@ -15,7 +26,6 @@ Added
15
26
  - Added configuration options see README.md
16
27
 
17
28
  ## [0.3.8] - 2022-09-05
18
- Added
19
29
  - Added configuration options see README.md
20
30
 
21
31
  ## [0.3.8] - 2022-09-05
data/Gemfile.lock CHANGED
@@ -1,48 +1,140 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cyclone_lariat (0.3.10)
4
+ cyclone_lariat (1.0.0.rc1)
5
5
  aws-sdk-sns
6
6
  aws-sdk-sqs
7
+ dry-cli (~> 0.6)
8
+ dry-validation (~> 1.5)
7
9
  luna_park (~> 0.11)
10
+ terminal-table (~> 3.0)
8
11
 
9
12
  GEM
10
13
  remote: https://rubygems.org/
11
14
  specs:
12
- addressable (2.8.0)
13
- public_suffix (>= 2.0.2, < 5.0)
15
+ activemodel (5.2.8.1)
16
+ activesupport (= 5.2.8.1)
17
+ activerecord (5.2.8.1)
18
+ activemodel (= 5.2.8.1)
19
+ activesupport (= 5.2.8.1)
20
+ arel (>= 9.0)
21
+ activesupport (5.2.8.1)
22
+ concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ i18n (>= 0.7, < 2)
24
+ minitest (~> 5.1)
25
+ tzinfo (~> 1.1)
26
+ addressable (2.8.1)
27
+ public_suffix (>= 2.0.2, < 6.0)
28
+ arel (9.0.0)
14
29
  ast (2.4.2)
15
30
  aws-eventstream (1.2.0)
16
- aws-partitions (1.641.0)
17
- aws-sdk-core (3.158.0)
31
+ aws-partitions (1.694.0)
32
+ aws-sdk-core (3.168.4)
18
33
  aws-eventstream (~> 1, >= 1.0.2)
19
- aws-partitions (~> 1, >= 1.525.0)
20
- aws-sigv4 (~> 1.1)
34
+ aws-partitions (~> 1, >= 1.651.0)
35
+ aws-sigv4 (~> 1.5)
21
36
  jmespath (~> 1, >= 1.6.1)
22
- aws-sdk-sns (1.55.0)
23
- aws-sdk-core (~> 3, >= 3.127.0)
37
+ aws-sdk-sns (1.57.0)
38
+ aws-sdk-core (~> 3, >= 3.165.0)
24
39
  aws-sigv4 (~> 1.1)
25
- aws-sdk-sqs (1.51.1)
26
- aws-sdk-core (~> 3, >= 3.127.0)
40
+ aws-sdk-sqs (1.52.1)
41
+ aws-sdk-core (~> 3, >= 3.165.0)
27
42
  aws-sigv4 (~> 1.1)
28
43
  aws-sigv4 (1.5.2)
29
44
  aws-eventstream (~> 1, >= 1.0.2)
30
45
  byebug (11.1.3)
31
46
  coderay (1.1.3)
47
+ concurrent-ruby (1.1.10)
32
48
  crack (0.4.5)
33
49
  rexml
50
+ database_cleaner-active_record (2.0.1)
51
+ activerecord (>= 5.a)
52
+ database_cleaner-core (~> 2.0.0)
34
53
  database_cleaner-core (2.0.1)
35
- database_cleaner-sequel (2.0.0)
54
+ database_cleaner-sequel (2.0.2)
36
55
  database_cleaner-core (~> 2.0.0)
37
56
  sequel
38
57
  diff-lcs (1.5.0)
39
58
  docile (1.3.5)
59
+ dry-cli (0.7.0)
60
+ dry-configurable (0.11.6)
61
+ concurrent-ruby (~> 1.0)
62
+ dry-core (~> 0.4, >= 0.4.7)
63
+ dry-equalizer (~> 0.2)
64
+ dry-container (0.7.2)
65
+ concurrent-ruby (~> 1.0)
66
+ dry-configurable (~> 0.1, >= 0.1.3)
67
+ dry-core (0.4.9)
68
+ concurrent-ruby (~> 1.0)
69
+ dry-equalizer (0.3.0)
70
+ dry-inflector (0.2.0)
71
+ dry-initializer (3.0.4)
72
+ dry-logic (1.0.8)
73
+ concurrent-ruby (~> 1.0)
74
+ dry-core (~> 0.2)
75
+ dry-equalizer (~> 0.2)
76
+ dry-schema (1.5.5)
77
+ concurrent-ruby (~> 1.0)
78
+ dry-configurable (~> 0.8, >= 0.8.3)
79
+ dry-core (~> 0.4)
80
+ dry-equalizer (~> 0.2)
81
+ dry-initializer (~> 3.0)
82
+ dry-logic (~> 1.0)
83
+ dry-types (~> 1.4)
84
+ dry-types (1.4.0)
85
+ concurrent-ruby (~> 1.0)
86
+ dry-container (~> 0.3)
87
+ dry-core (~> 0.4, >= 0.4.4)
88
+ dry-equalizer (~> 0.3)
89
+ dry-inflector (~> 0.1, >= 0.1.2)
90
+ dry-logic (~> 1.0, >= 1.0.2)
91
+ dry-validation (1.5.6)
92
+ concurrent-ruby (~> 1.0)
93
+ dry-container (~> 0.7, >= 0.7.1)
94
+ dry-core (~> 0.4)
95
+ dry-equalizer (~> 0.2)
96
+ dry-initializer (~> 3.0)
97
+ dry-schema (~> 1.5, >= 1.5.2)
98
+ ffi (1.15.5)
99
+ formatador (1.1.0)
100
+ guard (2.18.0)
101
+ formatador (>= 0.2.4)
102
+ listen (>= 2.7, < 4.0)
103
+ lumberjack (>= 1.0.12, < 2.0)
104
+ nenv (~> 0.1)
105
+ notiffany (~> 0.0)
106
+ pry (>= 0.13.0)
107
+ shellany (~> 0.0)
108
+ thor (>= 0.18.1)
109
+ guard-bundler (2.2.1)
110
+ bundler (>= 1.3.0, < 3)
111
+ guard (~> 2.2)
112
+ guard-compat (~> 1.1)
113
+ guard-compat (1.2.1)
114
+ guard-rspec (4.7.3)
115
+ guard (~> 2.1)
116
+ guard-compat (~> 1.1)
117
+ rspec (>= 2.99.0, < 4.0)
118
+ guard-rubocop (1.4.0)
119
+ guard (~> 2.0)
120
+ rubocop (< 2.0)
40
121
  hashdiff (1.0.1)
41
- jmespath (1.6.1)
122
+ i18n (1.12.0)
123
+ concurrent-ruby (~> 1.0)
124
+ jmespath (1.6.2)
125
+ listen (3.7.1)
126
+ rb-fsevent (~> 0.10, >= 0.10.3)
127
+ rb-inotify (~> 0.9, >= 0.9.10)
128
+ lumberjack (1.2.8)
42
129
  luna_park (0.11.1)
43
130
  method_source (1.0.0)
131
+ minitest (5.15.0)
132
+ nenv (0.3.0)
133
+ notiffany (0.1.3)
134
+ nenv (~> 0.1)
135
+ shellany (~> 0.0)
44
136
  parallel (1.20.1)
45
- parser (3.1.0.0)
137
+ parser (3.1.3.0)
46
138
  ast (~> 2.4.1)
47
139
  pg (1.2.3)
48
140
  pry (0.13.1)
@@ -51,24 +143,27 @@ GEM
51
143
  pry-byebug (3.9.0)
52
144
  byebug (~> 11.0)
53
145
  pry (~> 0.13.0)
54
- public_suffix (4.0.6)
146
+ public_suffix (4.0.7)
55
147
  rainbow (3.1.1)
56
148
  rake (13.0.6)
57
- regexp_parser (2.2.0)
149
+ rb-fsevent (0.11.2)
150
+ rb-inotify (0.10.1)
151
+ ffi (~> 1.0)
152
+ regexp_parser (2.6.1)
58
153
  rexml (3.2.5)
59
- rspec (3.11.0)
60
- rspec-core (~> 3.11.0)
61
- rspec-expectations (~> 3.11.0)
62
- rspec-mocks (~> 3.11.0)
63
- rspec-core (3.11.0)
64
- rspec-support (~> 3.11.0)
65
- rspec-expectations (3.11.0)
154
+ rspec (3.12.0)
155
+ rspec-core (~> 3.12.0)
156
+ rspec-expectations (~> 3.12.0)
157
+ rspec-mocks (~> 3.12.0)
158
+ rspec-core (3.12.0)
159
+ rspec-support (~> 3.12.0)
160
+ rspec-expectations (3.12.1)
66
161
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.11.0)
68
- rspec-mocks (3.11.0)
162
+ rspec-support (~> 3.12.0)
163
+ rspec-mocks (3.12.1)
69
164
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.11.0)
71
- rspec-support (3.11.0)
165
+ rspec-support (~> 3.12.0)
166
+ rspec-support (3.12.0)
72
167
  rubocop (0.93.1)
73
168
  parallel (~> 1.10)
74
169
  parser (>= 2.7.1.5)
@@ -81,19 +176,26 @@ GEM
81
176
  rubocop-ast (1.4.1)
82
177
  parser (>= 2.7.1.5)
83
178
  ruby-progressbar (1.11.0)
84
- sequel (5.53.0)
179
+ sequel (5.63.0)
180
+ shellany (0.0.1)
85
181
  simplecov (0.18.5)
86
182
  docile (~> 1.1)
87
183
  simplecov-html (~> 0.11)
88
184
  simplecov-html (0.12.3)
89
- timecop (0.9.4)
185
+ terminal-table (3.0.2)
186
+ unicode-display_width (>= 1.1.1, < 3)
187
+ thor (1.2.1)
188
+ thread_safe (0.3.6)
189
+ timecop (0.9.6)
190
+ tzinfo (1.2.10)
191
+ thread_safe (~> 0.1)
90
192
  unicode-display_width (1.8.0)
91
193
  webmock (3.7.6)
92
194
  addressable (>= 2.3.6)
93
195
  crack (>= 0.3.2)
94
196
  hashdiff (>= 0.4.0, < 2.0.0)
95
197
  webrick (1.7.0)
96
- yard (0.9.27)
198
+ yard (0.9.28)
97
199
  webrick (~> 1.7.0)
98
200
 
99
201
  PLATFORMS
@@ -103,7 +205,12 @@ DEPENDENCIES
103
205
  bundler (~> 1.17)
104
206
  byebug (~> 11.1)
105
207
  cyclone_lariat!
208
+ database_cleaner-active_record
106
209
  database_cleaner-sequel (~> 2.0)
210
+ guard
211
+ guard-bundler
212
+ guard-rspec
213
+ guard-rubocop
107
214
  pg (~> 1.2)
108
215
  pry (~> 0.13)
109
216
  pry-byebug (~> 3.9)
data/Guardfile ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ ignore(/
4
+ bin | public | node_modules | tmp | .git
5
+ /x)
6
+
7
+ guard :bundler do
8
+ watch('Gemfile')
9
+ watch('Gemfile.lock')
10
+ end
11
+
12
+ group :specs, halt_on_fail: true do
13
+ guard :rspec,
14
+ cmd: 'bundle exec rspec --color --format documentation',
15
+ all_after_pass: false,
16
+ all_on_start: false,
17
+ failed_mode: :keep do
18
+ require 'guard/rspec/dsl'
19
+ dsl = Guard::RSpec::Dsl.new(self)
20
+
21
+ # Feel free to open issues for suggestions and improvements
22
+
23
+ # RSpec files
24
+ rspec = dsl.rspec
25
+ watch(rspec.spec_helper) { rspec.spec_dir }
26
+ watch(rspec.spec_support) { rspec.spec_dir }
27
+ watch(rspec.spec_files)
28
+
29
+ # Ruby files
30
+ ruby = dsl.ruby
31
+ dsl.watch_spec_files_for(ruby.lib_files)
32
+
33
+ watch(%r{^config/(.+)\.rb$})
34
+
35
+ watch(%r{^spec/factories/(.+)\.rb$})
36
+ end
37
+
38
+ guard :rubocop, all_on_start: false, keep_failed: false do
39
+ watch(/.+\.rb$/)
40
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
41
+ end
42
+ end