seed_dump 3.4.0 → 3.4.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/README.md +5 -3
- data/lib/seed_dump/dump_methods.rb +52 -0
- data/lib/seed_dump/environment.rb +9 -0
- metadata +121 -54
- data/.github/workflows/release.yml +0 -38
- data/.rspec +0 -2
- data/Appraisals +0 -47
- data/Gemfile +0 -36
- data/Rakefile +0 -32
- data/VERSION +0 -1
- data/find_ruby_compat.sh +0 -237
- data/gemfiles/rails_6.1.gemfile +0 -28
- data/gemfiles/rails_6.1.gemfile.lock +0 -150
- data/gemfiles/rails_7.0.gemfile +0 -28
- data/gemfiles/rails_7.0.gemfile.lock +0 -148
- data/gemfiles/rails_7.1.gemfile +0 -28
- data/gemfiles/rails_7.1.gemfile.lock +0 -161
- data/gemfiles/rails_7.2.gemfile +0 -28
- data/gemfiles/rails_7.2.gemfile.lock +0 -164
- data/gemfiles/rails_8.0.gemfile +0 -28
- data/gemfiles/rails_8.0.gemfile.lock +0 -163
- data/seed_dump.gemspec +0 -75
- data/spec/dump_methods_spec.rb +0 -1114
- data/spec/environment_spec.rb +0 -613
- data/spec/factories/another_samples.rb +0 -21
- data/spec/factories/authors.rb +0 -5
- data/spec/factories/base_users.rb +0 -16
- data/spec/factories/books.rb +0 -6
- data/spec/factories/bosses.rb +0 -5
- data/spec/factories/reviews.rb +0 -7
- data/spec/factories/samples.rb +0 -20
- data/spec/factories/yet_another_samples.rb +0 -21
- data/spec/helpers.rb +0 -252
- data/spec/spec_helper.rb +0 -59
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e51de5d37ae0d9f14a4c6126a53e589e20ab504e6fb79bff59e61e4950bb4633
|
|
4
|
+
data.tar.gz: edfad4053c8dafa40d45de0a6b01fbf6dd97645945015d68887be0ee38ebb640
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fa4f77d53981389543d97e2295cc0945effdc5360fdfce1d10beedfda43ca6116763b7f05105ba928d45e903bb568f78ae71ace57a5dbab9fcf3d23b919d590
|
|
7
|
+
data.tar.gz: 3cec4ce1c103182cb46f1c53e126c1563911efb7253bd783eb9d623c07d7efc9323072a51de8bd006002ebc347a163ce78a464d4a0a8660dc20781c8b4e3dd40
|
data/README.md
CHANGED
|
@@ -116,6 +116,10 @@ Options are common to both the Rake task and the console, except where noted.
|
|
|
116
116
|
|
|
117
117
|
`file`: Write to the specified output file. The Rake task default is `db/seeds.rb`. The console returns the dump as a string by default if this option is omitted.
|
|
118
118
|
|
|
119
|
+
`group_sti_by_class`: If `true`, Single Table Inheritance (STI) records are grouped by their actual class (e.g., `Dog`, `Cat`) instead of the base class (e.g., `Animal`). This is necessary when STI subclasses have different enum definitions or other class-specific attributes that would be lost if dumped via the base class. Default: `false`. Example: `rake db:seed:dump GROUP_STI_BY_CLASS=true` or `SeedDump.dump(Animal, group_sti_by_class: true)`. See the STI Handling section below for more details.
|
|
120
|
+
|
|
121
|
+
`header`: If `true`, adds a comment header to the output file showing the seed_dump command and options used. If a string, uses that string as the header comment. Default: `false`. **Rake task only.** Example: `rake db:seed:dump HEADER=true` or `HEADER="Generated by seed_dump"`.
|
|
122
|
+
|
|
119
123
|
`import`: If `true`, output will be in the format needed by the [activerecord-import](https://github.com/zdennis/activerecord-import) gem, rather than the default format. You can also pass a Hash of options which will be passed through to the `import` call (e.g., `IMPORT='{ "validate": false }'` for Rake, or `import: { validate: false }` for console). Default: `false`.
|
|
120
124
|
|
|
121
125
|
`include_all`: If set to `true`, include all columns in the dump (including `id`, `created_at`, and `updated_at`). Equivalent to `EXCLUDE=""`. Default: `false`. **Rake task only.** Example: `rake db:seed:dump INCLUDE_ALL=true`
|
|
@@ -130,15 +134,13 @@ Options are common to both the Rake task and the console, except where noted.
|
|
|
130
134
|
|
|
131
135
|
`models_exclude`: Exclude the specified comma-separated list of models from the dump. Default: no models excluded. **Rake task only.** Example: `rake db:seed:dump MODELS_EXCLUDE="User"`
|
|
132
136
|
|
|
133
|
-
`header`: If `true`, adds a comment header to the output file showing the seed_dump command and options used. If a string, uses that string as the header comment. Default: `false`. **Rake task only.** Example: `rake db:seed:dump HEADER=true` or `HEADER="Generated by seed_dump"`.
|
|
134
|
-
|
|
135
137
|
`upsert_all`: If `true`, output will use Rails 6+ [`upsert_all`](https://api.rubyonrails.org/classes/ActiveRecord/Persistence/ClassMethods.html#method-i-upsert_all) which preserves record IDs and handles conflicts by updating existing records. This is useful when you need to maintain foreign key relationships or want idempotent seed files. Automatically includes `id` in the dump. Default: `false`. Example: `rake db:seed:dump UPSERT_ALL=true` or `SeedDump.dump(User, upsert_all: true)`.
|
|
136
138
|
|
|
137
139
|
## Automatic Behaviors
|
|
138
140
|
|
|
139
141
|
**Foreign Key Ordering**: Models are automatically dumped in dependency order based on foreign key relationships. This ensures that parent records are created before child records that reference them.
|
|
140
142
|
|
|
141
|
-
**STI Handling**: Single Table Inheritance (STI) models are automatically deduplicated
|
|
143
|
+
**STI Handling**: Single Table Inheritance (STI) models are automatically deduplicated. By default, only the base class is dumped to avoid duplicate records (e.g., `Animal.create!` for both `Dog` and `Cat` records). However, if your STI subclasses have different enum definitions or other class-specific attributes, use the `group_sti_by_class: true` option to dump each subclass separately (e.g., `Dog.create!` and `Cat.create!`). This ensures that subclass-specific type casting and validations are properly applied when the seed data is loaded.
|
|
142
144
|
|
|
143
145
|
**HABTM Handling**: Has-and-belongs-to-many join tables are automatically detected and dumped without duplication.
|
|
144
146
|
|
|
@@ -22,6 +22,7 @@ class SeedDump
|
|
|
22
22
|
# @option options [Boolean, Hash] :import Use activerecord-import format. If Hash, passed as options to import. Default: false.
|
|
23
23
|
# @option options [Boolean] :insert_all Use Rails 6+ insert_all format for faster bulk inserts. Default: false.
|
|
24
24
|
# @option options [Boolean] :upsert_all Use Rails 6+ upsert_all format to preserve IDs and fix foreign key issues (issue #104). Default: false.
|
|
25
|
+
# @option options [Boolean] :group_sti_by_class Group STI records by their actual class instead of base_class (issue #170). Default: false.
|
|
25
26
|
# @return [String, nil] The dump string if :file is nil, otherwise nil.
|
|
26
27
|
def dump(records, options = {})
|
|
27
28
|
# Handle potential empty input gracefully
|
|
@@ -367,6 +368,24 @@ class SeedDump
|
|
|
367
368
|
raise ArgumentError, "Could not determine model class from records."
|
|
368
369
|
end
|
|
369
370
|
|
|
371
|
+
# Check if we should group STI models by their actual class (issue #170)
|
|
372
|
+
# This fixes the issue where STI models with different enum definitions
|
|
373
|
+
# lose data when dumped via the base class
|
|
374
|
+
if options[:group_sti_by_class] && model_klass.respond_to?(:base_class)
|
|
375
|
+
write_sti_records_grouped_by_class(records, io, options, model_klass)
|
|
376
|
+
else
|
|
377
|
+
write_records_for_single_model(records, io, options, model_klass)
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# Writes records for a single model class.
|
|
382
|
+
#
|
|
383
|
+
# @param records [ActiveRecord::Relation, Class, Array<ActiveRecord::Base>] The records to write.
|
|
384
|
+
# @param io [IO] The IO object to write to.
|
|
385
|
+
# @param options [Hash] Dumping options.
|
|
386
|
+
# @param model_klass [Class] The model class to use for output.
|
|
387
|
+
# @return [void]
|
|
388
|
+
def write_records_for_single_model(records, io, options, model_klass)
|
|
370
389
|
# Determine the method call ('import', 'insert_all', 'upsert_all', or 'create!')
|
|
371
390
|
method = if options[:import]
|
|
372
391
|
'import'
|
|
@@ -402,6 +421,39 @@ class SeedDump
|
|
|
402
421
|
end
|
|
403
422
|
end
|
|
404
423
|
|
|
424
|
+
# Writes STI records grouped by their actual class (issue #170).
|
|
425
|
+
#
|
|
426
|
+
# When STI models have different enum definitions, dumping via the base class
|
|
427
|
+
# causes enum values to be lost. This method groups records by their actual
|
|
428
|
+
# class and dumps each group separately.
|
|
429
|
+
#
|
|
430
|
+
# @param records [ActiveRecord::Relation, Class] The records to write.
|
|
431
|
+
# @param io [IO] The IO object to write to.
|
|
432
|
+
# @param options [Hash] Dumping options.
|
|
433
|
+
# @param model_klass [Class] The base model class.
|
|
434
|
+
# @return [void]
|
|
435
|
+
def write_sti_records_grouped_by_class(records, io, options, model_klass)
|
|
436
|
+
# We need to fetch all records and group them by class
|
|
437
|
+
# This is necessary because we can't efficiently group via SQL
|
|
438
|
+
all_records = if records.is_a?(Class)
|
|
439
|
+
records.all.to_a
|
|
440
|
+
elsif records.is_a?(ActiveRecord::Relation)
|
|
441
|
+
records.to_a
|
|
442
|
+
else
|
|
443
|
+
records
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
# Group records by their actual class
|
|
447
|
+
records_by_class = all_records.group_by(&:class)
|
|
448
|
+
|
|
449
|
+
# Sort classes by name for consistent output
|
|
450
|
+
records_by_class.keys.sort_by(&:name).each do |klass|
|
|
451
|
+
class_records = records_by_class[klass]
|
|
452
|
+
# Write records for this specific class
|
|
453
|
+
write_records_for_single_model(class_records, io, options, klass)
|
|
454
|
+
end
|
|
455
|
+
end
|
|
456
|
+
|
|
405
457
|
# Generates the string for activerecord-import options, if provided.
|
|
406
458
|
#
|
|
407
459
|
# @param options [Hash] Dumping options, potentially containing :import hash.
|
|
@@ -27,6 +27,7 @@ class SeedDump
|
|
|
27
27
|
batch_size: retrieve_batch_size_value(env),
|
|
28
28
|
exclude: retrieve_exclude_value(env),
|
|
29
29
|
file: retrieve_file_value(env),
|
|
30
|
+
group_sti_by_class: retrieve_group_sti_by_class_value(env),
|
|
30
31
|
header: retrieve_header_value(env),
|
|
31
32
|
import: retrieve_import_value(env),
|
|
32
33
|
insert_all: retrieve_insert_all_value(env),
|
|
@@ -289,6 +290,14 @@ class SeedDump
|
|
|
289
290
|
parse_boolean_value(env['HEADER'])
|
|
290
291
|
end
|
|
291
292
|
|
|
293
|
+
# Internal: Returns a Boolean indicating whether the value for the "GROUP_STI_BY_CLASS"
|
|
294
|
+
# key in the given Hash is equal to the String "true" (ignoring case),
|
|
295
|
+
# false if no value exists. GROUP_STI_BY_CLASS groups STI records by their actual
|
|
296
|
+
# class instead of base_class to fix enum issues (issue #170).
|
|
297
|
+
def retrieve_group_sti_by_class_value(env)
|
|
298
|
+
parse_boolean_value(env['GROUP_STI_BY_CLASS'])
|
|
299
|
+
end
|
|
300
|
+
|
|
292
301
|
# Internal: Retrieves an Array of Class constants parsed from the value for
|
|
293
302
|
# the "MODELS_EXCLUDE" key in the given Hash, and an empty Array if such
|
|
294
303
|
# key exists.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: seed_dump
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.4.
|
|
4
|
+
version: 3.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Halff
|
|
@@ -9,10 +9,10 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2025-12-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
15
|
+
name: activerecord
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '4'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
29
|
+
name: activesupport
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
32
|
- - ">="
|
|
@@ -39,20 +39,6 @@ dependencies:
|
|
|
39
39
|
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '4'
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: seed_dump
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - ">="
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '0'
|
|
49
|
-
type: :runtime
|
|
50
|
-
prerelease: false
|
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
-
requirements:
|
|
53
|
-
- - ">="
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: '0'
|
|
56
42
|
- !ruby/object:Gem::Dependency
|
|
57
43
|
name: byebug
|
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -96,65 +82,146 @@ dependencies:
|
|
|
96
82
|
- !ruby/object:Gem::Version
|
|
97
83
|
version: '0.28'
|
|
98
84
|
- !ruby/object:Gem::Dependency
|
|
99
|
-
name:
|
|
85
|
+
name: rspec
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - "~>"
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '3.13'
|
|
91
|
+
type: :development
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - "~>"
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '3.13'
|
|
98
|
+
- !ruby/object:Gem::Dependency
|
|
99
|
+
name: database_cleaner-active_record
|
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - "~>"
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '2.0'
|
|
105
|
+
type: :development
|
|
106
|
+
prerelease: false
|
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - "~>"
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '2.0'
|
|
112
|
+
- !ruby/object:Gem::Dependency
|
|
113
|
+
name: appraisal
|
|
100
114
|
requirement: !ruby/object:Gem::Requirement
|
|
101
115
|
requirements:
|
|
102
116
|
- - "~>"
|
|
103
117
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '2.
|
|
118
|
+
version: '2.4'
|
|
105
119
|
type: :development
|
|
106
120
|
prerelease: false
|
|
107
121
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
122
|
requirements:
|
|
109
123
|
- - "~>"
|
|
110
124
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '2.
|
|
125
|
+
version: '2.4'
|
|
126
|
+
- !ruby/object:Gem::Dependency
|
|
127
|
+
name: rake
|
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
|
129
|
+
requirements:
|
|
130
|
+
- - ">="
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '0'
|
|
133
|
+
type: :development
|
|
134
|
+
prerelease: false
|
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
136
|
+
requirements:
|
|
137
|
+
- - ">="
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: '0'
|
|
140
|
+
- !ruby/object:Gem::Dependency
|
|
141
|
+
name: sqlite3
|
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
|
143
|
+
requirements:
|
|
144
|
+
- - ">="
|
|
145
|
+
- !ruby/object:Gem::Version
|
|
146
|
+
version: '1.3'
|
|
147
|
+
type: :development
|
|
148
|
+
prerelease: false
|
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
150
|
+
requirements:
|
|
151
|
+
- - ">="
|
|
152
|
+
- !ruby/object:Gem::Version
|
|
153
|
+
version: '1.3'
|
|
154
|
+
- !ruby/object:Gem::Dependency
|
|
155
|
+
name: mutex_m
|
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
|
157
|
+
requirements:
|
|
158
|
+
- - ">="
|
|
159
|
+
- !ruby/object:Gem::Version
|
|
160
|
+
version: '0'
|
|
161
|
+
type: :development
|
|
162
|
+
prerelease: false
|
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
164
|
+
requirements:
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: '0'
|
|
168
|
+
- !ruby/object:Gem::Dependency
|
|
169
|
+
name: logger
|
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
|
171
|
+
requirements:
|
|
172
|
+
- - ">="
|
|
173
|
+
- !ruby/object:Gem::Version
|
|
174
|
+
version: '0'
|
|
175
|
+
type: :development
|
|
176
|
+
prerelease: false
|
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
178
|
+
requirements:
|
|
179
|
+
- - ">="
|
|
180
|
+
- !ruby/object:Gem::Version
|
|
181
|
+
version: '0'
|
|
182
|
+
- !ruby/object:Gem::Dependency
|
|
183
|
+
name: benchmark
|
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
|
185
|
+
requirements:
|
|
186
|
+
- - ">="
|
|
187
|
+
- !ruby/object:Gem::Version
|
|
188
|
+
version: '0'
|
|
189
|
+
type: :development
|
|
190
|
+
prerelease: false
|
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
192
|
+
requirements:
|
|
193
|
+
- - ">="
|
|
194
|
+
- !ruby/object:Gem::Version
|
|
195
|
+
version: '0'
|
|
196
|
+
- !ruby/object:Gem::Dependency
|
|
197
|
+
name: base64
|
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
|
199
|
+
requirements:
|
|
200
|
+
- - ">="
|
|
201
|
+
- !ruby/object:Gem::Version
|
|
202
|
+
version: '0'
|
|
203
|
+
type: :development
|
|
204
|
+
prerelease: false
|
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
206
|
+
requirements:
|
|
207
|
+
- - ">="
|
|
208
|
+
- !ruby/object:Gem::Version
|
|
209
|
+
version: '0'
|
|
112
210
|
description: Dump (parts) of your database to db/seeds.rb to get a headstart creating
|
|
113
211
|
a meaningful seeds.rb file
|
|
114
212
|
email: rroblak@gmail.com
|
|
115
213
|
executables: []
|
|
116
214
|
extensions: []
|
|
117
|
-
extra_rdoc_files:
|
|
118
|
-
- README.md
|
|
215
|
+
extra_rdoc_files: []
|
|
119
216
|
files:
|
|
120
|
-
- ".github/workflows/release.yml"
|
|
121
|
-
- ".rspec"
|
|
122
|
-
- Appraisals
|
|
123
|
-
- Gemfile
|
|
124
217
|
- MIT-LICENSE
|
|
125
218
|
- README.md
|
|
126
|
-
- Rakefile
|
|
127
|
-
- VERSION
|
|
128
|
-
- find_ruby_compat.sh
|
|
129
|
-
- gemfiles/rails_6.1.gemfile
|
|
130
|
-
- gemfiles/rails_6.1.gemfile.lock
|
|
131
|
-
- gemfiles/rails_7.0.gemfile
|
|
132
|
-
- gemfiles/rails_7.0.gemfile.lock
|
|
133
|
-
- gemfiles/rails_7.1.gemfile
|
|
134
|
-
- gemfiles/rails_7.1.gemfile.lock
|
|
135
|
-
- gemfiles/rails_7.2.gemfile
|
|
136
|
-
- gemfiles/rails_7.2.gemfile.lock
|
|
137
|
-
- gemfiles/rails_8.0.gemfile
|
|
138
|
-
- gemfiles/rails_8.0.gemfile.lock
|
|
139
219
|
- lib/seed_dump.rb
|
|
140
220
|
- lib/seed_dump/dump_methods.rb
|
|
141
221
|
- lib/seed_dump/dump_methods/enumeration.rb
|
|
142
222
|
- lib/seed_dump/environment.rb
|
|
143
223
|
- lib/seed_dump/railtie.rb
|
|
144
224
|
- lib/tasks/seed_dump.rake
|
|
145
|
-
- seed_dump.gemspec
|
|
146
|
-
- spec/dump_methods_spec.rb
|
|
147
|
-
- spec/environment_spec.rb
|
|
148
|
-
- spec/factories/another_samples.rb
|
|
149
|
-
- spec/factories/authors.rb
|
|
150
|
-
- spec/factories/base_users.rb
|
|
151
|
-
- spec/factories/books.rb
|
|
152
|
-
- spec/factories/bosses.rb
|
|
153
|
-
- spec/factories/reviews.rb
|
|
154
|
-
- spec/factories/samples.rb
|
|
155
|
-
- spec/factories/yet_another_samples.rb
|
|
156
|
-
- spec/helpers.rb
|
|
157
|
-
- spec/spec_helper.rb
|
|
158
225
|
homepage: https://github.com/rroblak/seed_dump
|
|
159
226
|
licenses:
|
|
160
227
|
- MIT
|
|
@@ -177,5 +244,5 @@ requirements: []
|
|
|
177
244
|
rubygems_version: 3.5.22
|
|
178
245
|
signing_key:
|
|
179
246
|
specification_version: 4
|
|
180
|
-
summary:
|
|
247
|
+
summary: Seed Dumper for Rails
|
|
181
248
|
test_files: []
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
name: Release gem to RubyGems.org
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
permissions:
|
|
14
|
-
id-token: write # Required for trusted publishing
|
|
15
|
-
contents: write # Required for GitHub release creation
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Set up Ruby
|
|
21
|
-
uses: ruby/setup-ruby@v1
|
|
22
|
-
with:
|
|
23
|
-
ruby-version: '3.3'
|
|
24
|
-
bundler-cache: true
|
|
25
|
-
|
|
26
|
-
- name: Configure RubyGems credentials
|
|
27
|
-
uses: rubygems/configure-rubygems-credentials@v1.0.0
|
|
28
|
-
|
|
29
|
-
- name: Build gem
|
|
30
|
-
run: gem build seed_dump.gemspec
|
|
31
|
-
|
|
32
|
-
- name: Push to RubyGems
|
|
33
|
-
run: gem push seed_dump-*.gem
|
|
34
|
-
|
|
35
|
-
- name: Create GitHub Release
|
|
36
|
-
uses: softprops/action-gh-release@v2
|
|
37
|
-
with:
|
|
38
|
-
generate_release_notes: true
|
data/.rspec
DELETED
data/Appraisals
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Appraisals file for testing seed_dump against different Rails versions.
|
|
2
|
-
# Gems defined here are combined with the main Gemfile.
|
|
3
|
-
# Gems specified here take precedence over the Gemfile versions for that appraisal.
|
|
4
|
-
|
|
5
|
-
# Appraisal for Rails 6.1.x
|
|
6
|
-
appraise 'rails-6.1' do
|
|
7
|
-
# Specify gems specific to this appraisal scenario
|
|
8
|
-
gem 'activerecord', '~> 6.1.0'
|
|
9
|
-
gem 'activesupport', '~> 6.1.0'
|
|
10
|
-
gem 'sqlite3', '>= 1.3', '< 2.0' # Broadly compatible range
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Appraisal for Rails 7.0.x
|
|
14
|
-
appraise 'rails-7.0' do
|
|
15
|
-
# Specify gems specific to this appraisal scenario
|
|
16
|
-
gem 'activerecord', '~> 7.0.0'
|
|
17
|
-
gem 'activesupport', '~> 7.0.0'
|
|
18
|
-
gem 'sqlite3', '>= 1.3', '< 2.0' # Broadly compatible range
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Appraisal for Rails 7.1.x
|
|
22
|
-
appraise 'rails-7.1' do
|
|
23
|
-
# Specify gems specific to this appraisal scenario
|
|
24
|
-
gem 'activerecord', '~> 7.1.0'
|
|
25
|
-
gem 'activesupport', '~> 7.1.0'
|
|
26
|
-
gem 'sqlite3', '>= 1.3', '< 2.0' # Broadly compatible range
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Appraisal for Rails 7.2.x
|
|
30
|
-
appraise 'rails-7.2' do
|
|
31
|
-
gem 'activerecord', '~> 7.2.0'
|
|
32
|
-
gem 'activesupport', '~> 7.2.0'
|
|
33
|
-
gem 'sqlite3', '>= 1.3', '< 2.0'
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Appraisal for Rails 8.0.x (Edge/Main)
|
|
37
|
-
appraise 'rails-8.0' do
|
|
38
|
-
# Specify gems specific to this appraisal scenario
|
|
39
|
-
gem 'activerecord', '>= 8.0.0.alpha', '< 8.1'
|
|
40
|
-
gem 'activesupport', '>= 8.0.0.alpha', '< 8.1'
|
|
41
|
-
|
|
42
|
-
# Override sqlite3 constraint for Rails 8 compatibility
|
|
43
|
-
# Rails 8 requires sqlite3 >= 2.1
|
|
44
|
-
gem 'sqlite3', '>= 2.1'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# Common test gems (rspec, factory_bot, etc.) are inherited from the main Gemfile's :test group.
|
data/Gemfile
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Runtime dependencies (also used in test appraisals)
|
|
4
|
-
gem 'activesupport', '>= 4'
|
|
5
|
-
gem 'activerecord', '>= 4'
|
|
6
|
-
|
|
7
|
-
group :development, :test do
|
|
8
|
-
# Common development and test dependencies
|
|
9
|
-
gem 'byebug', '~> 11.1'
|
|
10
|
-
gem 'factory_bot', '~> 6.1'
|
|
11
|
-
# activerecord-import might be needed for tests if using :import option
|
|
12
|
-
gem 'activerecord-import', '~> 0.28'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
group :development do
|
|
16
|
-
# Development-only dependencies
|
|
17
|
-
gem 'jeweler', '~> 2.3'
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
group :test do
|
|
21
|
-
# Test-only dependencies (common across all appraisals)
|
|
22
|
-
gem 'rspec', '~> 3.13.0'
|
|
23
|
-
gem 'database_cleaner-active_record', '~> 2.0'
|
|
24
|
-
gem 'appraisal', '~> 2.4'
|
|
25
|
-
|
|
26
|
-
# Add gems removed from Ruby stdlib/default but needed by older ActiveSupport
|
|
27
|
-
# Required for Ruby 3.4+
|
|
28
|
-
gem 'mutex_m'
|
|
29
|
-
# Recommended for Ruby 3.5+ (or to silence warning in 3.4)
|
|
30
|
-
gem 'logger'
|
|
31
|
-
# Add benchmark to silence Ruby 3.5+ warning
|
|
32
|
-
gem 'benchmark'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Pull in dependencies specified in the gemspec
|
|
36
|
-
gemspec
|
data/Rakefile
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
require 'jeweler'
|
|
6
|
-
Jeweler::Tasks.new do |gem|
|
|
7
|
-
gem.name = "seed_dump"
|
|
8
|
-
gem.summary = "{Seed Dumper for Rails}"
|
|
9
|
-
gem.description = %Q{Dump (parts) of your database to db/seeds.rb to get a headstart creating a meaningful seeds.rb file}
|
|
10
|
-
gem.email = 'rroblak@gmail.com'
|
|
11
|
-
gem.homepage = 'https://github.com/rroblak/seed_dump'
|
|
12
|
-
gem.authors = ['Rob Halff', 'Ryan Oblak']
|
|
13
|
-
gem.license = 'MIT'
|
|
14
|
-
end
|
|
15
|
-
Jeweler::GemcutterTasks.new
|
|
16
|
-
rescue LoadError
|
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
require 'rdoc/task'
|
|
21
|
-
Rake::RDocTask.new do |rdoc|
|
|
22
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
23
|
-
|
|
24
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
25
|
-
rdoc.title = "seed_dump #{version}"
|
|
26
|
-
rdoc.rdoc_files.include('README*')
|
|
27
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
require 'rspec/core/rake_task'
|
|
31
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
32
|
-
task :default => :spec
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.4.0
|