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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e85fa1a3ea963f131b61ce1952d10f1744c510a1
4
- data.tar.gz: 2569c7aa7cbf7ce5bab644c128707e70a6ac659c
3
+ metadata.gz: 68fc0a3c4fab7e033261d72e655de1bdfbc2754e
4
+ data.tar.gz: eb62cad1ad96fc30c3ce3b3dc2a331d59ef3cb26
5
5
  SHA512:
6
- metadata.gz: c7766b6aadc863f2159fa7e8ba33d10be37d97feb2f4a71317049941cd29d3a7bcab1128c3613ed945a4da62ea11aea073870b8461b1dd86330b2d95c83e6f95
7
- data.tar.gz: 35005ff394184b10aaad88955b7129401c81ee8ee883b91cf952eb0e4c68a88709c583eacb48e64a1e50785ea0f036e694172871038825533a6ce347297a8fbd
6
+ metadata.gz: 75387420b459a3d3b57aae192ebf9f0a0a7607bac20c41f72a094a5cb1ebd40726d71d8844efbb5631832796b6d642c6777cd78c8685a237c2544f176508c33f
7
+ data.tar.gz: f10ca5e16cb21f4d2ab94e55aa56ef92df57cecce2affd6c7a878ce8b8afca9b995eb0b68c1f626c3febd1dac2de5410f9fdecaa437f1e636b5f03958b1c7320
@@ -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
- row.each do |column_name, value|
85
+ choice_variables.each do |column_name|
82
86
  value_hash[column_name] ||= []
83
- value_hash[column_name] = value_hash[column_name] | [value]
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
@@ -3,7 +3,7 @@ module Spout
3
3
  MAJOR = 0
4
4
  MINOR = 6
5
5
  TINY = 0
6
- BUILD = "beta3" # nil, "pre", "rc", "rc2"
6
+ BUILD = "beta4" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta3
4
+ version: 0.6.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller