yaml_seeder 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -3
- data/lib/yaml_seeder.rb +1 -1
- data/rails/init.rb +2 -0
- data/test/test_helper.rb +3 -0
- data/test/yaml_seeder_test.rb +8 -0
- data/yaml_seeder.gemspec +18 -0
- metadata +5 -1
data/README.rdoc
CHANGED
@@ -23,11 +23,10 @@ For more information, google "foxy fixtures" or see http://ryandaigle.com/articl
|
|
23
23
|
|
24
24
|
== Usage
|
25
25
|
|
26
|
-
Use YamlSeeder to seed your Rails database. If you're using Rails 2.3.4 or later, add the following to your "db/seeds.rb" file
|
26
|
+
Use YamlSeeder to seed your Rails database. If you're using Rails 2.3.4 or later, add the following to your "db/seeds.rb" file
|
27
27
|
|
28
28
|
===db/seeds.rb
|
29
29
|
|
30
|
-
require 'yaml_seeder'
|
31
30
|
Dir.glob(RAILS_ROOT + '/db/seeds/*.yml').each do |file|
|
32
31
|
YamlSeeder.seed('db/seeds', File.basename(file, '.*'))
|
33
32
|
end
|
@@ -36,7 +35,6 @@ Alternatively, or if you're using an earlier version of Rails, you can create a
|
|
36
35
|
|
37
36
|
===lib/tasks/seed.rake
|
38
37
|
|
39
|
-
require 'yaml_seeder'
|
40
38
|
namespace :db do
|
41
39
|
desc "Load seed files (from db/seeds) into the current environment's database."
|
42
40
|
task :yaml_seed => :environment do
|
data/lib/yaml_seeder.rb
CHANGED
@@ -98,7 +98,7 @@ class YamlSeeder < Hash
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
@myobject = model_class.create
|
101
|
+
@myobject = model_class.create(row)
|
102
102
|
records_in_table = @@record_cache.has_key?(@table_name) ? @@record_cache[@table_name] : Hash.new
|
103
103
|
records_in_table[label] = @myobject
|
104
104
|
@@record_cache[@table_name] = records_in_table
|
data/rails/init.rb
ADDED
data/test/test_helper.rb
ADDED
data/yaml_seeder.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rake'
|
2
|
+
spec = Gem::Specification.new do |s|
|
3
|
+
s.name = 'yaml_seeder'
|
4
|
+
s.version = '0.0.2'
|
5
|
+
s.summary = 'Seeds your ActiveRecord models from YAML files'
|
6
|
+
s.description = 'Seeds your ActiveRecord models from YAML files, when the YAML files are formatted like test fixtures.'
|
7
|
+
s.author = 'Paul Fedory'
|
8
|
+
s.homepage = 'http://github.com/paulfedory/yaml_seeder'
|
9
|
+
s.extra_rdoc_files = [
|
10
|
+
"MIT-LICENSE",
|
11
|
+
"README.rdoc"
|
12
|
+
]
|
13
|
+
s.has_rdoc = true
|
14
|
+
|
15
|
+
s.files = FileList['lib/**/*.rb', 'rails/**/*.rb', 'test/**/*.rb', '[A-Z]*', '*.gemspec', 'Rakefile'].to_a
|
16
|
+
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_seeder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Fedory
|
@@ -24,9 +24,13 @@ extra_rdoc_files:
|
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
26
|
- lib/yaml_seeder.rb
|
27
|
+
- rails/init.rb
|
28
|
+
- test/test_helper.rb
|
29
|
+
- test/yaml_seeder_test.rb
|
27
30
|
- MIT-LICENSE
|
28
31
|
- Rakefile
|
29
32
|
- README.rdoc
|
33
|
+
- yaml_seeder.gemspec
|
30
34
|
has_rdoc: true
|
31
35
|
homepage: http://github.com/paulfedory/yaml_seeder
|
32
36
|
licenses: []
|