edgestitch 0.3.0 → 0.5.0

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.
@@ -0,0 +1,332 @@
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
+ edgestitch (0.5.0)
15
+
16
+ GEM
17
+ remote: https://rubygems.org/
18
+ specs:
19
+ actioncable (7.1.3.3)
20
+ actionpack (= 7.1.3.3)
21
+ activesupport (= 7.1.3.3)
22
+ nio4r (~> 2.0)
23
+ websocket-driver (>= 0.6.1)
24
+ zeitwerk (~> 2.6)
25
+ actionmailbox (7.1.3.3)
26
+ actionpack (= 7.1.3.3)
27
+ activejob (= 7.1.3.3)
28
+ activerecord (= 7.1.3.3)
29
+ activestorage (= 7.1.3.3)
30
+ activesupport (= 7.1.3.3)
31
+ mail (>= 2.7.1)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
35
+ actionmailer (7.1.3.3)
36
+ actionpack (= 7.1.3.3)
37
+ actionview (= 7.1.3.3)
38
+ activejob (= 7.1.3.3)
39
+ activesupport (= 7.1.3.3)
40
+ mail (~> 2.5, >= 2.5.4)
41
+ net-imap
42
+ net-pop
43
+ net-smtp
44
+ rails-dom-testing (~> 2.2)
45
+ actionpack (7.1.3.3)
46
+ actionview (= 7.1.3.3)
47
+ activesupport (= 7.1.3.3)
48
+ nokogiri (>= 1.8.5)
49
+ racc
50
+ rack (>= 2.2.4)
51
+ rack-session (>= 1.0.1)
52
+ rack-test (>= 0.6.3)
53
+ rails-dom-testing (~> 2.2)
54
+ rails-html-sanitizer (~> 1.6)
55
+ actiontext (7.1.3.3)
56
+ actionpack (= 7.1.3.3)
57
+ activerecord (= 7.1.3.3)
58
+ activestorage (= 7.1.3.3)
59
+ activesupport (= 7.1.3.3)
60
+ globalid (>= 0.6.0)
61
+ nokogiri (>= 1.8.5)
62
+ actionview (7.1.3.3)
63
+ activesupport (= 7.1.3.3)
64
+ builder (~> 3.1)
65
+ erubi (~> 1.11)
66
+ rails-dom-testing (~> 2.2)
67
+ rails-html-sanitizer (~> 1.6)
68
+ activejob (7.1.3.3)
69
+ activesupport (= 7.1.3.3)
70
+ globalid (>= 0.3.6)
71
+ activemodel (7.1.3.3)
72
+ activesupport (= 7.1.3.3)
73
+ activerecord (7.1.3.3)
74
+ activemodel (= 7.1.3.3)
75
+ activesupport (= 7.1.3.3)
76
+ timeout (>= 0.4.0)
77
+ activestorage (7.1.3.3)
78
+ actionpack (= 7.1.3.3)
79
+ activejob (= 7.1.3.3)
80
+ activerecord (= 7.1.3.3)
81
+ activesupport (= 7.1.3.3)
82
+ marcel (~> 1.0)
83
+ activesupport (7.1.3.3)
84
+ base64
85
+ bigdecimal
86
+ concurrent-ruby (~> 1.0, >= 1.0.2)
87
+ connection_pool (>= 2.2.5)
88
+ drb
89
+ i18n (>= 1.6, < 2)
90
+ minitest (>= 5.1)
91
+ mutex_m
92
+ tzinfo (~> 2.0)
93
+ appraisal (2.5.0)
94
+ bundler
95
+ rake
96
+ thor (>= 0.14.0)
97
+ ast (2.4.3)
98
+ base64 (0.3.0)
99
+ bigdecimal (3.2.2)
100
+ builder (3.3.0)
101
+ concurrent-ruby (1.3.5)
102
+ connection_pool (2.5.3)
103
+ crass (1.0.6)
104
+ csv (3.3.5)
105
+ date (3.4.1)
106
+ diff-lcs (1.6.2)
107
+ docile (1.1.5)
108
+ drb (2.2.3)
109
+ erb (5.0.2)
110
+ erubi (1.13.1)
111
+ globalid (1.2.1)
112
+ activesupport (>= 6.1)
113
+ i18n (1.14.7)
114
+ concurrent-ruby (~> 1.0)
115
+ io-console (0.8.1)
116
+ irb (1.15.2)
117
+ pp (>= 0.6.0)
118
+ rdoc (>= 4.0.0)
119
+ reline (>= 0.4.2)
120
+ json (2.12.2)
121
+ language_server-protocol (3.17.0.5)
122
+ license_finder (7.2.1)
123
+ bundler
124
+ csv (~> 3.2)
125
+ rubyzip (>= 1, < 3)
126
+ thor (~> 1.2)
127
+ tomlrb (>= 1.3, < 2.1)
128
+ with_env (= 1.1.0)
129
+ xml-simple (~> 1.1.9)
130
+ lint_roller (1.1.0)
131
+ loofah (2.24.1)
132
+ crass (~> 1.0.2)
133
+ nokogiri (>= 1.12.0)
134
+ mail (2.8.1)
135
+ mini_mime (>= 0.1.1)
136
+ net-imap
137
+ net-pop
138
+ net-smtp
139
+ marcel (1.0.4)
140
+ mini_mime (1.1.5)
141
+ minitest (5.25.5)
142
+ mutex_m (0.3.0)
143
+ mysql2 (0.5.5)
144
+ net-imap (0.4.22)
145
+ date
146
+ net-protocol
147
+ net-pop (0.1.2)
148
+ net-protocol
149
+ net-protocol (0.2.2)
150
+ timeout
151
+ net-smtp (0.5.1)
152
+ net-protocol
153
+ nio4r (2.7.4)
154
+ nokogiri (1.18.8-aarch64-linux-gnu)
155
+ racc (~> 1.4)
156
+ nokogiri (1.18.8-aarch64-linux-musl)
157
+ racc (~> 1.4)
158
+ nokogiri (1.18.8-arm-linux-gnu)
159
+ racc (~> 1.4)
160
+ nokogiri (1.18.8-arm-linux-musl)
161
+ racc (~> 1.4)
162
+ nokogiri (1.18.8-arm64-darwin)
163
+ racc (~> 1.4)
164
+ nokogiri (1.18.8-x86_64-darwin)
165
+ racc (~> 1.4)
166
+ nokogiri (1.18.8-x86_64-linux-gnu)
167
+ racc (~> 1.4)
168
+ nokogiri (1.18.8-x86_64-linux-musl)
169
+ racc (~> 1.4)
170
+ parallel (1.27.0)
171
+ parser (3.3.8.0)
172
+ ast (~> 2.4.1)
173
+ racc
174
+ pp (0.6.2)
175
+ prettyprint
176
+ prettyprint (0.2.0)
177
+ prism (1.4.0)
178
+ psych (5.2.6)
179
+ date
180
+ stringio
181
+ racc (1.8.1)
182
+ rack (3.1.16)
183
+ rack-session (2.1.1)
184
+ base64 (>= 0.1.0)
185
+ rack (>= 3.0.0)
186
+ rack-test (2.2.0)
187
+ rack (>= 1.3)
188
+ rackup (2.2.1)
189
+ rack (>= 3)
190
+ rails (7.1.3.3)
191
+ actioncable (= 7.1.3.3)
192
+ actionmailbox (= 7.1.3.3)
193
+ actionmailer (= 7.1.3.3)
194
+ actionpack (= 7.1.3.3)
195
+ actiontext (= 7.1.3.3)
196
+ actionview (= 7.1.3.3)
197
+ activejob (= 7.1.3.3)
198
+ activemodel (= 7.1.3.3)
199
+ activerecord (= 7.1.3.3)
200
+ activestorage (= 7.1.3.3)
201
+ activesupport (= 7.1.3.3)
202
+ bundler (>= 1.15.0)
203
+ railties (= 7.1.3.3)
204
+ rails-dom-testing (2.3.0)
205
+ activesupport (>= 5.0.0)
206
+ minitest
207
+ nokogiri (>= 1.6)
208
+ rails-html-sanitizer (1.6.2)
209
+ loofah (~> 2.21)
210
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
211
+ railties (7.1.3.3)
212
+ actionpack (= 7.1.3.3)
213
+ activesupport (= 7.1.3.3)
214
+ irb
215
+ rackup (>= 1.0.0)
216
+ rake (>= 12.2)
217
+ thor (~> 1.0, >= 1.2.2)
218
+ zeitwerk (~> 2.6)
219
+ rainbow (3.1.1)
220
+ rake (13.3.0)
221
+ rdoc (6.14.2)
222
+ erb
223
+ psych (>= 4.0.0)
224
+ regexp_parser (2.10.0)
225
+ reline (0.6.1)
226
+ io-console (~> 0.5)
227
+ rexml (3.4.1)
228
+ rspec (3.13.1)
229
+ rspec-core (~> 3.13.0)
230
+ rspec-expectations (~> 3.13.0)
231
+ rspec-mocks (~> 3.13.0)
232
+ rspec-core (3.13.5)
233
+ rspec-support (~> 3.13.0)
234
+ rspec-expectations (3.13.5)
235
+ diff-lcs (>= 1.2.0, < 2.0)
236
+ rspec-support (~> 3.13.0)
237
+ rspec-mocks (3.13.5)
238
+ diff-lcs (>= 1.2.0, < 2.0)
239
+ rspec-support (~> 3.13.0)
240
+ rspec-rails (5.1.2)
241
+ actionpack (>= 5.2)
242
+ activesupport (>= 5.2)
243
+ railties (>= 5.2)
244
+ rspec-core (~> 3.10)
245
+ rspec-expectations (~> 3.10)
246
+ rspec-mocks (~> 3.10)
247
+ rspec-support (~> 3.10)
248
+ rspec-support (3.13.4)
249
+ rubocop (1.74.0)
250
+ json (~> 2.3)
251
+ language_server-protocol (~> 3.17.0.2)
252
+ lint_roller (~> 1.1.0)
253
+ parallel (~> 1.10)
254
+ parser (>= 3.3.0.2)
255
+ rainbow (>= 2.2.2, < 4.0)
256
+ regexp_parser (>= 2.9.3, < 3.0)
257
+ rubocop-ast (>= 1.38.0, < 2.0)
258
+ ruby-progressbar (~> 1.7)
259
+ unicode-display_width (>= 2.4.0, < 4.0)
260
+ rubocop-ast (1.46.0)
261
+ parser (>= 3.3.7.2)
262
+ prism (~> 1.4)
263
+ rubocop-performance (1.24.0)
264
+ lint_roller (~> 1.1)
265
+ rubocop (>= 1.72.1, < 2.0)
266
+ rubocop-ast (>= 1.38.0, < 2.0)
267
+ rubocop-rails (2.30.3)
268
+ activesupport (>= 4.2.0)
269
+ lint_roller (~> 1.1)
270
+ rack (>= 1.1)
271
+ rubocop (>= 1.72.1, < 2.0)
272
+ rubocop-ast (>= 1.38.0, < 2.0)
273
+ rubocop-rake (0.7.1)
274
+ lint_roller (~> 1.1)
275
+ rubocop (>= 1.72.1)
276
+ rubocop-rspec (3.6.0)
277
+ lint_roller (~> 1.1)
278
+ rubocop (~> 1.72, >= 1.72.1)
279
+ ruby-progressbar (1.13.0)
280
+ rubyzip (2.4.1)
281
+ simplecov (0.15.1)
282
+ docile (~> 1.1.0)
283
+ json (>= 1.8, < 3)
284
+ simplecov-html (~> 0.10.0)
285
+ simplecov-html (0.10.2)
286
+ stringio (3.1.7)
287
+ thor (1.3.2)
288
+ timeout (0.4.3)
289
+ tomlrb (2.0.3)
290
+ tzinfo (2.0.6)
291
+ concurrent-ruby (~> 1.0)
292
+ unicode-display_width (3.1.4)
293
+ unicode-emoji (~> 4.0, >= 4.0.4)
294
+ unicode-emoji (4.0.4)
295
+ websocket-driver (0.8.0)
296
+ base64
297
+ websocket-extensions (>= 0.1.0)
298
+ websocket-extensions (0.1.5)
299
+ with_env (1.1.0)
300
+ xml-simple (1.1.9)
301
+ rexml
302
+ yard (0.9.21)
303
+ zeitwerk (2.6.18)
304
+
305
+ PLATFORMS
306
+ aarch64-linux-gnu
307
+ aarch64-linux-musl
308
+ arm-linux-gnu
309
+ arm-linux-musl
310
+ arm64-darwin
311
+ x86_64-darwin
312
+ x86_64-linux-gnu
313
+ x86_64-linux-musl
314
+
315
+ DEPENDENCIES
316
+ appraisal (~> 2.5.0)
317
+ bundler (~> 2.1)
318
+ edgestitch!
319
+ license_finder (>= 7.0)
320
+ mysql2 (= 0.5.5)
321
+ net-imap (< 0.5.0)
322
+ rails (= 7.1.3.3)
323
+ rake (~> 13.0)
324
+ rspec (~> 3.0)
325
+ rspec-rails (~> 5.1.2)
326
+ rubocop-powerhome!
327
+ simplecov (= 0.15.1)
328
+ yard (= 0.9.21)
329
+ zeitwerk (< 2.7.0)
330
+
331
+ BUNDLED WITH
332
+ 2.5.23
@@ -52,7 +52,7 @@ module Edgestitch
52
52
  attr_reader :database_directory_path, :extra_tables_path, :structure_file_path
