spout 0.11.0 → 0.11.1

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/spout/commands/coverage.rb +2 -0
  4. data/lib/spout/commands/deploy.rb +2 -0
  5. data/lib/spout/commands/exporter.rb +2 -0
  6. data/lib/spout/commands/graphs.rb +36 -33
  7. data/lib/spout/commands/help.rb +2 -0
  8. data/lib/spout/commands/importer.rb +2 -0
  9. data/lib/spout/commands/outliers.rb +2 -0
  10. data/lib/spout/commands/project_generator.rb +2 -0
  11. data/lib/spout/helpers/array_statistics.rb +2 -0
  12. data/lib/spout/helpers/chart_types.rb +2 -0
  13. data/lib/spout/helpers/config_reader.rb +2 -0
  14. data/lib/spout/helpers/iterators.rb +2 -0
  15. data/lib/spout/helpers/json_loader.rb +2 -0
  16. data/lib/spout/helpers/json_request.rb +2 -0
  17. data/lib/spout/helpers/json_request_generic.rb +2 -0
  18. data/lib/spout/helpers/number_helper.rb +2 -0
  19. data/lib/spout/helpers/quietly.rb +2 -0
  20. data/lib/spout/helpers/semantic.rb +2 -0
  21. data/lib/spout/helpers/send_file.rb +2 -0
  22. data/lib/spout/helpers/subject_loader.rb +5 -2
  23. data/lib/spout/helpers/table_formatting.rb +2 -0
  24. data/lib/spout/models/bucket.rb +2 -0
  25. data/lib/spout/models/coverage_result.rb +2 -0
  26. data/lib/spout/models/dictionary.rb +2 -0
  27. data/lib/spout/models/domain.rb +2 -0
  28. data/lib/spout/models/empty.rb +2 -0
  29. data/lib/spout/models/form.rb +2 -0
  30. data/lib/spout/models/graphables/choices_vs_choices.rb +2 -0
  31. data/lib/spout/models/graphables/choices_vs_numeric.rb +2 -0
  32. data/lib/spout/models/graphables/default.rb +2 -0
  33. data/lib/spout/models/graphables/histogram.rb +2 -0
  34. data/lib/spout/models/graphables/numeric_vs_choices.rb +2 -0
  35. data/lib/spout/models/graphables/numeric_vs_numeric.rb +2 -0
  36. data/lib/spout/models/graphables.rb +2 -0
  37. data/lib/spout/models/option.rb +2 -0
  38. data/lib/spout/models/outlier_result.rb +2 -0
  39. data/lib/spout/models/record.rb +2 -0
  40. data/lib/spout/models/subject.rb +2 -0
  41. data/lib/spout/models/tables/choices_vs_choices.rb +2 -0
  42. data/lib/spout/models/tables/choices_vs_numeric.rb +2 -0
  43. data/lib/spout/models/tables/default.rb +2 -0
  44. data/lib/spout/models/tables/numeric_vs_choices.rb +2 -0
  45. data/lib/spout/models/tables/numeric_vs_numeric.rb +2 -0
  46. data/lib/spout/models/tables.rb +2 -0
  47. data/lib/spout/models/variable.rb +2 -0
  48. data/lib/spout/tasks/engine.rake +2 -0
  49. data/lib/spout/tasks.rb +2 -0
  50. data/lib/spout/templates/test/dictionary_test.rb +2 -0
  51. data/lib/spout/templates/test/test_helper.rb +2 -0
  52. data/lib/spout/tests/domain_existence_validation.rb +2 -0
  53. data/lib/spout/tests/domain_format.rb +2 -0
  54. data/lib/spout/tests/domain_name_format.rb +2 -0
  55. data/lib/spout/tests/domain_name_uniqueness.rb +2 -0
  56. data/lib/spout/tests/domain_specified.rb +2 -0
  57. data/lib/spout/tests/form_existence_validation.rb +2 -0
  58. data/lib/spout/tests/form_name_format.rb +2 -0
  59. data/lib/spout/tests/form_name_match.rb +2 -0
  60. data/lib/spout/tests/form_name_uniqueness.rb +2 -0
  61. data/lib/spout/tests/json_helper.rb +2 -0
  62. data/lib/spout/tests/json_validation.rb +2 -0
  63. data/lib/spout/tests/variable_display_name_length.rb +2 -2
  64. data/lib/spout/tests/variable_name_format.rb +2 -0
  65. data/lib/spout/tests/variable_name_match.rb +2 -0
  66. data/lib/spout/tests/variable_name_uniqueness.rb +2 -0
  67. data/lib/spout/tests/variable_type_validation.rb +6 -5
  68. data/lib/spout/tests.rb +2 -0
  69. data/lib/spout/version.rb +4 -2
  70. data/lib/spout.rb +2 -0
  71. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e001b51a9983790658860bbb51632a1813b894d1
