rseed 1.0.13 → 1.0.14
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.
- checksums.yaml +8 -8
- data/README.rdoc +3 -3
- data/lib/rseed/csv_adapter.rb +2 -1
- data/lib/rseed/processor.rb +3 -2
- data/lib/rseed/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmE5Nzg2ZTYwODNlMGQ4ZWZmYzA2Yjc5NzAxMzE1YzQ1NGVmZWFjMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGJjYjM4NDYyNjgwOWE0NjE4NDZlOWVkZGVkNjVjMTFmNmRlZDJmNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTFkZGIxOTVkYjdhNTIyOGY0YTVmZTA2NGIwMzBjMWVmNmI2YWYwMDViNTM4
|
10
|
+
YjExOWQwNzAwMjAzZGFjYTE0OWMzYzhhM2IzMzU3ZjM0NjMwYjBjM2YwODAz
|
11
|
+
ZTQ1NGM3MTk2OGQwNzZhYWZlNmY2NWZkZDg0M2U2YTFlOGI4NDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTJjZDdhM2ViNzBlYmQyMTM3ZWNkZTZkOTkxN2Q2ODk0NGU3ZWNmMDIwMjI5
|
14
|
+
NWNlOGE4MDkxZjUyZmU1ZTk5OGY5ZTdhMjhlMTQ3ODUwMTY4ZjM3OTA3NDEw
|
15
|
+
N2I0MGRlMTM0ZThlNzZmMzExY2Q5ZDUyM2E2YzVmY2FlYTliNjE=
|
data/README.rdoc
CHANGED
@@ -45,9 +45,9 @@ This will cause the generator to create a file with fewer
|
|
45
45
|
|
46
46
|
== The Converter File
|
47
47
|
|
48
|
-
|
48
|
+
<em>For some reason that we haven't been able to pin down, Rails struggles with resolving constants within these converters.
|
49
49
|
This does not affect the converters when running in production modes. The workaround for this is to prefix any of your
|
50
|
-
constant names (such as model classes) with
|
50
|
+
constant names (such as model classes) with \:: within your converters. This is done by default when using the generator</em>
|
51
51
|
|
52
52
|
=== Attribute Options
|
53
53
|
|
@@ -120,7 +120,7 @@ These rake tasks allow you to run seeds manually:
|
|
120
120
|
|
121
121
|
=== Examples
|
122
122
|
|
123
|
-
rake rseed:csv file=users.csv converter=User converter_options="give_admin_access=true"
|
123
|
+
rake rseed:csv file=users.csv converter=User converter_options="give_admin_access=true" adapter_options="col_sep=\t"
|
124
124
|
|
125
125
|
In this case the file in db/rseed/users.csv would be run through the converter UserConverter. The options specified are available within the converter. In this case options["give_admin_access"] will evaluate to "true".
|
126
126
|
|
data/lib/rseed/csv_adapter.rb
CHANGED
@@ -19,7 +19,8 @@ module Rseed
|
|
19
19
|
row_number = 0
|
20
20
|
|
21
21
|
# Get an estimate of the number of rows in the file
|
22
|
-
|
22
|
+
csv_options = {:encoding => 'windows-1251:utf-8'}.merge(self.options.symbolize_keys)
|
23
|
+
CSV.foreach(file, csv_options) do |row|
|
23
24
|
row_number += 1
|
24
25
|
if (header)
|
25
26
|
column = 0
|
data/lib/rseed/processor.rb
CHANGED
@@ -10,7 +10,8 @@ module Rseed
|
|
10
10
|
|
11
11
|
adapter = options[:adapter].is_a?(Adapter) ? options[:adapter] : Rseed.const_get("#{options[:adapter].to_s.classify}Adapter").new
|
12
12
|
converter = options[:converter].is_a?(Converter) ? options[:converter] : Rseed.const_get("#{options[:converter].to_s.classify}Converter").new
|
13
|
-
converter.options =
|
13
|
+
converter.options = deserialize_options(options[:converter_options])if options[:converter_options]
|
14
|
+
adapter.options = deserialize_options(options[:adapter_options])if options[:adapter_options]
|
14
15
|
@within_transaction = options[:within_transaction]
|
15
16
|
@adapter = adapter
|
16
17
|
@converter = converter
|
@@ -99,7 +100,7 @@ module Rseed
|
|
99
100
|
end
|
100
101
|
end
|
101
102
|
|
102
|
-
def
|
103
|
+
def deserialize_options converter_options
|
103
104
|
if converter_options.is_a? String
|
104
105
|
co = converter_options.split(";")
|
105
106
|
converter_options = {}
|
data/lib/rseed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rseed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Monagle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|