seedie 0.1.0 → 0.1.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 +10 -2
- data/lib/seedie/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c94e296c2303e454021934b3891b47e0b0974217e1df8bcbc7178f1c6b71452
|
4
|
+
data.tar.gz: a9c447bafa471eb10123209fdaa245a587cbf9ed1ef7ee56d07b875a719f40fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b423fde9186493e8b83febbbda6abd4b7b25966fcde1396e67d0af6011f28e4f0fbf67cae25d9a30293aba0668cdf794a73c080c2becb796a876094b19523ef
|
7
|
+
data.tar.gz: 2eaca5df71b6721becf3e61497d828ff8524822de1e79ba3d5c9bc8bbf6d8d2a18f0913eca1e1ad4db6055df726af0c85573f07f7c56535fc8790a97f244c51b
|
data/README.md
CHANGED
@@ -5,6 +5,9 @@ Utilizing the Faker library, Seedie generates realistic data for ActiveRecord mo
|
|
5
5
|
Currently supports only PostrgreSQL and SQLite3 databases.
|
6
6
|
The gem includes a Rake task for seeding models and a Rails generator for easy setup.
|
7
7
|
|
8
|
+
[](https://badge.fury.io/rb/seedie)
|
9
|
+

|
10
|
+
|
8
11
|
## Installation
|
9
12
|
|
10
13
|
Add the following line to your application's Gemfile:
|
@@ -55,15 +58,19 @@ models:
|
|
55
58
|
email: "{{Faker::Internet.email}}"
|
56
59
|
address: "{{Faker::Address.street_address}}"
|
57
60
|
disabled_fields: [nickname password password_digest]
|
58
|
-
post:
|
61
|
+
post:
|
59
62
|
count: 2
|
60
63
|
attributes:
|
61
64
|
title: "title {{index}}"
|
65
|
+
category:
|
66
|
+
custom_attr_value:
|
67
|
+
values: [tech, sports, politics, entertainment]
|
68
|
+
pick_strategy: random # or sequential
|
62
69
|
associations:
|
63
70
|
has_many:
|
64
71
|
comments: 4
|
65
72
|
belongs_to:
|
66
|
-
user: random
|
73
|
+
user: random # or new
|
67
74
|
has_one:
|
68
75
|
post_metadatum:
|
69
76
|
attributes:
|
@@ -87,6 +94,7 @@ In this file:
|
|
87
94
|
- `attributes` is a hash that maps field names to the values that should be used. If attributes are not defined, Seedie will use Faker to generate a value for the field.
|
88
95
|
- The special `{{index}}` placeholder will be replaced by the index of the current record being created, starting from 1. This allows you to have unique values for each record.
|
89
96
|
- Additionally, we can use placeholders like `{{Faker::Internet.email}}` to generate dynamic and unique data for each record using Faker.
|
97
|
+
- We can also specify an array of values that can be picked from randomly or sequentially using the `values` and `pick_strategy` options.
|
90
98
|
- `disabled_fields` is an array of fields that should not be automatically filled by Seedie.
|
91
99
|
- `associations` specify how associated models should be generated. Here, `has_many`, `belongs_to`, and `has_one` are supported.
|
92
100
|
- The specified number for `has_many` represents the number of associated records to create.
|
data/lib/seedie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seedie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keshav Biswa
|
@@ -14,30 +14,30 @@ dependencies:
|
|
14
14
|
name: faker
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|