seedomatic 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.
- data/lib/seedomatic/version.rb +1 -1
- data/readme.markdown +57 -1
- data/seedomatic.gemspec +1 -1
- metadata +6 -6
data/lib/seedomatic/version.rb
CHANGED
data/readme.markdown
CHANGED
@@ -1,2 +1,58 @@
|
|
1
1
|
# Seed-O-Matic
|
2
|
-
*Run repeatable seeds across a variety of environments*
|
2
|
+
*Run repeatable seeds across a variety of environments*
|
3
|
+
|
4
|
+
Seeds are great, but they're usually written in a way that they can only be used on an initial deploy. Seed-O-Matic gives
|
5
|
+
you tools to specify seed data in a way that's repeatable across environments, allowing you to change seed data in a safe
|
6
|
+
way between all of your environments.
|
7
|
+
|
8
|
+
## Seed Files
|
9
|
+
Seed files are set up as YAML files. By default, Seed-O-Matic will look for seed files in `config/seeds`, although you can
|
10
|
+
specify another directory when you run your seeds. Here's the structure of a typical seed file:
|
11
|
+
|
12
|
+
my_model:
|
13
|
+
match_on: code
|
14
|
+
tags: [initial_run, professional]
|
15
|
+
items:
|
16
|
+
- name: My Model 1
|
17
|
+
code: my_model
|
18
|
+
- name: My Model 2
|
19
|
+
code: my_model_2
|
20
|
+
|
21
|
+
* The seed file starts with a *model name*. This should match the name of a model in your application.
|
22
|
+
* The *items* array lists all the items you'd like to seed. Attribute names should match the name of your attributes.
|
23
|
+
* You can specify a *match_on* attribute to prevent duplicate entries being created when seeds are run a second time.
|
24
|
+
Seed-O-Matic will try to find an entry which matches your match_on fields, and update if one is found. Multiple items work as well.
|
25
|
+
* You can tag your seed files as well, if you want to import a subset of seeds in particular circumstances.
|
26
|
+
|
27
|
+
## Running Seeds
|
28
|
+
|
29
|
+
Running seeds is as easy as calling:
|
30
|
+
|
31
|
+
SeedOMatic.run
|
32
|
+
|
33
|
+
This will look through the directory `config/seeds`, and import every file in that directory.
|
34
|
+
|
35
|
+
### Importing specific directories, or specific files.
|
36
|
+
|
37
|
+
To load seed files from a specific directory, call:
|
38
|
+
|
39
|
+
SeedOMatic.run :dir => "your/directory"
|
40
|
+
|
41
|
+
To load a specific seed file, call:
|
42
|
+
|
43
|
+
SeedOMatic.run :file => 'config/seeds/my_model.yml'
|
44
|
+
|
45
|
+
### Importing tags
|
46
|
+
|
47
|
+
You can load tags using the `tagged_with`, and `not_tagged_with` options:
|
48
|
+
|
49
|
+
SeedOMatic.run :tagged_with => 'my_tag' # Will run all seeds tagged with my_tag
|
50
|
+
SeedOMatic.run :tagged_with => ['tag1', 'tag2'] # Will run if tagged with either tag1 or tag2
|
51
|
+
SeedOMatic.run :not_tagged_with => ['tag1', 'tag2'] # Will not run if either tag1 or tag2
|
52
|
+
|
53
|
+
## TODO
|
54
|
+
|
55
|
+
* Support for JSON formatted seed files
|
56
|
+
* Allowing multiple models defined per file
|
57
|
+
* Referencing lookups from other seed files
|
58
|
+
* Selective updating of data
|
data/seedomatic.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seedomatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70198976129380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,18 +21,18 @@ dependencies:
|
|
21
21
|
version: 2.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70198976129380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: active_support
|
27
|
-
requirement: &
|
27
|
+
requirement: &70198976128320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70198976128320
|
36
36
|
description: Create repeatable seed fixtures that you can continually use and deploy
|
37
37
|
to multiple environments and tenants.
|
38
38
|
email:
|