schema_dev 3.13.1 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/prs.yml +49 -0
  3. data/.simplecov +20 -0
  4. data/Gemfile +2 -0
  5. data/README.md +9 -7
  6. data/Rakefile +3 -5
  7. data/bin/schema_dev +25 -21
  8. data/lib/schema_dev/config.rb +62 -44
  9. data/lib/schema_dev/executor.rb +9 -8
  10. data/lib/schema_dev/gem.rb +45 -37
  11. data/lib/schema_dev/gemfile_selector.rb +7 -7
  12. data/lib/schema_dev/gemfiles.rb +6 -5
  13. data/lib/schema_dev/github_actions.rb +266 -0
  14. data/lib/schema_dev/matrix_executor.rb +4 -2
  15. data/lib/schema_dev/readme.rb +17 -10
  16. data/lib/schema_dev/rspec/db.rb +44 -33
  17. data/lib/schema_dev/rspec.rb +4 -9
  18. data/lib/schema_dev/ruby_selector.rb +29 -14
  19. data/lib/schema_dev/runner.rb +14 -10
  20. data/lib/schema_dev/tasks/dbms.rb +34 -26
  21. data/lib/schema_dev/tasks.rb +2 -3
  22. data/lib/schema_dev/templates.rb +5 -5
  23. data/lib/schema_dev/version.rb +3 -1
  24. data/lib/schema_dev.rb +3 -1
  25. data/schema_dev.gemspec +23 -26
  26. data/spec/schema_dev/config_spec.rb +60 -0
  27. data/spec/schema_dev/gem_spec.rb +74 -0
  28. data/spec/schema_dev/gemfile_selector_spec.rb +11 -0
  29. data/spec/schema_dev/gemfiles_spec.rb +41 -0
  30. data/spec/schema_dev/github_actions_spec.rb +818 -0
  31. data/spec/schema_dev/runner_spec.rb +103 -0
  32. data/spec/spec_helper.rb +5 -6
  33. data/templates/README/uses.schema_dev.md.erb +1 -2
  34. data/templates/gem/GEM_NAME.gemspec.erb +15 -14
  35. data/templates/gem/Gemfile.erb +2 -0
  36. data/templates/gem/Gemfile.local.erb +2 -0
  37. data/templates/gem/README.md.erb +1 -2
  38. data/templates/gem/Rakefile.erb +2 -0
  39. data/templates/gem/schema_dev.yml.erb +4 -1
  40. data/templates/gem/simplecov.erb +20 -0
  41. data/templates/gemfiles/{activerecord-5.0 → activerecord-6.0}/Gemfile.base.erb +1 -1
  42. data/templates/gemfiles/{activerecord-5.0 → activerecord-6.0}/Gemfile.mysql2.erb +0 -0
  43. data/templates/gemfiles/{activerecord-5.1 → activerecord-6.0}/Gemfile.postgresql.erb +1 -1
  44. data/templates/gemfiles/{activerecord-5.0 → activerecord-6.0}/Gemfile.sqlite3.erb +0 -0
  45. data/templates/gemfiles/{activerecord-5.1 → activerecord-6.1}/Gemfile.base.erb +1 -1
  46. data/templates/gemfiles/{activerecord-5.1 → activerecord-6.1}/Gemfile.mysql2.erb +0 -0
  47. data/templates/gemfiles/{activerecord-5.0 → activerecord-6.1}/Gemfile.postgresql.erb +1 -1
  48. data/templates/gemfiles/{activerecord-5.1 → activerecord-6.1}/Gemfile.sqlite3.erb +0 -0
  49. metadata +55 -98
  50. data/.travis.yml +0 -4
  51. data/lib/schema_dev/tasks/coveralls.rb +0 -3
  52. data/lib/schema_dev/travis.rb +0 -139
  53. data/spec/config_spec.rb +0 -61
  54. data/spec/gem_spec.rb +0 -77
  55. data/spec/gemfile_sepector_spec.rb +0 -10
  56. data/spec/gemfiles_spec.rb +0 -41
  57. data/spec/runner_spec.rb +0 -106
  58. data/spec/travis_spec.rb +0 -392
data/spec/travis_spec.rb DELETED
@@ -1,392 +0,0 @@
1
- require 'schema_dev/travis'
2
-
3
- describe SchemaDev::Travis do
4
-
5
- it "creates travis file" do
6
- config = get_config(ruby: %W[1.9.3 2.1.5],
7
- activerecord: %W[4.0 4.1],
8
- db: %W[mysql2 postgresql sqlite3],
9
- exclude: [
10
- { ruby: "1.9.3", db: "postgresql" },
11
- { ruby: "1.9.3", db: "sqlite3" },
12
- ],
13
- notify: 'me@example.com')
14
- in_tmpdir do
15
- SchemaDev::Travis.update(config)
16
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
17
- # This file was auto-generated by the schema_dev tool, based on the data in
18
- # ./schema_dev.yml
19
- # Please do not edit this file; any changes will be overwritten next time
20
- # schema_dev gets run.
21
- ---
22
- rvm:
23
- - 1.9.3
24
- - 2.1.5
25
- gemfile:
26
- - gemfiles/activerecord-4.0/Gemfile.sqlite3
27
- - gemfiles/activerecord-4.1/Gemfile.sqlite3
28
- before_script: bundle exec rake create_databases
29
- after_script: bundle exec rake drop_databases
30
- script: bundle exec rake travis
31
- notifications:
32
- email:
33
- - me@example.com
34
- jobs:
35
- exclude:
36
- - rvm: 1.9.3
37
- gemfile: gemfiles/activerecord-4.0/Gemfile.sqlite3
38
- - rvm: 1.9.3
39
- gemfile: gemfiles/activerecord-4.1/Gemfile.sqlite3
40
- include:
41
- - gemfile: gemfiles/activerecord-4.0/Gemfile.mysql2
42
- rvm: 1.9.3
43
- services:
44
- - mysql
45
- env: MYSQL_DB_USER=travis
46
- - gemfile: gemfiles/activerecord-4.1/Gemfile.mysql2
47
- rvm: 1.9.3
48
- services:
49
- - mysql
50
- env: MYSQL_DB_USER=travis
51
- - gemfile: gemfiles/activerecord-4.0/Gemfile.mysql2
52
- rvm: 2.1.5
53
- services:
54
- - mysql
55
- env: MYSQL_DB_USER=travis
56
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
57
- rvm: 2.1.5
58
- addons:
59
- postgresql: '9.6'
60
- env: POSTGRESQL_DB_USER=postgres
61
- - gemfile: gemfiles/activerecord-4.1/Gemfile.mysql2
62
- rvm: 2.1.5
63
- services:
64
- - mysql
65
- env: MYSQL_DB_USER=travis
66
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
67
- rvm: 2.1.5
68
- addons:
69
- postgresql: '9.6'
70
- env: POSTGRESQL_DB_USER=postgres
71
- ENDTRAVIS
72
- end
73
- end
74
-
75
- context 'when only using postgresql and not overriding the version' do
76
- it "creates travis file using the default PG version" do
77
- config = get_config(ruby: %W[2.4.0],
78
- activerecord: %W[4.1],
79
- db: %W[postgresql])
80
- in_tmpdir do
81
- SchemaDev::Travis.update(config)
82
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
83
- # This file was auto-generated by the schema_dev tool, based on the data in
84
- # ./schema_dev.yml
85
- # Please do not edit this file; any changes will be overwritten next time
86
- # schema_dev gets run.
87
- ---
88
- rvm:
89
- - 2.4.0
90
- gemfile:
91
- - gemfiles/activerecord-4.1/Gemfile.postgresql
92
- env: POSTGRESQL_DB_USER=postgres
93
- addons:
94
- postgresql: '9.6'
95
- before_script: bundle exec rake create_databases
96
- after_script: bundle exec rake drop_databases
97
- script: bundle exec rake travis
98
- ENDTRAVIS
99
- end
100
- end
101
- end
102
-
103
- context 'when specifying a single postgresql version' do
104
- it "creates travis file using that as the PG version" do
105
- config = get_config(ruby: %W[2.4.0],
106
- activerecord: %W[4.1],
107
- db: %W[postgresql sqlite3],
108
- dbversions: {postgresql: %W[9.6]})
109
- in_tmpdir do
110
- SchemaDev::Travis.update(config)
111
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
112
- # This file was auto-generated by the schema_dev tool, based on the data in
113
- # ./schema_dev.yml
114
- # Please do not edit this file; any changes will be overwritten next time
115
- # schema_dev gets run.
116
- ---
117
- rvm:
118
- - 2.4.0
119
- gemfile:
120
- - gemfiles/activerecord-4.1/Gemfile.sqlite3
121
- before_script: bundle exec rake create_databases
122
- after_script: bundle exec rake drop_databases
123
- script: bundle exec rake travis
124
- jobs:
125
- include:
126
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
127
- rvm: 2.4.0
128
- addons:
129
- postgresql: '9.6'
130
- env: POSTGRESQL_DB_USER=postgres
131
- ENDTRAVIS
132
- end
133
- end
134
- end
135
-
136
- context 'when specifying multiple postgresql versions with excludes' do
137
- it "creates travis file including those variants for postgresql versions" do
138
- config = get_config(ruby: %W[1.9.3 2.1.5 2.4.0],
139
- activerecord: %W[4.0 4.1],
140
- db: %W[sqlite3 postgresql],
141
- dbversions: {postgresql: %W[9.6 10 11]},
142
- exclude: [{ ruby: "1.9.3", db: "postgresql" }])
143
- in_tmpdir do
144
- SchemaDev::Travis.update(config)
145
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
146
- # This file was auto-generated by the schema_dev tool, based on the data in
147
- # ./schema_dev.yml
148
- # Please do not edit this file; any changes will be overwritten next time
149
- # schema_dev gets run.
150
- ---
151
- rvm:
152
- - 1.9.3
153
- - 2.1.5
154
- - 2.4.0
155
- gemfile:
156
- - gemfiles/activerecord-4.0/Gemfile.sqlite3
157
- - gemfiles/activerecord-4.1/Gemfile.sqlite3
158
- before_script: bundle exec rake create_databases
159
- after_script: bundle exec rake drop_databases
160
- script: bundle exec rake travis
161
- jobs:
162
- include:
163
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
164
- rvm: 2.1.5
165
- addons:
166
- postgresql: '9.6'
167
- env: POSTGRESQL_DB_USER=postgres
168
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
169
- rvm: 2.1.5
170
- addons:
171
- postgresql: '10'
172
- apt:
173
- packages:
174
- - postgresql-10
175
- - postgresql-client-10
176
- env: POSTGRESQL_DB_USER=postgres
177
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
178
- rvm: 2.1.5
179
- addons:
180
- postgresql: '11'
181
- apt:
182
- packages:
183
- - postgresql-11
184
- - postgresql-client-11
185
- env: POSTGRESQL_DB_USER=travis PGPORT=5433
186
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
187
- rvm: 2.1.5
188
- addons:
189
- postgresql: '9.6'
190
- env: POSTGRESQL_DB_USER=postgres
191
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
192
- rvm: 2.1.5
193
- addons:
194
- postgresql: '10'
195
- apt:
196
- packages:
197
- - postgresql-10
198
- - postgresql-client-10
199
- env: POSTGRESQL_DB_USER=postgres
200
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
201
- rvm: 2.1.5
202
- addons:
203
- postgresql: '11'
204
- apt:
205
- packages:
206
- - postgresql-11
207
- - postgresql-client-11
208
- env: POSTGRESQL_DB_USER=travis PGPORT=5433
209
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
210
- rvm: 2.4.0
211
- addons:
212
- postgresql: '9.6'
213
- env: POSTGRESQL_DB_USER=postgres
214
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
215
- rvm: 2.4.0
216
- addons:
217
- postgresql: '10'
218
- apt:
219
- packages:
220
- - postgresql-10
221
- - postgresql-client-10
222
- env: POSTGRESQL_DB_USER=postgres
223
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
224
- rvm: 2.4.0
225
- addons:
226
- postgresql: '11'
227
- apt:
228
- packages:
229
- - postgresql-11
230
- - postgresql-client-11
231
- env: POSTGRESQL_DB_USER=travis PGPORT=5433
232
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
233
- rvm: 2.4.0
234
- addons:
235
- postgresql: '9.6'
236
- env: POSTGRESQL_DB_USER=postgres
237
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
238
- rvm: 2.4.0
239
- addons:
240
- postgresql: '10'
241
- apt:
242
- packages:
243
- - postgresql-10
244
- - postgresql-client-10
245
- env: POSTGRESQL_DB_USER=postgres
246
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
247
- rvm: 2.4.0
248
- addons:
249
- postgresql: '11'
250
- apt:
251
- packages:
252
- - postgresql-11
253
- - postgresql-client-11
254
- env: POSTGRESQL_DB_USER=travis PGPORT=5433
255
- ENDTRAVIS
256
- end
257
- end
258
- end
259
-
260
- context 'when specifying only postgresql as the db with versions' do
261
- it "creates travis file including only addon variants" do
262
- config = get_config(ruby: %W[2.1.5 2.4.0],
263
- activerecord: %W[4.0 4.1],
264
- db: %W[postgresql],
265
- dbversions: {postgresql: %W[9.6 10 11]})
266
- in_tmpdir do
267
- SchemaDev::Travis.update(config)
268
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
269
- # This file was auto-generated by the schema_dev tool, based on the data in
270
- # ./schema_dev.yml
271
- # Please do not edit this file; any changes will be overwritten next time
272
- # schema_dev gets run.
273
- ---
274
- rvm:
275
- - 2.1.5
276
- - 2.4.0
277
- gemfile:
278
- - gemfiles/activerecord-4.0/Gemfile.postgresql
279
- - gemfiles/activerecord-4.1/Gemfile.postgresql
280
- before_script: bundle exec rake create_databases
281
- after_script: bundle exec rake drop_databases
282
- script: bundle exec rake travis
283
- jobs:
284
- include:
285
- - addons:
286
- postgresql: '9.6'
287
- env: POSTGRESQL_DB_USER=postgres
288
- - addons:
289
- postgresql: '10'
290
- apt:
291
- packages:
292
- - postgresql-10
293
- - postgresql-client-10
294
- env: POSTGRESQL_DB_USER=postgres
295
- - addons:
296
- postgresql: '11'
297
- apt:
298
- packages:
299
- - postgresql-11
300
- - postgresql-client-11
301
- env: POSTGRESQL_DB_USER=travis PGPORT=5433
302
- ENDTRAVIS
303
- end
304
- end
305
- end
306
-
307
- context 'when specifying multiple postgresql versions' do
308
- it "creates travis file including those variants for postgresql versions" do
309
- config = get_config(ruby: %W[2.1.5 2.4.0],
310
- activerecord: %W[4.0 4.1],
311
- db: %W[sqlite3 postgresql],
312
- dbversions: {postgresql: %W[9.6 10]})
313
- in_tmpdir do
314
- SchemaDev::Travis.update(config)
315
- expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
316
- # This file was auto-generated by the schema_dev tool, based on the data in
317
- # ./schema_dev.yml
318
- # Please do not edit this file; any changes will be overwritten next time
319
- # schema_dev gets run.
320
- ---
321
- rvm:
322
- - 2.1.5
323
- - 2.4.0
324
- gemfile:
325
- - gemfiles/activerecord-4.0/Gemfile.sqlite3
326
- - gemfiles/activerecord-4.1/Gemfile.sqlite3
327
- before_script: bundle exec rake create_databases
328
- after_script: bundle exec rake drop_databases
329
- script: bundle exec rake travis
330
- jobs:
331
- include:
332
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
333
- rvm: 2.1.5
334
- addons:
335
- postgresql: '9.6'
336
- env: POSTGRESQL_DB_USER=postgres
337
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
338
- rvm: 2.1.5
339
- addons:
340
- postgresql: '10'
341
- apt:
342
- packages:
343
- - postgresql-10
344
- - postgresql-client-10
345
- env: POSTGRESQL_DB_USER=postgres
346
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
347
- rvm: 2.1.5
348
- addons:
349
- postgresql: '9.6'
350
- env: POSTGRESQL_DB_USER=postgres
351
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
352
- rvm: 2.1.5
353
- addons:
354
- postgresql: '10'
355
- apt:
356
- packages:
357
- - postgresql-10
358
- - postgresql-client-10
359
- env: POSTGRESQL_DB_USER=postgres
360
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
361
- rvm: 2.4.0
362
- addons:
363
- postgresql: '9.6'
364
- env: POSTGRESQL_DB_USER=postgres
365
- - gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
366
- rvm: 2.4.0
367
- addons:
368
- postgresql: '10'
369
- apt:
370
- packages:
371
- - postgresql-10
372
- - postgresql-client-10
373
- env: POSTGRESQL_DB_USER=postgres
374
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
375
- rvm: 2.4.0
376
- addons:
377
- postgresql: '9.6'
378
- env: POSTGRESQL_DB_USER=postgres
379
- - gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
380
- rvm: 2.4.0
381
- addons:
382
- postgresql: '10'
383
- apt:
384
- packages:
385
- - postgresql-10
386
- - postgresql-client-10
387
- env: POSTGRESQL_DB_USER=postgres
388
- ENDTRAVIS
389
- end
390
- end
391
- end
392
- end