seed 1.1.2 → 1.1.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/.rvmrc +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +37 -0
- data/LICENSE +2 -4
- data/README.md +15 -4
- data/lib/seed/base.rb +1 -1
- data/lib/seed/version.rb +1 -1
- data/spec/seed_spec.rb +2 -2
- data/tasks/seeds.rake +1 -0
- metadata +7 -14
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@seed --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.0.5)
|
5
|
+
activesupport (= 3.0.5)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.4)
|
8
|
+
activerecord (3.0.5)
|
9
|
+
activemodel (= 3.0.5)
|
10
|
+
activesupport (= 3.0.5)
|
11
|
+
arel (~> 2.0.2)
|
12
|
+
tzinfo (~> 0.3.23)
|
13
|
+
activesupport (3.0.5)
|
14
|
+
arel (2.0.9)
|
15
|
+
builder (2.1.2)
|
16
|
+
diff-lcs (1.1.2)
|
17
|
+
i18n (0.5.0)
|
18
|
+
rspec (2.5.0)
|
19
|
+
rspec-core (~> 2.5.0)
|
20
|
+
rspec-expectations (~> 2.5.0)
|
21
|
+
rspec-mocks (~> 2.5.0)
|
22
|
+
rspec-core (2.5.1)
|
23
|
+
rspec-expectations (2.5.0)
|
24
|
+
diff-lcs (~> 1.1.2)
|
25
|
+
rspec-mocks (2.5.0)
|
26
|
+
sqlite3 (1.3.3)
|
27
|
+
sqlite3-ruby (1.3.3)
|
28
|
+
sqlite3 (>= 1.3.3)
|
29
|
+
tzinfo (0.3.25)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
activerecord
|
36
|
+
rspec
|
37
|
+
sqlite3-ruby
|
data/LICENSE
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
LICENSE
|
2
|
-
|
3
1
|
The MIT License
|
4
2
|
|
5
|
-
Copyright (c) 2008-
|
3
|
+
Copyright (c) 2008-2011 Jeremy Durham
|
6
4
|
|
7
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -20,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
THE SOFTWARE.
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -3,14 +3,14 @@ Seed
|
|
3
3
|
|
4
4
|
Another seeding library for Ruby
|
5
5
|
|
6
|
-
Usage
|
7
|
-
-----
|
8
|
-
|
9
6
|
Rails 3 and Ruby 1.9
|
10
7
|
--------------------
|
11
8
|
|
12
9
|
Seed is Rails 3 and Ruby 1.9 compatible
|
13
10
|
|
11
|
+
Usage
|
12
|
+
-----
|
13
|
+
|
14
14
|
Planting a seed
|
15
15
|
---------------
|
16
16
|
|
@@ -26,6 +26,17 @@ or:
|
|
26
26
|
|
27
27
|
Attempting to overwrite an existing seed will result in an error.
|
28
28
|
|
29
|
+
Seeding associations
|
30
|
+
--------------------
|
31
|
+
|
32
|
+
Associations can be handled by first creating a seed:
|
33
|
+
|
34
|
+
Role.seed(:admin, :role => 'admin')
|
35
|
+
|
36
|
+
And then using that seed when generating the associated object:
|
37
|
+
|
38
|
+
User.seed(:bob, :name => 'Bob', :role => Role.seed(:admin))
|
39
|
+
|
29
40
|
Retrieving a seed
|
30
41
|
-----------------
|
31
42
|
|
@@ -44,4 +55,4 @@ Seed comes with a rake task to make creating multiple "seeds" easier. In your Ra
|
|
44
55
|
|
45
56
|
Create a db/seeds directory and add a named seed, such as development.rb.
|
46
57
|
|
47
|
-
Running rake db:seed:development will then load your seeds from db/seeds/development.rb.
|
58
|
+
Running rake db:seed:development will then load your seeds from db/seeds/development.rb.
|
data/lib/seed/base.rb
CHANGED
data/lib/seed/version.rb
CHANGED
data/spec/seed_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'seed'
|
|
5
5
|
|
6
6
|
class User < ActiveRecord::Base
|
7
7
|
has_many :user_roles
|
8
|
-
has_many :
|
8
|
+
has_many :roles, :through => :user_roles
|
9
9
|
|
10
10
|
validates_presence_of :email
|
11
11
|
|
@@ -65,7 +65,7 @@ describe Seed do
|
|
65
65
|
user.email = 'user_with_role@example.com'
|
66
66
|
user.roles = [Role.seed(:system_administrator)]
|
67
67
|
end
|
68
|
-
User.seed(:user_with_role).roles.should_not
|
68
|
+
User.seed(:user_with_role).roles.should_not be_empty
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
data/tasks/seeds.rake
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: 1.1.2
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.3
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jeremy Durham
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-03-30 00:00:00 -04:00
|
18
14
|
default_executable:
|
19
15
|
dependencies: []
|
20
16
|
|
@@ -28,6 +24,9 @@ extensions: []
|
|
28
24
|
extra_rdoc_files: []
|
29
25
|
|
30
26
|
files:
|
27
|
+
- .rvmrc
|
28
|
+
- Gemfile
|
29
|
+
- Gemfile.lock
|
31
30
|
- LICENSE
|
32
31
|
- README.md
|
33
32
|
- Rakefile
|
@@ -54,23 +53,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
53
|
requirements:
|
55
54
|
- - ">="
|
56
55
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
56
|
version: "0"
|
60
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
58
|
none: false
|
62
59
|
requirements:
|
63
60
|
- - ">="
|
64
61
|
- !ruby/object:Gem::Version
|
65
|
-
segments:
|
66
|
-
- 1
|
67
|
-
- 3
|
68
|
-
- 6
|
69
62
|
version: 1.3.6
|
70
63
|
requirements: []
|
71
64
|
|
72
65
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.6.2
|
74
67
|
signing_key:
|
75
68
|
specification_version: 3
|
76
69
|
summary: Another simple seeding library
|