seed_report 0.4.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.
- checksums.yaml +4 -4
- data/README.md +48 -13
- data/lib/seed_report/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dff2ae5b1b58bec07b80303ab0df2f994296f045
|
4
|
+
data.tar.gz: b456b2f053872bb0d9476aec2dfb84fe2b3fa8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaf5f128af0b7db6cac145c037038a90261064e46f5d49cb6e8ce27b6aa7481d8d33da98e101450bd0e243a1fbec980ac99d37a16076ec1ff2814e548d63d89f
|
7
|
+
data.tar.gz: aed5a6f0f8ffa6e8d1741e599d89e16b5425c1a7b819ad5abdb1c8a6b5a64592b07cf3e91dc63c9ac3c329e2097a70ac4e2b38ca54249ff6f1430c71b4f69f07
|
data/README.md
CHANGED
@@ -1,28 +1,64 @@
|
|
1
1
|
# SeedReport
|
2
2
|
|
3
|
-
|
3
|
+
## The Deliverable
|
4
|
+
A readable summary of your Rails seed results, with minimal coding.
|
4
5
|
|
5
|
-
|
6
|
+
**Step 1.** Wrap your model `create` and `save`'s with a request for a seed report:
|
6
7
|
|
7
|
-
|
8
|
+
```ruby
|
9
|
+
SeedReport.for_model Model_class do
|
10
|
+
# A block which creates the Model_class seed instances.
|
11
|
+
end
|
12
|
+
```
|
8
13
|
|
9
|
-
|
14
|
+
For example:
|
10
15
|
|
11
16
|
```ruby
|
12
|
-
|
17
|
+
SeedReport.for_model Country do
|
18
|
+
Country.find_or_create_by!(
|
19
|
+
name: 'United States',
|
20
|
+
alpha_2: 'us',
|
21
|
+
alpha_3: 'usa',
|
22
|
+
region_meta_name: 'state'
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
SeedReport.for_model Region do
|
27
|
+
us = Country.find_by! alpha_2: 'us'
|
28
|
+
|
29
|
+
Region.find_or_create_by!(
|
30
|
+
name: 'California',
|
31
|
+
slug: 'ca',
|
32
|
+
country: us
|
33
|
+
)
|
34
|
+
Region.find_or_create_by!(
|
35
|
+
name: 'Nevada',
|
36
|
+
slug: 'nv',
|
37
|
+
country: us
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
# etc.
|
13
42
|
```
|
14
43
|
|
15
|
-
|
44
|
+
**Step 2.** Run your seeds with `rake db:reset` (my favorite), `rake db:setup`,
|
45
|
+
or `rake db:seed`.
|
16
46
|
|
17
|
-
|
47
|
+
**Step 3.** Enjoy the simple summary output:
|
18
48
|
|
19
|
-
|
49
|
+

|
20
50
|
|
21
|
-
|
51
|
+
## Installation
|
22
52
|
|
23
|
-
|
53
|
+
Add this line to your Rails application's Gemfile:
|
24
54
|
|
25
|
-
|
55
|
+
```ruby
|
56
|
+
gem 'seed_report', group: :development
|
57
|
+
```
|
58
|
+
|
59
|
+
And then execute:
|
60
|
+
|
61
|
+
$ bundle
|
26
62
|
|
27
63
|
## Development
|
28
64
|
|
@@ -32,10 +68,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
68
|
|
33
69
|
## Contributing
|
34
70
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
71
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dogweather/seed_report.
|
36
72
|
|
37
73
|
|
38
74
|
## License
|
39
75
|
|
40
76
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/seed_report/version.rb
CHANGED