4
- data.tar.gz: 0f211bacf09bb60aa4ddba44b83402ce7301140c
3
+ metadata.gz: be0327cbf6a23831a9d083cb661fad0dde046ca7
4
+ data.tar.gz: d67d665c3054ae148b984cabfe06a1bb11f981bf
5
5
  SHA512:
6
- metadata.gz: 02a7909c448bc1b41857e5f42d9f4c5be878c17943731016477a87cee969c2143b341b58d1573e1155989fbbad9682cf4598d37d265fc5a710257daf7b517290
7
- data.tar.gz: 7080763bcf995bf88767a59948b2cff64e97cb61c1c1bf73cc6bfa227f86eb28c6e6acdf2ce73fd4fd65901f42913353a97e990ba6454b8e5c9ad9cfa06bc7f8
6
+ metadata.gz: 9ec0a4511d1b4b1a13dd1cc17c2941dc7d10dac65b9879a4fe808e0463ab6541bfd13104abdc93e88a591fccbdf04f196b4397a75f8fafc98800f0657825d1ec
7
+ data.tar.gz: 8296234875bf25d5cb5c5e0ee8c126e99a5677bb9557a797dfdcf69dc9b29df0f376a66de60957812063ec553ee5647f5fdab95dc25d134bd001e9c98c837a90
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.11.1 (February 4, 2016)
2
+
3
+ ### Bug Fix
4
+ - Fixed a bug that prevented variables without graphs from being pushed to server
5
+
1
6
  ## 0.11.0 (January 19, 2016)
2
7
 
3
8
  ### Deprecations
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'erb'
3
5
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'colorize'
2
4
  require 'net/http'
3
5
  require 'io/console'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csv'
2
4
  require 'json'
3
5
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csv'
2
4
  require 'fileutils'
3
5
  require 'rubygems'
@@ -104,7 +106,6 @@ module Spout
104
106
 
105
107
  next unless variable.errors.size == 0
106
108
  next unless @valid_ids.include?(variable.id) || @valid_ids.size == 0
107
- next unless %w(numeric integer choices).include?(variable.type)
108
109
  next unless Spout::Models::Subject.method_defined?(variable.id)
109
110
 
110
111
  if @deploy_mode
@@ -117,37 +118,7 @@ module Spout
117
118
  @progress[variable.id]['uploaded'] ||= []
118
119
  next if (!@deploy_mode && @progress[variable.id]['generated'] == true) || (@deploy_mode && @progress[variable.id]['uploaded'].include?(@webserver_name))
119
120
 
120
- stats = {
121
- charts: {},
122
- tables: {}
123
- }
124
-
125
- @chart_variables.each do |chart_type_hash|
126
- chart_type = chart_type_hash['chart']
127
- chart_title = chart_type_hash['title'].downcase.gsub(' ', '-')
128
- chart_variable = Spout::Models::Variable.find_by_id(chart_type)
129
-
130
- filtered_subjects = @subjects.reject { |s| s.send(chart_type).nil? || s.send(variable.id).nil? }
131
-
132
- next if filtered_subjects.collect(&variable.id.to_sym).compact_empty.count == 0
133
- if chart_type == @config.visit
134
- graph = Spout::Models::Graphables.for(variable, chart_variable, nil, filtered_subjects)
135
- stats[:charts][chart_title] = graph.to_hash
136
- table = Spout::Models::Tables.for(variable, chart_variable, filtered_subjects, nil, totals: false)
137
- stats[:tables][chart_title] = table.to_hash
138
- else
139
- graph = Spout::Models::Graphables.for(variable, chart_variable, @stratification_variable, filtered_subjects)
140
- stats[:charts][chart_title] = graph.to_hash
141
- stats[:tables][chart_title] = @stratification_variable.domain.options.collect do |option|
142
- visit_subjects = filtered_subjects.select { |s| s._visit == option.value }
143
- Spout::Models::Tables.for(variable, chart_variable, visit_subjects, option.display_name).to_hash
144
- end.compact
145
- end
146
- end
147
-
148
- chart_json_file = File.join(@graphs_folder, "#{variable.id}.json")
149
- File.open(chart_json_file, 'w') { |file| file.write(JSON.pretty_generate(stats) + "\n") }
150
- @progress[variable.id]['generated'] = true
121
+ stats = compute_stats(variable)
151
122
 
