spout 0.8.0.beta11 → 0.8.0.beta12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/spout/commands/coverage.rb +2 -2
- data/lib/spout/commands/exporter.rb +1 -0
- data/lib/spout/commands/importer.rb +1 -0
- data/lib/spout/commands/outliers.rb +2 -2
- data/lib/spout/helpers/chart_types.rb +2 -2
- data/lib/spout/helpers/json_loader.rb +1 -1
- data/lib/spout/helpers/subject_loader.rb +10 -7
- data/lib/spout/models/coverage_result.rb +3 -3
- data/lib/spout/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b54a8c6d6961f85f94ebc386b6d19f2c005c065
|
4
|
+
data.tar.gz: 28080e314a53b7de358956658e2a0c3cf81a8d30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d6e7f3af3e290a83147ffac8c3cb215193bede45866c028a06ace4b6cfd1fdaa9e321b6f5138a6a0d094cae5c3ad4e13b279846a54cb57b5680390b8e2a47e3
|
7
|
+
data.tar.gz: ff772b5b0633a23137dd8a34623fcdaa2c0cafdc1e09ebc47858ac1eb4a2fc835a6c2d5ba37793e1c3f8f62a59c295b04d29ff2e1e21fc8d6e0ef347bf53ca43
|
data/CHANGELOG.md
CHANGED
@@ -14,6 +14,9 @@
|
|
14
14
|
- Updated to colorize 0.7.2
|
15
15
|
- Use of Ruby 2.1.2 is now recommended
|
16
16
|
|
17
|
+
### Bug Fix
|
18
|
+
- Spout commands are now more consistently case insensitive for file and column names across platforms
|
19
|
+
|
17
20
|
### Testing
|
18
21
|
- Refactored Spout code and updated test coverage for all major spout commands
|
19
22
|
|
@@ -29,6 +29,8 @@ module Spout
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def run_coverage_report!
|
32
|
+
puts "Generating: index.html\n\n"
|
33
|
+
|
32
34
|
@matching_results = []
|
33
35
|
|
34
36
|
@subject_loader.all_methods.each do |method, csv_files|
|
@@ -58,8 +60,6 @@ module Spout
|
|
58
60
|
FileUtils.mkpath coverage_folder
|
59
61
|
coverage_file = File.join(coverage_folder, 'index.html')
|
60
62
|
|
61
|
-
print "\nGenerating: index.html\n\n"
|
62
|
-
|
63
63
|
File.open(coverage_file, 'w+') do |file|
|
64
64
|
erb_location = File.join( File.dirname(__FILE__), '../views/index.html.erb' )
|
65
65
|
file.puts ERB.new(File.read(erb_location)).result(binding)
|
@@ -28,6 +28,8 @@ module Spout
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def run_outliers_report!
|
31
|
+
puts "Generating: outliers.html\n\n"
|
32
|
+
|
31
33
|
@outlier_results = @subject_loader.all_methods.collect do |method, csv_files|
|
32
34
|
Spout::Models::OutlierResult.new(@subjects, method, csv_files)
|
33
35
|
end
|
@@ -46,8 +48,6 @@ module Spout
|
|
46
48
|
FileUtils.mkpath coverage_folder
|
47
49
|
html_file = File.join(coverage_folder, 'outliers.html')
|
48
50
|
|
49
|
-
print "\nGenerating: outliers.html\n\n"
|
50
|
-
|
51
51
|
File.open(html_file, 'w+') do |file|
|
52
52
|
erb_location = File.join( File.dirname(__FILE__), '../views/outliers.html.erb' )
|
53
53
|
file.puts ERB.new(File.read(erb_location)).result(binding)
|
@@ -28,7 +28,7 @@ module Spout
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.get_json(file_name, file_type)
|
31
|
-
file = Dir.glob("#{file_type}s/**/#{file_name}.json").first
|
31
|
+
file = Dir.glob("#{file_type.to_s.downcase}s/**/#{file_name.to_s.downcase}.json", File::FNM_CASEFOLD).first
|
32
32
|
json = JSON.parse(File.read(file)) rescue json = nil
|
33
33
|
json
|
34
34
|
end
|
@@ -42,7 +42,7 @@ module Spout
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.domain_array(variable_name)
|
45
|
-
variable_file = Dir.glob("variables/**/#{variable_name}.json").first
|
45
|
+
variable_file = Dir.glob("variables/**/#{variable_name.to_s.downcase}.json", File::FNM_CASEFOLD).first
|
46
46
|
json = JSON.parse(File.read(variable_file)) rescue json = nil
|
47
47
|
if json
|
48
48
|
domain_json = get_domain(json)
|
@@ -3,7 +3,7 @@ module Spout
|
|
3
3
|
class JsonLoader
|
4
4
|
|
5
5
|
def self.get_json(file_name, file_type)
|
6
|
-
file = Dir.glob("#{file_type}s/**/#{file_name}.json").first
|
6
|
+
file = Dir.glob("#{file_type.to_s.downcase}s/**/#{file_name.to_s.downcase}.json", File::FNM_CASEFOLD).first
|
7
7
|
json = JSON.parse(File.read(file)) rescue json = nil
|
8
8
|
json
|
9
9
|
end
|
@@ -35,27 +35,30 @@ module Spout
|
|
35
35
|
CSV.parse( File.open(csv_file, 'r:iso-8859-1:utf-8'){|f| f.read}, headers: true, header_converters: lambda { |h| h.to_s.downcase } ) do |line|
|
36
36
|
row = line.to_hash
|
37
37
|
count += 1
|
38
|
-
|
38
|
+
print '.' if (count % 10 == 0)
|
39
39
|
@subjects << Spout::Models::Subject.create do |t|
|
40
40
|
t._visit = row[@visit]
|
41
41
|
|
42
42
|
row.each do |key,value|
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
method = key.to_s.downcase
|
44
|
+
|
45
|
+
unless t.respond_to?(method)
|
46
|
+
t.class.send(:define_method, "#{method}") { instance_variable_get("@#{method}") }
|
47
|
+
t.class.send(:define_method, "#{method}=") { |value| instance_variable_set("@#{method}", value) }
|
46
48
|
end
|
47
49
|
|
48
|
-
@all_methods[
|
49
|
-
@all_methods[
|
50
|
+
@all_methods[method] ||= []
|
51
|
+
@all_methods[method] = @all_methods[method] | [csv_file]
|
50
52
|
|
51
53
|
unless value == nil
|
52
|
-
t.send("#{
|
54
|
+
t.send("#{method}=", value)
|
53
55
|
end
|
54
56
|
end
|
55
57
|
end
|
56
58
|
# puts "Memory Used: " + (`ps -o rss -p #{$$}`.strip.split.last.to_i / 1024).to_s + " MB" if count % 1000 == 0
|
57
59
|
break if @number_of_rows != nil and count >= @number_of_rows
|
58
60
|
end
|
61
|
+
puts "\n\n"
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|
@@ -16,7 +16,7 @@ module Spout
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def load_json(column)
|
19
|
-
file = Dir.glob("variables/**/#{column}.json").first
|
19
|
+
file = Dir.glob("variables/**/#{column.to_s.downcase}.json", File::FNM_CASEFOLD).first
|
20
20
|
@file_name_test = (file != nil)
|
21
21
|
@json = JSON.parse(File.read(file)) rescue @json = {}
|
22
22
|
@json_id_test = (@json['id'].to_s.downcase == column)
|
@@ -25,7 +25,7 @@ module Spout
|
|
25
25
|
def load_valid_values
|
26
26
|
valid_values = []
|
27
27
|
if @json['type'] == 'choices'
|
28
|
-
file = Dir.glob("domains/**/#{@json['domain']}.json").first
|
28
|
+
file = Dir.glob("domains/**/#{@json['domain'].to_s.downcase}.json", File::FNM_CASEFOLD).first
|
29
29
|
if json = JSON.parse(File.read(file)) rescue false
|
30
30
|
valid_values = json.collect{|hash| hash['value']}
|
31
31
|
end
|
@@ -49,7 +49,7 @@ module Spout
|
|
49
49
|
if @json['type'] != 'choices'
|
50
50
|
true
|
51
51
|
else
|
52
|
-
domain_file = Dir.glob("domains/**/#{@json['domain']}.json").first
|
52
|
+
domain_file = Dir.glob("domains/**/#{@json['domain'].to_s.downcase}.json", File::FNM_CASEFOLD).first
|
53
53
|
if domain_json = JSON.parse(File.read(domain_file)) rescue false
|
54
54
|
return domain_json.kind_of?(Array)
|
55
55
|
end
|
data/lib/spout/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0.
|
4
|
+
version: 0.8.0.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Remo Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|