spout 0.6.0.beta3 → 0.6.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spout/tasks/engine.rake +6 -2
- data/lib/spout/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68fc0a3c4fab7e033261d72e655de1bdfbc2754e
|
4
|
+
data.tar.gz: eb62cad1ad96fc30c3ce3b3dc2a331d59ef3cb26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75387420b459a3d3b57aae192ebf9f0a0a7607bac20c41f72a094a5cb1ebd40726d71d8844efbb5631832796b6d642c6777cd78c8685a237c2544f176508c33f
|
7
|
+
data.tar.gz: f10ca5e16cb21f4d2ab94e55aa56ef92df57cecce2affd6c7a878ce8b8afca9b995eb0b68c1f626c3febd1dac2de5410f9fdecaa437f1e636b5f03958b1c7320
|
data/lib/spout/tasks/engine.rake
CHANGED
@@ -51,11 +51,13 @@ namespace :dd do
|
|
51
51
|
all_column_headers = []
|
52
52
|
|
53
53
|
variable_json_ids = []
|
54
|
+
choice_variables = []
|
54
55
|
variable_file_names = []
|
55
56
|
|
56
57
|
Dir.glob("variables/**/*.json").each do |file|
|
57
58
|
if json = JSON.parse(File.read(file)) rescue false
|
58
59
|
variable_json_ids << json['id']
|
60
|
+
choice_variables << json['id'] if json['type'] == 'choices'
|
59
61
|
end
|
60
62
|
variable_file_names << file.split('/').last.to_s.split('.json').first.to_s
|
61
63
|
end
|
@@ -76,11 +78,13 @@ namespace :dd do
|
|
76
78
|
row_count = 0
|
77
79
|
|
78
80
|
csvs.each do |csv_file|
|
81
|
+
total_row_count = CSV.readlines(csv_file, 'r:iso-8859-1:utf-8').size - 1
|
79
82
|
CSV.parse( File.open(csv_file, 'r:iso-8859-1:utf-8'){|f| f.read}, headers: true ) do |line|
|
83
|
+
puts "ROW: #{row_count+1} of #{total_row_count}"
|
80
84
|
row = line.to_hash
|
81
|
-
|
85
|
+
choice_variables.each do |column_name|
|
82
86
|
value_hash[column_name] ||= []
|
83
|
-
value_hash[column_name] = value_hash[column_name] | [
|
87
|
+
value_hash[column_name] = value_hash[column_name] | [row[column_name]] if row[column_name]
|
84
88
|
end
|
85
89
|
|
86
90
|
row_count += 1
|
data/lib/spout/version.rb
CHANGED