rseed 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDBiZmY3MmM0M2RjNmViZDdiMzRiOGU5ZDMyODY0NTU1YTE3NTkyMQ==
4
+ NmE5Nzg2ZTYwODNlMGQ4ZWZmYzA2Yjc5NzAxMzE1YzQ1NGVmZWFjMw==
5
5
  data.tar.gz: !binary |-
6
- YmJkNzI5MDZkNmQwNzIyZDVkNTNjZjRkMWE1N2EzM2E0NTNiMmZjYQ==
6
+ MGJjYjM4NDYyNjgwOWE0NjE4NDZlOWVkZGVkNjVjMTFmNmRlZDJmNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzAwNGRhZDMzYjM0YWJjMTk4YzNkMzA4OWQyY2FkZjEzM2U3MmZmYTFkYzkw
10
- MGU4YTNhYTIyMTQ5MzQ3ODRiZGY4NGVlNDgyMmY0MjY3NGZhYjRiMmUzMWEx
11
- MTRmZWJjZTFlYmU1MGQ5NTcyY2M4OGNmNDVjNzQ5MmE5NmY2NDE=
9
+ OTFkZGIxOTVkYjdhNTIyOGY0YTVmZTA2NGIwMzBjMWVmNmI2YWYwMDViNTM4
10
+ YjExOWQwNzAwMjAzZGFjYTE0OWMzYzhhM2IzMzU3ZjM0NjMwYjBjM2YwODAz
11
+ ZTQ1NGM3MTk2OGQwNzZhYWZlNmY2NWZkZDg0M2U2YTFlOGI4NDI=
12
12
  data.tar.gz: !binary |-
13
- MGVjMjYwNmI3NzY2ZDFjZjJkNDcxZmRlZmFjM2VkZDIyMGYyZWYzMGIyYzg1
14
- NmRlMThiMjMzYzRjYzBkZjFmMjRiZjgwZDRiYTI5OWQ2MTdmODM3MzZkN2Fl
15
- NzkzNjUyNzkyZGRlZjkwYjgwNDMzODNkYWNjY2QyMzE4ODA2OWY=
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
- * For some reason that we haven't been able to pin down, Rails struggles with resolving constants within these converters.
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 :: within your converters. This is done by default when using the generator*
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
 
@@ -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
- CSV.foreach(file, {:encoding => 'windows-1251:utf-8'}) do |row|
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
@@ -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 = deserialize_converter_options(options[:converter_options])if options[: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 deserialize_converter_options converter_options
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
@@ -1,3 +1,3 @@
1
1
  module Rseed
2
- VERSION = "1.0.13"
2
+ VERSION = "1.0.14"
3
3
  end
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.13
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-15 00:00:00.000000000 Z
11
+ date: 2013-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize