seedsv 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/seedsv.rb +4 -6
- data/lib/seedsv/csv_seed.rb +4 -2
- data/seedsv.gemspec +20 -23
- metadata +7 -27
- data/.gitignore +0 -21
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/adriancuadros/seedsv"
|
12
12
|
gem.authors = ["Adrian Cuadros"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
-
gem.add_dependency("fastercsv", "~> 1.5.
|
14
|
+
gem.add_dependency("fastercsv", "~> 1.5.1")
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/seedsv.rb
CHANGED
@@ -25,9 +25,7 @@
|
|
25
25
|
#
|
26
26
|
# If something goes wrong and you want to delete everything seeded from csv files:
|
27
27
|
# rake db:seed:cleanup
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
28
|
+
require 'seedsv/csv_seed'
|
29
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/*.rake')].each{ |task| load task }
|
30
|
+
require 'seedsv'
|
31
|
+
|
data/lib/seedsv/csv_seed.rb
CHANGED
@@ -5,7 +5,7 @@ module Seedsv
|
|
5
5
|
mattr_accessor :csv_class
|
6
6
|
|
7
7
|
#Use appropriate ruby library
|
8
|
-
if
|
8
|
+
if RUBY_VERSION.include?('1.9')
|
9
9
|
require 'csv'
|
10
10
|
@@csv_class = CSV
|
11
11
|
else
|
@@ -34,7 +34,9 @@ module Seedsv
|
|
34
34
|
migration_class.transaction do
|
35
35
|
csv_file.each do |line_values|
|
36
36
|
record = migration_class.new
|
37
|
-
line_values.to_hash.keys.map
|
37
|
+
line_values.to_hash.keys.map do |attribute|
|
38
|
+
record.send("#{attribute.strip}=",line_values[attribute].strip) rescue nil
|
39
|
+
end
|
38
40
|
record.save(:validate => false)
|
39
41
|
end
|
40
42
|
end
|
data/seedsv.gemspec
CHANGED
@@ -1,60 +1,57 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{seedsv}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Adrian Cuadros"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-03-11}
|
13
13
|
s.description = %q{Seed your database with data from csv files with ease}
|
14
14
|
s.email = %q{adrian@innku.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"test/test_seedssv.rb"
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/seedsv.rb",
|
26
|
+
"lib/seedsv/csv_seed.rb",
|
27
|
+
"lib/seedsv/engine.rb",
|
28
|
+
"lib/tasks/seedsv.rake",
|
29
|
+
"seedsv.gemspec",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_seedssv.rb"
|
33
32
|
]
|
34
33
|
s.homepage = %q{http://github.com/adriancuadros/seedsv}
|
35
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
36
34
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.
|
35
|
+
s.rubygems_version = %q{1.5.2}
|
38
36
|
s.summary = %q{Seed your database with data from csv files with ease}
|
39
37
|
s.test_files = [
|
40
38
|
"test/helper.rb",
|
41
|
-
|
39
|
+
"test/test_seedssv.rb"
|
42
40
|
]
|
43
41
|
|
44
42
|
if s.respond_to? :specification_version then
|
45
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
43
|
s.specification_version = 3
|
47
44
|
|
48
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
46
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
50
|
-
s.add_runtime_dependency(%q<fastercsv>, ["~> 1.5.
|
47
|
+
s.add_runtime_dependency(%q<fastercsv>, ["~> 1.5.1"])
|
51
48
|
else
|
52
49
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
53
|
-
s.add_dependency(%q<fastercsv>, ["~> 1.5.
|
50
|
+
s.add_dependency(%q<fastercsv>, ["~> 1.5.1"])
|
54
51
|
end
|
55
52
|
else
|
56
53
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
57
|
-
s.add_dependency(%q<fastercsv>, ["~> 1.5.
|
54
|
+
s.add_dependency(%q<fastercsv>, ["~> 1.5.1"])
|
58
55
|
end
|
59
56
|
end
|
60
57
|
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seedsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.0
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Adrian Cuadros
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-03-11 00:00:00 -06:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ">="
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
24
|
version: "0"
|
33
25
|
type: :development
|
34
26
|
version_requirements: *id001
|
@@ -40,12 +32,7 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ~>
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 5
|
47
|
-
- 3
|
48
|
-
version: 1.5.3
|
35
|
+
version: 1.5.1
|
49
36
|
type: :runtime
|
50
37
|
version_requirements: *id002
|
51
38
|
description: Seed your database with data from csv files with ease
|
@@ -59,7 +46,6 @@ extra_rdoc_files:
|
|
59
46
|
- README.rdoc
|
60
47
|
files:
|
61
48
|
- .document
|
62
|
-
- .gitignore
|
63
49
|
- LICENSE
|
64
50
|
- README.rdoc
|
65
51
|
- Rakefile
|
@@ -76,8 +62,8 @@ homepage: http://github.com/adriancuadros/seedsv
|
|
76
62
|
licenses: []
|
77
63
|
|
78
64
|
post_install_message:
|
79
|
-
rdoc_options:
|
80
|
-
|
65
|
+
rdoc_options: []
|
66
|
+
|
81
67
|
require_paths:
|
82
68
|
- lib
|
83
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -85,23 +71,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
71
|
requirements:
|
86
72
|
- - ">="
|
87
73
|
- !ruby/object:Gem::Version
|
88
|
-
hash: 3
|
89
|
-
segments:
|
90
|
-
- 0
|
91
74
|
version: "0"
|
92
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
76
|
none: false
|
94
77
|
requirements:
|
95
78
|
- - ">="
|
96
79
|
- !ruby/object:Gem::Version
|
97
|
-
hash: 3
|
98
|
-
segments:
|
99
|
-
- 0
|
100
80
|
version: "0"
|
101
81
|
requirements: []
|
102
82
|
|
103
83
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.5.2
|
105
85
|
signing_key:
|
106
86
|
specification_version: 3
|
107
87
|
summary: Seed your database with data from csv files with ease
|