152
123
  if @deploy_mode && !@progress[variable.id]['uploaded'].include?(@webserver_name)
153
124
  values = @subjects.collect(&variable.id.to_sym).compact_empty
@@ -166,6 +137,39 @@ module Spout
166
137
  end
167
138
  end
168
139
 
140
+ def compute_stats(variable)
141
+ stats = { charts: {}, tables: {} }
142
+ return stats unless %w(numeric integer choices).include?(variable.type)
143
+
144
+ @chart_variables.each do |chart_type_hash|
145
+ chart_type = chart_type_hash['chart']
146
+ chart_title = chart_type_hash['title'].downcase.tr(' ', '-')
147
+ chart_variable = Spout::Models::Variable.find_by_id(chart_type)
148
+
149
+ filtered_subjects = @subjects.reject { |s| s.send(chart_type).nil? || s.send(variable.id).nil? }
150
+
151
+ next if filtered_subjects.collect(&variable.id.to_sym).compact_empty.count == 0
152
+ if chart_type == @config.visit
153
+ graph = Spout::Models::Graphables.for(variable, chart_variable, nil, filtered_subjects)
154
+ stats[:charts][chart_title] = graph.to_hash
155
+ table = Spout::Models::Tables.for(variable, chart_variable, filtered_subjects, nil, totals: false)
156
+ stats[:tables][chart_title] = table.to_hash
157
+ else
158
+ graph = Spout::Models::Graphables.for(variable, chart_variable, @stratification_variable, filtered_subjects)
159
+ stats[:charts][chart_title] = graph.to_hash
160
+ stats[:tables][chart_title] = @stratification_variable.domain.options.collect do |option|
161
+ visit_subjects = filtered_subjects.select { |s| s._visit == option.value }
162
+ Spout::Models::Tables.for(variable, chart_variable, visit_subjects, option.display_name).to_hash
163
+ end.compact
164
+ end
165
+ end
166
+
167
+ chart_json_file = File.join(@graphs_folder, "#{variable.id}.json")
168
+ File.open(chart_json_file, 'w') { |file| file.write(JSON.pretty_generate(stats) + "\n") }
169
+ @progress[variable.id]['generated'] = true
170
+ stats
171
+ end
172
+
169
173
  def send_variable_params_to_server(variable, stats)
