dibber 0.0.2 → 0.0.3
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.
- data/README.rdoc +4 -4
- data/lib/dibber/seeder.rb +1 -1
- data/lib/dibber/version.rb +1 -1
- data/lib/examples/process_logs.rb +1 -1
- data/lib/examples/seeds.rb +8 -5
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
== Dibber
|
2
2
|
|
3
|
-
A set of
|
3
|
+
A set of tools to tidy up rails seeds.rb files.
|
4
4
|
|
5
5
|
Dibber has two compoments:
|
6
6
|
|
7
7
|
=== Seeder
|
8
|
-
is designed to simplify the process of pulling attributes from
|
8
|
+
Seeder is designed to simplify the process of pulling attributes from
|
9
9
|
YAML files, and populating ActiveRecord objects with those attributes.
|
10
10
|
|
11
11
|
=== ProcessLog
|
12
|
-
provides Seeder with a simple before and after reporting tool.
|
12
|
+
ProcessLog provides Seeder with a simple before and after reporting tool.
|
13
13
|
|
14
|
-
Have a look at the examples folder, for a guide to how Dibber is used.
|
14
|
+
Have a look at the lib/examples folder, for a guide to how Dibber is used.
|
data/lib/dibber/seeder.rb
CHANGED
data/lib/dibber/version.rb
CHANGED
data/lib/examples/seeds.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Seeder =
|
1
|
+
Seeder = Dibber::Seeder
|
2
2
|
|
3
3
|
# Set up the path to seed YAML files
|
4
4
|
Seeder.seeds_path = "#{Rails.root}/db/seeds"
|
@@ -20,9 +20,9 @@ AdminUser.create!(
|
|
20
20
|
:password_confirmation => password
|
21
21
|
) unless AdminUser.exists?(:email => admin_email)
|
22
22
|
|
23
|
-
# Example 3. Seeder grabs the attributes from the YAML and
|
23
|
+
# Example 3. Seeder grabs the attributes from the YAML and builds a
|
24
24
|
# set of Fee objects with those attributes (or updates them if
|
25
|
-
# they already exist.
|
25
|
+
# they already exist).
|
26
26
|
# Note that the build process requires the model to have a name field.
|
27
27
|
Seeder.new(Fee, 'fees.yml').build
|
28
28
|
|
@@ -33,5 +33,8 @@ Seeder.new(Disclaimer::Document, 'disclaimer/documents.yml').build
|
|
33
33
|
Seeder.new(Category, 'categories.yml', 'description').build
|
34
34
|
|
35
35
|
# Output a report showing how the numbers of each type of object
|
36
|
-
# have changed through the process.
|
37
|
-
puts Seeder.report
|
36
|
+
# have changed through the process. Also has a log of start and end time.
|
37
|
+
puts Seeder.report
|
38
|
+
|
39
|
+
# You can also access Seeders attached process log, and set up a custom log
|
40
|
+
Seeder.process_log.start('First questionnaire questions', 'Questionnaire.count > 0 ? Questionnaire.first.questions.length : 0')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dibber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Packages up code needed to pull data from YAML files when seeding, and
|
15
15
|
adds a process log.
|