cyclone_lariat 0.4.0 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/gem-push.yml +4 -4
  3. data/.rubocop.yml +9 -5
  4. data/CHANGELOG.md +7 -1
  5. data/Gemfile.lock +123 -21
  6. data/Guardfile +42 -0
  7. data/README.md +420 -223
  8. data/bin/cyclone_lariat +75 -43
  9. data/cyclone_lariat.gemspec +10 -3
  10. data/lib/cyclone_lariat/clients/abstract.rb +40 -0
  11. data/lib/cyclone_lariat/clients/sns.rb +163 -0
  12. data/lib/cyclone_lariat/clients/sqs.rb +114 -0
  13. data/lib/cyclone_lariat/core.rb +21 -0
  14. data/lib/cyclone_lariat/errors.rb +16 -0
  15. data/lib/cyclone_lariat/fake.rb +19 -0
  16. data/lib/cyclone_lariat/generators/command.rb +53 -0
  17. data/lib/cyclone_lariat/generators/event.rb +52 -0
  18. data/lib/cyclone_lariat/generators/queue.rb +30 -0
  19. data/lib/cyclone_lariat/generators/topic.rb +29 -0
  20. data/lib/cyclone_lariat/messages/v1/abstract.rb +139 -0
  21. data/lib/cyclone_lariat/messages/v1/command.rb +20 -0
  22. data/lib/cyclone_lariat/messages/v1/event.rb +20 -0
  23. data/lib/cyclone_lariat/messages/v1/validator.rb +31 -0
  24. data/lib/cyclone_lariat/messages/v2/abstract.rb +149 -0
  25. data/lib/cyclone_lariat/messages/v2/command.rb +20 -0
  26. data/lib/cyclone_lariat/messages/v2/event.rb +20 -0
  27. data/lib/cyclone_lariat/messages/v2/validator.rb +39 -0
  28. data/lib/cyclone_lariat/middleware.rb +9 -6
  29. data/lib/cyclone_lariat/migration.rb +54 -117
  30. data/lib/cyclone_lariat/options.rb +52 -0
  31. data/lib/cyclone_lariat/presenters/graph.rb +54 -0
  32. data/lib/cyclone_lariat/presenters/queues.rb +41 -0
  33. data/lib/cyclone_lariat/presenters/subscriptions.rb +34 -0
  34. data/lib/cyclone_lariat/presenters/topics.rb +40 -0
  35. data/lib/cyclone_lariat/publisher.rb +25 -0
  36. data/lib/cyclone_lariat/repo/active_record/messages.rb +92 -0
  37. data/lib/cyclone_lariat/repo/active_record/versions.rb +28 -0
  38. data/lib/cyclone_lariat/repo/messages.rb +43 -0
  39. data/lib/cyclone_lariat/repo/messages_mapper.rb +49 -0
  40. data/lib/cyclone_lariat/repo/sequel/messages.rb +73 -0
  41. data/lib/cyclone_lariat/repo/sequel/versions.rb +28 -0
  42. data/lib/cyclone_lariat/repo/versions.rb +42 -0
  43. data/lib/cyclone_lariat/resources/queue.rb +167 -0
  44. data/lib/cyclone_lariat/resources/topic.rb +132 -0
  45. data/lib/cyclone_lariat/services/migrate.rb +51 -0
  46. data/lib/cyclone_lariat/services/rollback.rb +51 -0
  47. data/lib/cyclone_lariat/version.rb +1 -1
  48. data/lib/cyclone_lariat.rb +5 -11
  49. data/lib/tasks/console.rake +1 -1
  50. data/lib/tasks/cyclone_lariat.rake +10 -12
  51. data/lib/tasks/db.rake +0 -15
  52. metadata +127 -27
  53. data/config/db.example.rb +0 -9
  54. data/config/initializers/sequel.rb +0 -7
  55. data/db/migrate/01_add_uuid_extensions.rb +0 -15
  56. data/db/migrate/02_add_events.rb +0 -19
  57. data/db/migrate/03_add_versions.rb +0 -9
  58. data/docs/_imgs/graphviz_01.png +0 -0
  59. data/docs/_imgs/graphviz_02.png +0 -0
  60. data/docs/_imgs/graphviz_03.png +0 -0
  61. data/docs/_imgs/lariat.jpg +0 -0
  62. data/docs/_imgs/logic.png +0 -0
  63. data/docs/_imgs/sqs_sns_diagram.png +0 -0
  64. data/lib/cyclone_lariat/abstract/client.rb +0 -112
  65. data/lib/cyclone_lariat/abstract/message.rb +0 -98
  66. data/lib/cyclone_lariat/command.rb +0 -13
  67. data/lib/cyclone_lariat/configure.rb +0 -15
  68. data/lib/cyclone_lariat/event.rb +0 -13
  69. data/lib/cyclone_lariat/messages_mapper.rb +0 -46
  70. data/lib/cyclone_lariat/messages_repo.rb +0 -60
  71. data/lib/cyclone_lariat/queue.rb +0 -147
  72. data/lib/cyclone_lariat/sns_client.rb +0 -149
  73. data/lib/cyclone_lariat/sqs_client.rb +0 -93
  74. data/lib/cyclone_lariat/topic.rb +0 -113
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 6d5ece55091b9be0aad9d47a51e9d257457e7fec428b12568ba0ca35bc7e0e51
4
- data.tar.gz: f7185503b206c8c48739d59128d7bd235eba36d5ee405dd8edfa8da94ddf86a4
2
+ SHA1:
3
+ metadata.gz: 57a9765a6c8e7239c17807d05e70399fccb2268d
4
+ data.tar.gz: e54780308582d37055e6d2444972e775f2ad9927
5
5
  SHA512:
6
- metadata.gz: bafa9a790fa194f3371fe077bfa3d270642df60788fa6956121750ae409aad9896fcdc4684af049534f5452815b54a961824a1bf5b35c600992285328fbf5fbc
7
- data.tar.gz: 788dd1b52c75dec822308f71383fbee9310aed7f5cd85b55f7d8cac43593d36df88dceff7150ecfa353b9a870c088432636dfd753553b44a0e2cc47380e587d2
6
+ metadata.gz: d54bdf09e3414a6d2c477a2bd465750e705ad961d6882d015452b48fef11b09fc24770b938a390a3dc7a91de3e0059a8908728eb22114c7bd330f1556fa7d187
7
+ data.tar.gz: 5bfe88a0227b3bd8016b6a9c46eb007def598f3da4ce872e12f72385de735fd5019c6b0f96fb3d3d0c6e117ea373a1216b74d2f48fbe78bdadcde2480405d954
@@ -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/.rubocop.yml CHANGED
@@ -36,22 +36,22 @@ Metrics/MethodLength:
36
36
  Style/AccessorGrouping:
37
37
  Exclude:
38
38
  - 'lib/cyclone_lariat/event.rb'
39
- - 'lib/cyclone_lariat/abstract/message.rb'
39
+ - 'lib/cyclone_lariat/messages/abstract.rb'
40
40
 
41
41
  Layout/EmptyLinesAroundAttributeAccessor:
42
42
  Exclude:
43
- - 'lib/cyclone_lariat/abstract/message.rb'
43
+ - 'lib/cyclone_lariat/messages/abstract.rb'
44
44
 
45
45
  Metrics/CyclomaticComplexity:
46
46
  Exclude:
47
47
  - 'lib/cyclone_lariat/event.rb'
48
- - 'lib/cyclone_lariat/abstract/message.rb'
48
+ - 'lib/cyclone_lariat/messages/abstract.rb'
49
49
  - 'lib/cyclone_lariat/migration.rb'
50
50
 
51
51
  Metrics/PerceivedComplexity:
52
52
  Exclude:
53
53
  - 'lib/cyclone_lariat/event.rb'
54
- - 'lib/cyclone_lariat/abstract/message.rb'
54
+ - 'lib/cyclone_lariat/messages/abstract.rb'
55
55
  - 'lib/cyclone_lariat/migration.rb'
56
56
 
57
57
  Metrics/AbcSize:
@@ -59,6 +59,10 @@ Metrics/AbcSize:
59
59
  - '**/*'
60
60
 
61
61
  Metrics/BlockLength:
62
+ Exclude:
63
+ - '**/*'
64
+ -
65
+ Layout/FirstHashElementIndentation:
62
66
  Exclude:
63
67
  - '**/*'
64
68
 
@@ -66,7 +70,7 @@ Metrics/ClassLength:
66
70
  Exclude:
67
71
  - 'lib/cyclone_lariat/migration.rb'
68
72
  - 'lib/cyclone_lariat/abstract/client.rb'
69
- - 'lib/cyclone_lariat/sns_client.rb'
73
+ - 'lib/cyclone_lariat/sns.rb'
70
74
 
71
75
  Lint/RescueException:
72
76
  Exclude:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ 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
+ ## [1.0.0.rc2]
8
+ Changed
9
+ - README.md file
10
+ Added
11
+ - require version file, fixed `bundle exec cyclone_lariat -v`
12
+
7
13
  ## [0.4.0]
8
14
  Changed
9
15
  - rename `topic` to `queue` for SQS operations, in fact it changed only in methods `publish_event`, `publish_command`
@@ -19,7 +25,7 @@ Added
19
25
  Added
20
26
  - Added aws_client_od options
21
27
  Changed:
22
- - Renamed all AWS options with prefix _aws
28
+ - Renamed all AWS options with prefix _aws
23
29
 
24
30
  ## [0.3.9] - 2022-10-05 Depricated
25
31
  Added
data/Gemfile.lock CHANGED
@@ -1,38 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cyclone_lariat (0.4.0)
4
+ cyclone_lariat (1.0.0.rc1)
5
5
  aws-sdk-sns
6
6
  aws-sdk-sqs
7
7
  dry-cli (~> 0.6)
8
+ dry-validation (~> 1.5)
8
9
  luna_park (~> 0.11)
9
10
  terminal-table (~> 3.0)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
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)
14
26
  addressable (2.8.1)
15
27
  public_suffix (>= 2.0.2, < 6.0)
28
+ arel (9.0.0)
16
29
  ast (2.4.2)
17
30
  aws-eventstream (1.2.0)
18
- aws-partitions (1.654.0)
19
- aws-sdk-core (3.166.0)
31
+ aws-partitions (1.694.0)
32
+ aws-sdk-core (3.168.4)
20
33
  aws-eventstream (~> 1, >= 1.0.2)
21
34
  aws-partitions (~> 1, >= 1.651.0)
22
35
  aws-sigv4 (~> 1.5)
23
36
  jmespath (~> 1, >= 1.6.1)
24
- aws-sdk-sns (1.56.0)
37
+ aws-sdk-sns (1.57.0)
25
38
  aws-sdk-core (~> 3, >= 3.165.0)
26
39
  aws-sigv4 (~> 1.1)
27
- aws-sdk-sqs (1.52.0)
40
+ aws-sdk-sqs (1.52.1)
28
41
  aws-sdk-core (~> 3, >= 3.165.0)
29
42
  aws-sigv4 (~> 1.1)
30
43
  aws-sigv4 (1.5.2)
31
44
  aws-eventstream (~> 1, >= 1.0.2)
32
45
  byebug (11.1.3)
33
46
  coderay (1.1.3)
47
+ concurrent-ruby (1.1.10)
34
48
  crack (0.4.5)
35
49
  rexml
50
+ database_cleaner-active_record (2.0.1)
51
+ activerecord (>= 5.a)
52
+ database_cleaner-core (~> 2.0.0)
36
53
  database_cleaner-core (2.0.1)
37
54
  database_cleaner-sequel (2.0.2)
38
55
  database_cleaner-core (~> 2.0.0)
@@ -40,12 +57,84 @@ GEM
40
57
  diff-lcs (1.5.0)
41
58
  docile (1.3.5)
42
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)
43
121
  hashdiff (1.0.1)
44
- 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)
45
129
  luna_park (0.11.1)
46
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)
47
136
  parallel (1.20.1)
48
- parser (3.1.2.1)
137
+ parser (3.1.3.0)
49
138
  ast (~> 2.4.1)
50
139
  pg (1.2.3)
51
140
  pry (0.13.1)
@@ -57,21 +146,24 @@ GEM
57
146
  public_suffix (4.0.7)
58
147
  rainbow (3.1.1)
59
148
  rake (13.0.6)
60
- regexp_parser (2.6.0)
149
+ rb-fsevent (0.11.2)
150
+ rb-inotify (0.10.1)
151
+ ffi (~> 1.0)
152
+ regexp_parser (2.6.1)
61
153
  rexml (3.2.5)
62
- rspec (3.11.0)
63
- rspec-core (~> 3.11.0)
64
- rspec-expectations (~> 3.11.0)
65
- rspec-mocks (~> 3.11.0)
66
- rspec-core (3.11.0)
67
- rspec-support (~> 3.11.0)
68
- rspec-expectations (3.11.1)
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)
69
161
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.11.0)
71
- rspec-mocks (3.11.1)
162
+ rspec-support (~> 3.12.0)
163
+ rspec-mocks (3.12.1)
72
164
  diff-lcs (>= 1.2.0, < 2.0)
73
- rspec-support (~> 3.11.0)
74
- rspec-support (3.11.1)
165
+ rspec-support (~> 3.12.0)
166
+ rspec-support (3.12.0)
75
167
  rubocop (0.93.1)
76
168
  parallel (~> 1.10)
77
169
  parser (>= 2.7.1.5)
@@ -84,14 +176,19 @@ GEM
84
176
  rubocop-ast (1.4.1)
85
177
  parser (>= 2.7.1.5)
86
178
  ruby-progressbar (1.11.0)
87
- sequel (5.61.0)
179
+ sequel (5.63.0)
180
+ shellany (0.0.1)
88
181
  simplecov (0.18.5)
89
182
  docile (~> 1.1)
90
183
  simplecov-html (~> 0.11)
91
184
  simplecov-html (0.12.3)
92
185
  terminal-table (3.0.2)
93
186
  unicode-display_width (>= 1.1.1, < 3)
94
- timecop (0.9.5)
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)
95
192
  unicode-display_width (1.8.0)
96
193
  webmock (3.7.6)
97
194
  addressable (>= 2.3.6)
@@ -108,7 +205,12 @@ DEPENDENCIES
108
205
  bundler (~> 1.17)
109
206
  byebug (~> 11.1)
110
207
  cyclone_lariat!
208
+ database_cleaner-active_record
111
209
  database_cleaner-sequel (~> 2.0)
210
+ guard
211
+ guard-bundler
212
+ guard-rspec
213
+ guard-rubocop
112
214
  pg (~> 1.2)
113
215
  pry (~> 0.13)
114
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