53
53
 
54
54
  def extra_tables
55
- @extra_tables ||= extra_tables_path.exist? ? extra_tables_path.readlines.map(&:strip) : []
55
+ @extra_tables ||= extra_tables_path.exist? ? extra_tables_path.each_line.map(&:strip) : []
56
56
  end
57
57
 
58
58
  def component_tables
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "open3"
4
4
 
5
- require_relative "./structure_constraint_order_munger"
5
+ require_relative "structure_constraint_order_munger"
6
6
 
7
7
  module Edgestitch
8
8
  module Mysql
@@ -11,6 +11,8 @@ module Edgestitch
11
11
  # Wrapper for the mysqldump tool to dump specific tables and migration data
12
12
  #
13
13
  class Dump
14
+ # @private
15
+ #
14
16
  # Sanitizes a DDL code with some opinionated preferences:
15
17
  # * Constraints starting with `_fk` will start with `fk`
16
18
  # * Clear empty lines (with empty spaces even)
@@ -18,7 +20,7 @@ module Edgestitch
18
20
  #
19
21
  # @param sql [String] the DDL code to sanitize
20
22
  # @return String the same DDL sanitized
21
- def self.sanitize_sql(sql)
23
+ def self.sanitize_create_table(sql)
22
24
  comment_instructions_regex = %r{^/\*![0-9]{5}\s+[^;]+;\s*$}