170
174
  params = { auth_token: @token, version: @standard_version,
171
175
  dataset: @slug, variable: variable.deploy_params,
@@ -174,7 +178,6 @@ module Spout
174
178
  params[:variable][:spout_stats] = stats.to_json
175
179
  (response, status) = Spout::Helpers::JsonRequestGeneric.post("#{@url}/api/v1/variables/create_or_update.json", params)
176
180
  if response.is_a?(Hash) && status.is_a?(Net::HTTPSuccess)
177
- # puts "response: #{response}".colorize(:blue)
178
181
  @progress[variable.id]['uploaded'] << @webserver_name
179
182
  else
180
183
  puts "\nUPLOAD FAILED: ".colorize(:red) + variable.id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'colorize'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'csv'
2
4
  require 'json'
3
5
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'erb'
3
5
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'colorize'
2
4
  require 'fileutils'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Extensions to the Array class to calculate quartiles, outliers, and statistics
2
4
  class Array
3
5
  def compact_empty
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/helpers/array_statistics'
2
4
  require 'spout/helpers/table_formatting'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/dictionary'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openssl'
2
4
  require 'net/http'
3
5
  require 'json'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openssl'
2
4
  require 'net/http'
3
5
  require 'json'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Helpers
3
5
  module NumberHelper
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Helpers
3
5
  # Silences output for tests
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Helpers
3
5
  # Helps to sort semantically versioned numbers to match versions that are
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'openssl'
2
4
  require 'net/http'
3
5
  require 'json'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'colorize'
2
4
  require 'csv'
3
5
  require 'json'
@@ -129,8 +131,9 @@ module Spout
129
131
 
130
132
  def get_json(file_name, file_type)
131
133
  file = Dir.glob("#{file_type.to_s.downcase}s/**/#{file_name.to_s.downcase}.json", File::FNM_CASEFOLD).first
132
- json = JSON.parse(File.read(file)) rescue json = nil
133
- json
134
+ JSON.parse(File.read(file))
135
+ rescue
136
+ nil
134
137
  end
135
138
 
136
139
  def get_variable(variable_name)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Helpers
3
5
  class TableFormatting
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Models
3
5
  # Defines a continuous or discrete bucket for tables and graphs
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/tests/variable_type_validation'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/variable'
2
4
  require 'spout/models/domain'
3
5
  require 'spout/models/form'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  require 'spout/models/record'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Models
3
5
  # Used for empty values, these values exist in that the column is defined
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # {
2
4
  # "id": "intake_questionnaire",
3
5
  # "display_name": "Intake Questionnaire at Baseline Visit",
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
  require 'spout/helpers/array_statistics'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/variable'
2
4
  require 'spout/models/bucket'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
  require 'spout/helpers/array_statistics'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/graphables/default'
2
4
  require 'spout/models/graphables/histogram'
3
5
  require 'spout/models/graphables/numeric_vs_choices'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Models
3
5
  class Option
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/helpers/array_statistics'
2
4
  require 'spout/helpers/json_loader'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'fileutils'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Models
3
5
  # Subject encapsulates records for individuals specified by an identifier
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/tables/default'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/tables/default'
2
4
  require 'spout/helpers/array_statistics'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/variable'
2
4
  require 'spout/helpers/table_formatting'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/tables/default'
2
4
  require 'spout/helpers/array_statistics'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/tables/default'
2
4
  require 'spout/helpers/array_statistics'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/models/tables/default'
2
4
  require 'spout/models/tables/numeric_vs_choices'
3
5
  require 'spout/models/tables/choices_vs_choices'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  require 'spout/models/record'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/testtask'
2
4
  require 'colorize'
3
5
 
data/lib/spout/tasks.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Load Spout rakefile extensions
2
4
  %w(
3
5
  engine
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  # Launches default Spout tests and custom tests for specific to this dictionary
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/tests'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module DomainExistenceValidation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module DomainFormat
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  # Tests to assure that the domain name starts with a lowercase letter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module DomainNameUniqueness
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/tests/json_helper'
2
4
 
3
5
  module Spout
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module FormExistenceValidation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  # Tests to assure that the domain name starts with a lowercase letter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module FormNameMatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module FormNameUniqueness
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  def json_value(file, key)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module JsonValidation
@@ -1,13 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module VariableDisplayNameLength
4
-
5
6
  Dir.glob("variables/**/*.json").each do |file|
6
7
  define_method("test_variable_display_name_length: "+file) do
7
8
  assert_operator 255, :>=, (begin JSON.parse(File.read(file))["display_name"].size rescue 0 end)
8
9
  end
9
10
  end
10
-
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  # Tests to assure that the variable name starts with a lowercase letter
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module VariableNameMatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module VariableNameUniqueness
@@ -1,19 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module Tests
3
5
  module VariableTypeValidation
4
- VALID_VARIABLE_TYPES = ['identifier', 'choices', 'integer', 'numeric', 'string', 'text', 'date', 'time', 'file', 'datetime'].sort
6
+ VALID_VARIABLE_TYPES = %w(identifier choices integer numeric string text date time file datetime).sort
5
7
 
6
8
  def assert_variable_type(item)
7
9
  message = "#{item} invalid variable type. Valid types: #{VALID_VARIABLE_TYPES.join(', ')}"
8
10
  assert VALID_VARIABLE_TYPES.include?(item), message
9
11
  end
10
12
 
11
- Dir.glob("variables/**/*.json").each do |file|
12
- define_method("test_variable_type: "+file) do
13
- assert_variable_type begin JSON.parse(File.read(file))["type"] rescue nil end
13
+ Dir.glob('variables/**/*.json').each do |file|
14
+ define_method("test_variable_type: #{file}") do
15
+ assert_variable_type begin JSON.parse(File.read(file))['type'] rescue nil end
14
16
  end
15
17
  end
16
-
17
18
  end
18
19
  end
19
20
  end
data/lib/spout/tests.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'json'
3
5
 
data/lib/spout/version.rb CHANGED
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Spout
2
4
  module VERSION #:nodoc:
3
5
  MAJOR = 0
4
6
  MINOR = 11
5
- TINY = 0
7
+ TINY = 1
6
8
  BUILD = nil # 'pre', 'rc', 'rc2', nil
7
9
 
8
- STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
10
+ STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.').freeze
9
11
  end
10
12
  end
data/lib/spout.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spout/version'
2
4
 
3
5
  require 'spout/models/dictionary'
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.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-19 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler