seed_builder 1.3.0 → 1.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +45 -28
- data/bin/seed +4 -4
- data/lib/seed_builder/config.rb +2 -2
- data/lib/seed_builder/loader.rb +103 -73
- data/lib/seed_builder.rb +1 -2
- data/lib/tasks/seed.rake +2 -2
- data/seed_builder.gemspec +22 -18
- data/sig/seed_builder/loader.rbs +1 -1
- metadata +111 -74
- data/.editorconfig +0 -14
- data/.github/dependabot.yml +0 -27
- data/.github/workflows/_trunk_check.yml +0 -15
- data/.github/workflows/test.yml +0 -98
- data/.gitignore +0 -25
- data/.ruby-version +0 -1
- data/.standard.yml +0 -22
- data/.trunk/.gitignore +0 -9
- data/.trunk/configs/.markdownlint.yaml +0 -2
- data/.trunk/configs/.shellcheckrc +0 -7
- data/.trunk/configs/.yamllint.yaml +0 -7
- data/.trunk/trunk.yaml +0 -39
- data/.vscode/extensions.json +0 -18
- data/.vscode/settings.json +0 -7
- data/Appraisals +0 -15
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -315
- data/bin/appraisals +0 -99
- data/lib/rails_config.rb +0 -3
- data/spec/fixtures/schema.rb +0 -9
- data/spec/fixtures/seeds/20241206200111_create_users.rb +0 -5
- data/spec/fixtures/seeds.rb +0 -1
- data/spec/generator_spec.rb +0 -50
- data/spec/seed_builder/config_spec.rb +0 -48
- data/spec/seed_builder/loader_spec.rb +0 -299
- data/spec/seed_builder/railtie_spec.rb +0 -118
- data/spec/seed_builder_spec.rb +0 -25
- data/spec/spec_helper.rb +0 -26
- data/spec/support/junit_formatter.rb +0 -6
- data/spec/support/rails_helpers.rb +0 -41
- data/usr/bin/release.sh +0 -35
data/Gemfile.lock
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
seed_builder (1.3.0)
|
|
5
|
-
activerecord (>= 6.1, < 8.2)
|
|
6
|
-
rails (>= 6.1, < 8.2)
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: https://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
actioncable (8.0.0)
|
|
12
|
-
actionpack (= 8.0.0)
|
|
13
|
-
activesupport (= 8.0.0)
|
|
14
|
-
nio4r (~> 2.0)
|
|
15
|
-
websocket-driver (>= 0.6.1)
|
|
16
|
-
zeitwerk (~> 2.6)
|
|
17
|
-
actionmailbox (8.0.0)
|
|
18
|
-
actionpack (= 8.0.0)
|
|
19
|
-
activejob (= 8.0.0)
|
|
20
|
-
activerecord (= 8.0.0)
|
|
21
|
-
activestorage (= 8.0.0)
|
|
22
|
-
activesupport (= 8.0.0)
|
|
23
|
-
mail (>= 2.8.0)
|
|
24
|
-
actionmailer (8.0.0)
|
|
25
|
-
actionpack (= 8.0.0)
|
|
26
|
-
actionview (= 8.0.0)
|
|
27
|
-
activejob (= 8.0.0)
|
|
28
|
-
activesupport (= 8.0.0)
|
|
29
|
-
mail (>= 2.8.0)
|
|
30
|
-
rails-dom-testing (~> 2.2)
|
|
31
|
-
actionpack (8.0.0)
|
|
32
|
-
actionview (= 8.0.0)
|
|
33
|
-
activesupport (= 8.0.0)
|
|
34
|
-
nokogiri (>= 1.8.5)
|
|
35
|
-
rack (>= 2.2.4)
|
|
36
|
-
rack-session (>= 1.0.1)
|
|
37
|
-
rack-test (>= 0.6.3)
|
|
38
|
-
rails-dom-testing (~> 2.2)
|
|
39
|
-
rails-html-sanitizer (~> 1.6)
|
|
40
|
-
useragent (~> 0.16)
|
|
41
|
-
actiontext (8.0.0)
|
|
42
|
-
actionpack (= 8.0.0)
|
|
43
|
-
activerecord (= 8.0.0)
|
|
44
|
-
activestorage (= 8.0.0)
|
|
45
|
-
activesupport (= 8.0.0)
|
|
46
|
-
globalid (>= 0.6.0)
|
|
47
|
-
nokogiri (>= 1.8.5)
|
|
48
|
-
actionview (8.0.0)
|
|
49
|
-
activesupport (= 8.0.0)
|
|
50
|
-
builder (~> 3.1)
|
|
51
|
-
erubi (~> 1.11)
|
|
52
|
-
rails-dom-testing (~> 2.2)
|
|
53
|
-
rails-html-sanitizer (~> 1.6)
|
|
54
|
-
activejob (8.0.0)
|
|
55
|
-
activesupport (= 8.0.0)
|
|
56
|
-
globalid (>= 0.3.6)
|
|
57
|
-
activemodel (8.0.0)
|
|
58
|
-
activesupport (= 8.0.0)
|
|
59
|
-
activerecord (8.0.0)
|
|
60
|
-
activemodel (= 8.0.0)
|
|
61
|
-
activesupport (= 8.0.0)
|
|
62
|
-
timeout (>= 0.4.0)
|
|
63
|
-
activestorage (8.0.0)
|
|
64
|
-
actionpack (= 8.0.0)
|
|
65
|
-
activejob (= 8.0.0)
|
|
66
|
-
activerecord (= 8.0.0)
|
|
67
|
-
activesupport (= 8.0.0)
|
|
68
|
-
marcel (~> 1.0)
|
|
69
|
-
activesupport (8.0.0)
|
|
70
|
-
base64
|
|
71
|
-
benchmark (>= 0.3)
|
|
72
|
-
bigdecimal
|
|
73
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
74
|
-
connection_pool (>= 2.2.5)
|
|
75
|
-
drb
|
|
76
|
-
i18n (>= 1.6, < 2)
|
|
77
|
-
logger (>= 1.4.2)
|
|
78
|
-
minitest (>= 5.1)
|
|
79
|
-
securerandom (>= 0.3)
|
|
80
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
81
|
-
uri (>= 0.13.1)
|
|
82
|
-
appraisal (2.5.0)
|
|
83
|
-
bundler
|
|
84
|
-
rake
|
|
85
|
-
thor (>= 0.14.0)
|
|
86
|
-
ast (2.4.3)
|
|
87
|
-
base64 (0.2.0)
|
|
88
|
-
benchmark (0.4.0)
|
|
89
|
-
bigdecimal (3.1.8)
|
|
90
|
-
bigdecimal (3.1.8-java)
|
|
91
|
-
builder (3.3.0)
|
|
92
|
-
concurrent-ruby (1.3.4)
|
|
93
|
-
connection_pool (2.4.1)
|
|
94
|
-
crass (1.0.6)
|
|
95
|
-
date (3.4.1)
|
|
96
|
-
date (3.4.1-java)
|
|
97
|
-
diff-lcs (1.5.1)
|
|
98
|
-
docile (1.4.1)
|
|
99
|
-
drb (2.2.1)
|
|
100
|
-
erubi (1.13.0)
|
|
101
|
-
globalid (1.2.1)
|
|
102
|
-
activesupport (>= 6.1)
|
|
103
|
-
i18n (1.14.6)
|
|
104
|
-
concurrent-ruby (~> 1.0)
|
|
105
|
-
io-console (0.8.0)
|
|
106
|
-
io-console (0.8.0-java)
|
|
107
|
-
irb (1.14.1)
|
|
108
|
-
rdoc (>= 4.0.0)
|
|
109
|
-
reline (>= 0.4.2)
|
|
110
|
-
jar-dependencies (0.5.0)
|
|
111
|
-
json (2.15.2)
|
|
112
|
-
json (2.15.2-java)
|
|
113
|
-
language_server-protocol (3.17.0.5)
|
|
114
|
-
lint_roller (1.1.0)
|
|
115
|
-
logger (1.6.2)
|
|
116
|
-
loofah (2.23.1)
|
|
117
|
-
crass (~> 1.0.2)
|
|
118
|
-
nokogiri (>= 1.12.0)
|
|
119
|
-
mail (2.8.1)
|
|
120
|
-
mini_mime (>= 0.1.1)
|
|
121
|
-
net-imap
|
|
122
|
-
net-pop
|
|
123
|
-
net-smtp
|
|
124
|
-
marcel (1.0.4)
|
|
125
|
-
mini_mime (1.1.5)
|
|
126
|
-
mini_portile2 (2.8.8)
|
|
127
|
-
minitest (5.25.4)
|
|
128
|
-
net-imap (0.5.1)
|
|
129
|
-
date
|
|
130
|
-
net-protocol
|
|
131
|
-
net-pop (0.1.2)
|
|
132
|
-
net-protocol
|
|
133
|
-
net-protocol (0.2.2)
|
|
134
|
-
timeout
|
|
135
|
-
net-smtp (0.5.0)
|
|
136
|
-
net-protocol
|
|
137
|
-
nio4r (2.7.4)
|
|
138
|
-
nio4r (2.7.4-java)
|
|
139
|
-
nokogiri (1.16.8-aarch64-linux)
|
|
140
|
-
racc (~> 1.4)
|
|
141
|
-
nokogiri (1.16.8-arm-linux)
|
|
142
|
-
racc (~> 1.4)
|
|
143
|
-
nokogiri (1.16.8-arm64-darwin)
|
|
144
|
-
racc (~> 1.4)
|
|
145
|
-
nokogiri (1.16.8-java)
|
|
146
|
-
racc (~> 1.4)
|
|
147
|
-
nokogiri (1.16.8-x86-linux)
|
|
148
|
-
racc (~> 1.4)
|
|
149
|
-
nokogiri (1.16.8-x86_64-darwin)
|
|
150
|
-
racc (~> 1.4)
|
|
151
|
-
nokogiri (1.16.8-x86_64-linux)
|
|
152
|
-
racc (~> 1.4)
|
|
153
|
-
parallel (1.27.0)
|
|
154
|
-
parser (3.3.10.0)
|
|
155
|
-
ast (~> 2.4.1)
|
|
156
|
-
racc
|
|
157
|
-
prism (1.6.0)
|
|
158
|
-
psych (5.2.1)
|
|
159
|
-
date
|
|
160
|
-
stringio
|
|
161
|
-
psych (5.2.1-java)
|
|
162
|
-
date
|
|
163
|
-
jar-dependencies (>= 0.1.7)
|
|
164
|
-
racc (1.8.1)
|
|
165
|
-
racc (1.8.1-java)
|
|
166
|
-
rack (3.1.8)
|
|
167
|
-
rack-session (2.0.0)
|
|
168
|
-
rack (>= 3.0.0)
|
|
169
|
-
rack-test (2.1.0)
|
|
170
|
-
rack (>= 1.3)
|
|
171
|
-
rackup (2.2.1)
|
|
172
|
-
rack (>= 3)
|
|
173
|
-
rails (8.0.0)
|
|
174
|
-
actioncable (= 8.0.0)
|
|
175
|
-
actionmailbox (= 8.0.0)
|
|
176
|
-
actionmailer (= 8.0.0)
|
|
177
|
-
actionpack (= 8.0.0)
|
|
178
|
-
actiontext (= 8.0.0)
|
|
179
|
-
actionview (= 8.0.0)
|
|
180
|
-
activejob (= 8.0.0)
|
|
181
|
-
activemodel (= 8.0.0)
|
|
182
|
-
activerecord (= 8.0.0)
|
|
183
|
-
activestorage (= 8.0.0)
|
|
184
|
-
activesupport (= 8.0.0)
|
|
185
|
-
bundler (>= 1.15.0)
|
|
186
|
-
railties (= 8.0.0)
|
|
187
|
-
rails-dom-testing (2.2.0)
|
|
188
|
-
activesupport (>= 5.0.0)
|
|
189
|
-
minitest
|
|
190
|
-
nokogiri (>= 1.6)
|
|
191
|
-
rails-html-sanitizer (1.6.1)
|
|
192
|
-
loofah (~> 2.21)
|
|
193
|
-
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)
|
|
194
|
-
railties (8.0.0)
|
|
195
|
-
actionpack (= 8.0.0)
|
|
196
|
-
activesupport (= 8.0.0)
|
|
197
|
-
irb (~> 1.13)
|
|
198
|
-
rackup (>= 1.0.0)
|
|
199
|
-
rake (>= 12.2)
|
|
200
|
-
thor (~> 1.0, >= 1.2.2)
|
|
201
|
-
zeitwerk (~> 2.6)
|
|
202
|
-
rainbow (3.1.1)
|
|
203
|
-
rake (13.2.1)
|
|
204
|
-
rbs (3.9.5)
|
|
205
|
-
logger
|
|
206
|
-
rdoc (6.8.1)
|
|
207
|
-
psych (>= 4.0.0)
|
|
208
|
-
regexp_parser (2.11.3)
|
|
209
|
-
reline (0.5.12)
|
|
210
|
-
io-console (~> 0.5)
|
|
211
|
-
rexml (3.3.9)
|
|
212
|
-
rspec (3.13.0)
|
|
213
|
-
rspec-core (~> 3.13.0)
|
|
214
|
-
rspec-expectations (~> 3.13.0)
|
|
215
|
-
rspec-mocks (~> 3.13.0)
|
|
216
|
-
rspec-core (3.13.2)
|
|
217
|
-
rspec-support (~> 3.13.0)
|
|
218
|
-
rspec-expectations (3.13.3)
|
|
219
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
220
|
-
rspec-support (~> 3.13.0)
|
|
221
|
-
rspec-mocks (3.13.2)
|
|
222
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
223
|
-
rspec-support (~> 3.13.0)
|
|
224
|
-
rspec-support (3.13.2)
|
|
225
|
-
rspec_junit_formatter (0.6.0)
|
|
226
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
|
227
|
-
rubocop (1.80.2)
|
|
228
|
-
json (~> 2.3)
|
|
229
|
-
language_server-protocol (~> 3.17.0.2)
|
|
230
|
-
lint_roller (~> 1.1.0)
|
|
231
|
-
parallel (~> 1.10)
|
|
232
|
-
parser (>= 3.3.0.2)
|
|
233
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
234
|
-
regexp_parser (>= 2.9.3, < 3.0)
|
|
235
|
-
rubocop-ast (>= 1.46.0, < 2.0)
|
|
236
|
-
ruby-progressbar (~> 1.7)
|
|
237
|
-
unicode-display_width (>= 2.4.0, < 4.0)
|
|
238
|
-
rubocop-ast (1.47.1)
|
|
239
|
-
parser (>= 3.3.7.2)
|
|
240
|
-
prism (~> 1.4)
|
|
241
|
-
rubocop-performance (1.25.0)
|
|
242
|
-
lint_roller (~> 1.1)
|
|
243
|
-
rubocop (>= 1.75.0, < 2.0)
|
|
244
|
-
rubocop-ast (>= 1.38.0, < 2.0)
|
|
245
|
-
ruby-progressbar (1.13.0)
|
|
246
|
-
securerandom (0.4.0)
|
|
247
|
-
simplecov (0.22.0)
|
|
248
|
-
docile (~> 1.1)
|
|
249
|
-
simplecov-html (~> 0.11)
|
|
250
|
-
simplecov_json_formatter (~> 0.1)
|
|
251
|
-
simplecov-cobertura (2.1.0)
|
|
252
|
-
rexml
|
|
253
|
-
simplecov (~> 0.19)
|
|
254
|
-
simplecov-html (0.13.1)
|
|
255
|
-
simplecov_json_formatter (0.1.4)
|
|
256
|
-
sqlite3 (2.4.0)
|
|
257
|
-
mini_portile2 (~> 2.8.0)
|
|
258
|
-
sqlite3 (2.4.0-aarch64-linux-gnu)
|
|
259
|
-
sqlite3 (2.4.0-arm-linux-gnu)
|
|
260
|
-
sqlite3 (2.4.0-arm64-darwin)
|
|
261
|
-
sqlite3 (2.4.0-x86-linux-gnu)
|
|
262
|
-
sqlite3 (2.4.0-x86_64-darwin)
|
|
263
|
-
sqlite3 (2.4.0-x86_64-linux-gnu)
|
|
264
|
-
standard (1.51.1)
|
|
265
|
-
language_server-protocol (~> 3.17.0.2)
|
|
266
|
-
lint_roller (~> 1.0)
|
|
267
|
-
rubocop (~> 1.80.2)
|
|
268
|
-
standard-custom (~> 1.0.0)
|
|
269
|
-
standard-performance (~> 1.8)
|
|
270
|
-
standard-custom (1.0.2)
|
|
271
|
-
lint_roller (~> 1.0)
|
|
272
|
-
rubocop (~> 1.50)
|
|
273
|
-
standard-performance (1.8.0)
|
|
274
|
-
lint_roller (~> 1.1)
|
|
275
|
-
rubocop-performance (~> 1.25.0)
|
|
276
|
-
stringio (3.1.2)
|
|
277
|
-
thor (1.3.2)
|
|
278
|
-
timeout (0.4.2)
|
|
279
|
-
tzinfo (2.0.6)
|
|
280
|
-
concurrent-ruby (~> 1.0)
|
|
281
|
-
unicode-display_width (3.2.0)
|
|
282
|
-
unicode-emoji (~> 4.1)
|
|
283
|
-
unicode-emoji (4.1.0)
|
|
284
|
-
uri (1.0.2)
|
|
285
|
-
useragent (0.16.11)
|
|
286
|
-
websocket-driver (0.7.6)
|
|
287
|
-
websocket-extensions (>= 0.1.0)
|
|
288
|
-
websocket-driver (0.7.6-java)
|
|
289
|
-
websocket-extensions (>= 0.1.0)
|
|
290
|
-
websocket-extensions (0.1.5)
|
|
291
|
-
zeitwerk (2.7.1)
|
|
292
|
-
|
|
293
|
-
PLATFORMS
|
|
294
|
-
aarch64-linux
|
|
295
|
-
arm-linux
|
|
296
|
-
arm64-darwin
|
|
297
|
-
universal-java-11
|
|
298
|
-
x86-linux
|
|
299
|
-
x86_64-darwin
|
|
300
|
-
x86_64-linux
|
|
301
|
-
|
|
302
|
-
DEPENDENCIES
|
|
303
|
-
appraisal (~> 2.4)
|
|
304
|
-
bundler (~> 2)
|
|
305
|
-
rbs (~> 3.0)
|
|
306
|
-
rspec (~> 3)
|
|
307
|
-
rspec_junit_formatter (~> 0.6)
|
|
308
|
-
seed_builder!
|
|
309
|
-
simplecov (~> 0.21)
|
|
310
|
-
simplecov-cobertura (~> 2)
|
|
311
|
-
sqlite3 (~> 2.4)
|
|
312
|
-
standard (~> 1.0)
|
|
313
|
-
|
|
314
|
-
BUNDLED WITH
|
|
315
|
-
2.5.20
|
data/bin/appraisals
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
# Run appraisal tests locally
|
|
4
|
-
# Usage:
|
|
5
|
-
# bin/appraisals # Run tests for all Rails versions
|
|
6
|
-
# bin/appraisals rails-7.0 # Run tests for Rails 7.0
|
|
7
|
-
# bin/appraisals rails-7.0 rails-8.0 # Run tests for specific versions
|
|
8
|
-
# bin/appraisals rails-7.0 rspec # Run rspec for Rails 7.0
|
|
9
|
-
# bin/appraisals rails-7.0 rake spec # Run rake spec for Rails 7.0
|
|
10
|
-
|
|
11
|
-
require "bundler/setup"
|
|
12
|
-
|
|
13
|
-
APPRAISALS_FILE = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "Appraisals")
|
|
14
|
-
|
|
15
|
-
unless File.exist?(APPRAISALS_FILE)
|
|
16
|
-
$stderr.puts "Error: Cannot find Appraisals file at #{APPRAISALS_FILE}"
|
|
17
|
-
exit 1
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
AVAILABLE_APPRAISALS = File.read(APPRAISALS_FILE, encoding: "UTF-8")
|
|
21
|
-
.scan(/appraise\s+"([^"]+)"/)
|
|
22
|
-
.flatten
|
|
23
|
-
.freeze
|
|
24
|
-
|
|
25
|
-
def usage
|
|
26
|
-
puts <<~USAGE
|
|
27
|
-
Usage: bin/appraisals [appraisal_name...] [command]
|
|
28
|
-
|
|
29
|
-
Examples:
|
|
30
|
-
bin/appraisals # Run rspec for all Rails versions
|
|
31
|
-
bin/appraisals rails-7.0 # Run rspec for Rails 7.0
|
|
32
|
-
bin/appraisals rails-7.0 rails-8.0 # Run rspec for Rails 7.0 and 8.0
|
|
33
|
-
bin/appraisals rails-7.0 rspec # Run rspec for Rails 7.0
|
|
34
|
-
bin/appraisals rails-7.0 rake spec # Run rake spec for Rails 7.0
|
|
35
|
-
|
|
36
|
-
Available appraisals: #{AVAILABLE_APPRAISALS.join(', ')}
|
|
37
|
-
USAGE
|
|
38
|
-
exit 1
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def parse_args
|
|
42
|
-
args = ARGV.dup
|
|
43
|
-
|
|
44
|
-
# Handle help flags
|
|
45
|
-
if args.include?("--help") || args.include?("-h")
|
|
46
|
-
usage
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
return [AVAILABLE_APPRAISALS, ["rspec"]] if args.empty?
|
|
50
|
-
|
|
51
|
-
appraisals = []
|
|
52
|
-
command = []
|
|
53
|
-
|
|
54
|
-
args.each do |arg|
|
|
55
|
-
if AVAILABLE_APPRAISALS.include?(arg)
|
|
56
|
-
appraisals << arg
|
|
57
|
-
else
|
|
58
|
-
command << arg
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
appraisals = AVAILABLE_APPRAISALS if appraisals.empty?
|
|
63
|
-
command = ["rspec"] if command.empty?
|
|
64
|
-
|
|
65
|
-
[appraisals, command]
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def run_appraisal(appraisal, command)
|
|
69
|
-
puts "\n" + "=" * 80
|
|
70
|
-
puts "Running #{appraisal} with: #{command.join(' ')}"
|
|
71
|
-
puts "=" * 80
|
|
72
|
-
|
|
73
|
-
cmd = ["bundle", "exec", "appraisal", appraisal] + command
|
|
74
|
-
system(*cmd)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
appraisals, command = parse_args
|
|
78
|
-
|
|
79
|
-
unless appraisals.all? { |a| AVAILABLE_APPRAISALS.include?(a) }
|
|
80
|
-
puts "Error: Invalid appraisal(s)"
|
|
81
|
-
usage
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
results = {}
|
|
85
|
-
appraisals.each do |appraisal|
|
|
86
|
-
results[appraisal] = run_appraisal(appraisal, command)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
puts "\n" + "=" * 80
|
|
90
|
-
puts "Summary"
|
|
91
|
-
puts "=" * 80
|
|
92
|
-
appraisals.each do |appraisal|
|
|
93
|
-
status = results[appraisal] ? "✓ PASSED" : "✗ FAILED"
|
|
94
|
-
puts "#{appraisal}: #{status}"
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
exit 0 if results.values.all?
|
|
98
|
-
exit 1
|
|
99
|
-
|
data/lib/rails_config.rb
DELETED
data/spec/fixtures/schema.rb
DELETED
data/spec/fixtures/seeds.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
SeedUser.find_or_create_by(email: "test@example.com")
|
data/spec/generator_spec.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
require "generators/seed_generator"
|
|
4
|
-
|
|
5
|
-
describe SeedGenerator, type: :generator do
|
|
6
|
-
include FileUtils
|
|
7
|
-
|
|
8
|
-
subject(:generator) { described_class.start params }
|
|
9
|
-
let(:destination_root) { File.expand_path("../../tmp/rspec", __FILE__) }
|
|
10
|
-
let(:seeds_path) { rails_root.join("db/seeds") }
|
|
11
|
-
|
|
12
|
-
let(:seed_name) { "create_users" }
|
|
13
|
-
let(:params) { [seed_name] }
|
|
14
|
-
|
|
15
|
-
let(:created_files) { Dir["#{seeds_path}/*_#{seed_name}.rb"] }
|
|
16
|
-
let(:file_contents) { File.readlines(created_files.first).map(&:strip).reject(&:blank?) }
|
|
17
|
-
|
|
18
|
-
before do
|
|
19
|
-
mkdir_p destination_root
|
|
20
|
-
|
|
21
|
-
allow(SeedBuilder.config).to receive(:seeds_path).and_return(seeds_path)
|
|
22
|
-
allow(Rails).to receive(:root).and_return(rails_root(destination_root))
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
after do
|
|
26
|
-
rm_rf destination_root
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "creates a migration file" do
|
|
30
|
-
generator
|
|
31
|
-
|
|
32
|
-
expect(created_files).not_to be_empty
|
|
33
|
-
expect(file_contents).to include("class CreateUsers")
|
|
34
|
-
expect(file_contents).not_to include("RSpec.describe CreateUsers")
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
context "when generate_spec is false" do
|
|
38
|
-
before do
|
|
39
|
-
allow(SeedBuilder.config).to receive(:generate_spec?).and_return(false)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "does not create a spec file" do
|
|
43
|
-
generator
|
|
44
|
-
|
|
45
|
-
expect(created_files).not_to be_empty
|
|
46
|
-
expect(file_contents).to include("class CreateUsers")
|
|
47
|
-
expect(file_contents).not_to include("RSpec.describe CreateUsers")
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
# Define Rails module if not already defined
|
|
4
|
-
unless defined?(Rails)
|
|
5
|
-
module Rails
|
|
6
|
-
class << self
|
|
7
|
-
attr_accessor :root, :env, :logger
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe SeedBuilder::Config do
|
|
13
|
-
subject(:config) { described_class.new }
|
|
14
|
-
|
|
15
|
-
before do
|
|
16
|
-
allow(Rails).to receive(:root).and_return(rails_root)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "has default seeds path" do
|
|
20
|
-
expect(config.seeds_path).to eq "db/seeds"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "has default load_seeds" do
|
|
24
|
-
expect(config.load_seeds?).to be true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
it "has default load_default_seeds" do
|
|
28
|
-
expect(config.load_default_seeds?).to be true
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "has default generate_spec" do
|
|
32
|
-
expect(config.generate_spec?).to be true
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "has default seeds_full_path" do
|
|
36
|
-
expect(config.seeds_full_path).to eq Rails.root.join("db/seeds")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "has default seeds_path_glob" do
|
|
40
|
-
expect(config.seeds_path_glob).to eq Rails.root.join("db/seeds/*.rb").to_s
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "allows setting a custom logger" do
|
|
44
|
-
custom_logger = Logger.new($stdout)
|
|
45
|
-
config.logger = custom_logger
|
|
46
|
-
expect(config.logger).to eq custom_logger
|
|
47
|
-
end
|
|
48
|
-
end
|