23
25
 
24
26
  cleanups = sql.gsub(/\s+AUTO_INCREMENT=\d+/, "")
@@ -29,6 +31,24 @@ module Edgestitch
29
31
  ::Edgestitch::Mysql::StructureConstraintOrderMunger.munge(cleanups)
30
32
  end
31
33
 
34
+ # @private
35
+ #
36
+ # Sanitizes a DML code to insert migration timestamps with opinionated preferences:
37
+ # * One timestamp per line
38
+ # * Except for the first line, they all start with a comma
39
+ # * Semicolomn is in a separate line from the last one
40
+ #
41
+ # The above preferences come from the idea of minimizing merge conflicts, or make
42
+ # them easily handled by git automatically
43
+ #
44
+ # @param sql [String] the DML code to sanitize
45
+ # @return String the same DML sanitized
46
+ def self.sanitize_migration_timestamps(sql)
47
+ sql.gsub("VALUES ", "VALUES\n")
48
+ .gsub(",", "\n,")
49
+ .gsub(";", "\n;")
50
+ end
51
+
32
52
  #
33
53
  # @param config [ActiveRecord::DatabaseConfigurations::DatabaseConfig] rails database configuration
34
54
  def initialize(config)
@@ -49,7 +69,7 @@ module Edgestitch
49
69
  def export_tables(tables)
50
70
  return if tables.empty?
51
71
 
52
- self.class.sanitize_sql(
72
+ self.class.sanitize_create_table(
53
73
  execute("--compact", "--skip-lock-tables", "--no-data", "--set-gtid-purged=OFF",
54
74
  "--column-statistics=0", *tables)
55
75
  )
@@ -65,13 +85,13 @@ module Edgestitch
65
85
  # @return String the INSERT statements.
66
86
  def export_migrations(migrations)
67
87
  migrations.in_groups_of(50, false).map do |versions|
68
- execute(
88
+ self.class.sanitize_migration_timestamps execute(
69
89
  "--compact", "--skip-lock-tables", "--set-gtid-purged=OFF",
70
90
  "--no-create-info", "--column-statistics=0",
71
91
  "schema_migrations",
72
92
  "-w", "version IN (#{versions.join(',')})"
73
93
  )
74
- end.join.gsub(/VALUES /, "VALUES\n").gsub(/,/, ",\n")
94
+ end.join
75
95
  end
76
96
 
77
97
  private
@@ -7,6 +7,9 @@ module Edgestitch
7
7
  # require this railtie to automatically install the stitch task for the app,
8
8
  # or define it manually adding `::Edgestitch.define_stitch` to your Rakefile.
9
9
  class Railtie < ::Rails::Railtie
10
- rake_tasks { ::Edgestitch::Tasks.define_stitch }
10
+ rake_tasks { ::Edgestitch::Tasks.define_stitch(enhance_rails: config.edgestitch.enhance) }
11
+
12
+ config.edgestitch = ActiveSupport::OrderedOptions.new
13
+ config.edgestitch.enhance = true
11
14
  end
12
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Edgestitch
4
- VERSION = "0.3.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edgestitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Palhares
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-25 00:00:00.000000000 Z
11
+ date: 2025-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.5.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.5.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,34 +58,34 @@ dependencies:
44
58
  requirements:
45
59
  - - '='
46
60
  - !ruby/object:Gem::Version
47
- version: 0.5.3
61
+ version: 0.5.5
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 0.5.3
68
+ version: 0.5.5
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rails
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 5.2.8.1
75
+ version: 6.0.6.1
62
76
  - - "<"
63
77
  - !ruby/object:Gem::Version
64
- version: '7.1'
78
+ version: '7.2'
65
79
  type: :development
66
80
  prerelease: false
67
81
  version_requirements: !ruby/object:Gem::Requirement
68
82
  requirements:
69
83
  - - ">="
70
84
  - !ruby/object:Gem::Version
71
- version: 5.2.8.1
85
+ version: 6.0.6.1
72
86
  - - "<"
73
87
  - !ruby/object:Gem::Version
74
- version: '7.1'
88
+ version: '7.2'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: rake
77
91
  requirement: !ruby/object:Gem::Requirement
@@ -165,12 +179,22 @@ extensions: []
165
179
  extra_rdoc_files: []
166
180
  files:
167
181
  - ".rubocop.yml"
182
+ - Appraisals
168
183
  - Gemfile
184
+ - Gemfile.lock
169
185
  - Rakefile
170
186
  - doc/dependency_decisions.yml
171
187
  - docs/CHANGELOG.md
172
188
  - docs/README.md
173
189
  - edgestitch.gemspec
190
+ - gemfiles/rails_6_0.gemfile
191
+ - gemfiles/rails_6_0.gemfile.lock
192
+ - gemfiles/rails_6_1.gemfile
193
+ - gemfiles/rails_6_1.gemfile.lock
194
+ - gemfiles/rails_7_0.gemfile
195
+ - gemfiles/rails_7_0.gemfile.lock
196
+ - gemfiles/rails_7_1.gemfile
197
+ - gemfiles/rails_7_1.gemfile.lock
174
198
  - lib/edgestitch.rb
175
199
  - lib/edgestitch/exporter.rb
176
200
  - lib/edgestitch/mysql/dump.rb
@@ -189,7 +213,7 @@ metadata:
189
213
  homepage_uri: https://github.com/powerhome/power-tools
190
214
  source_code_uri: https://github.com/powerhome/power-tools
191
215
  changelog_uri: https://github.com/powerhome/power-tools/blob/main/packages/edgestitch/docs/CHANGELOG.md
192
- post_install_message:
216
+ post_install_message:
193
217
  rdoc_options: []
194
218
  require_paths:
195
219
  - lib
@@ -197,15 +221,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
221
  requirements:
198
222
  - - ">="
199
223
  - !ruby/object:Gem::Version
200
- version: '2.7'
224
+ version: '3.0'
201
225
  required_rubygems_version: !ruby/object:Gem::Requirement
202
226
  requirements:
203
227
  - - ">="
204
228
  - !ruby/object:Gem::Version
205
229
  version: '0'
206
230
  requirements: []
207
- rubygems_version: 3.4.1
208
- signing_key:
231
+ rubygems_version: 3.5.22
232
+ signing_key:
209
233
  specification_version: 4
210
234
  summary: Edgestitch allows engines to define partial structure-self.sql files to be
211
235
  stitched into a single structure.sql file by the umbrella application.