spout 0.6.0.rc → 0.6.0.rc2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbef72d6ca54c940ae287a25f94bd794a7ea7eb1
4
- data.tar.gz: ab4f7c2e9b7ed6261f1307ac01902f1d76841bf7
3
+ metadata.gz: 40ca80a8308b3ff91f3b3d695e3b38f3849246d3
4
+ data.tar.gz: d7fd795c76c18f4170d682b7100f0a7f23dfcfff
5
5
  SHA512:
6
- metadata.gz: ae5344b68426a94036f75ed40d99cc13fb73eb180d5ecdfedc864acb6b7910fa1f46cc9371f58d2501f5ff536debef735bbc307248689693717e65fc27d2a5d0
7
- data.tar.gz: 7d5bd440cf67393263bc339feb575876e9be618fdc0c83caf1c263abe9fa323bd88b41ca7af00811b72dad44360d1b6633032a6ac1ccbd9822d8f838031365a1
6
+ metadata.gz: b15624d9cedbf4f452ed3b60faafe7ca815dd9bf4f7e5ffe1ce5ee7c0b45f1d3b530721b5a274c6947d2fbb4bb940d861e7909a5b16e58e0c980c8aeb2a77812
7
+ data.tar.gz: f7a25ed6e662aa822d38f1a9978c0391941b467af913d9475d6d3d56ab624fbc13d266bd8c566784ac12eb0e9d1234577d268483d42be2134b1923a8aa045439
@@ -107,11 +107,11 @@ namespace :spout do
107
107
  coverage_folder = File.join(Dir.pwd, 'coverage')
108
108
  FileUtils.mkpath coverage_folder
109
109
  coverage_file = File.join(coverage_folder, 'index.html')
110
+
110
111
  print "\nGenerating: index.html\n\n"
111
112
 
112
113
  File.open(coverage_file, 'w+') do |file|
113
- name = 'index.html'
114
- erb_location = File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")
114
+ erb_location = File.join( File.dirname(__FILE__), '../views/index.html.erb' )
115
115
  file.puts ERB.new(File.read(erb_location)).result(binding)
116
116
  end
117
117
 
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 = "rc" # nil, "pre", "rc", "rc2"
6
+ BUILD = "rc2" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
@@ -61,159 +61,166 @@ tfoot td {
61
61
  </div>
62
62
  </div>
63
63
 
64
- <div style="padding: 30px 30px 10px 30px;">
65
-
66
- <table class="table">
67
- <thead>
68
- <tr>
69
- <th>CSV</th>
70
- <th>Coverage</th>
71
- <th>Columns</th>
72
- <th>Columns Defined</th>
73
- <th>Columns Missed</th>
74
- </tr>
75
- </thead>
76
- <tbody>
77
- <% @coverage_results.each do |csv, total_column_count, mapped_column_count| %>
64
+ <% if @coverage_results.size == 0 %>
65
+ <div class="container" style="margin-top:30px">
66
+ <div class="jumbotron">
67
+ <h1>You made Spout cry... :'-(</h1>
68
+ <p>No CSVs found in <code><%= Dir.pwd %>/csvs/</code></p>
69
+ </div>
70
+ </div>
71
+ <% else %>
72
+ <div style="padding: 30px 30px 10px 30px;">
73
+ <table class="table">
74
+ <thead>
78
75
  <tr>
79
- <td><%= csv %></td>
80
- <td>
81
- <% if total_column_count.to_i > 0 %>
82
- <%= "%0.02f %" % (mapped_column_count * 100.0 / total_column_count) %>
83
- <% else %>
84
- <span class="text-muted">---</span>
85
- <% end %>
86
- </td>
87
- <td><code class="default"><%= number_with_delimiter( total_column_count ) %></code></td>
88
- <td><code class="success"><%= number_with_delimiter( mapped_column_count ) %></code></td>
89
- <td><code><%= number_with_delimiter( total_column_count - mapped_column_count ) %></code></td>
76
+ <th>CSV</th>
77
+ <th>Coverage</th>
78
+ <th>Columns</th>
79
+ <th>Columns Defined</th>
80
+ <th>Columns Missed</th>
90
81
  </tr>
91
- <% end %>
92
- </tbody>
93
- </table>
82
+ </thead>
83
+ <tbody>
84
+ <% @coverage_results.each do |csv, total_column_count, mapped_column_count| %>
85
+ <tr>
86
+ <td><%= csv %></td>
87
+ <td>
88
+ <% if total_column_count.to_i > 0 %>
89
+ <%= "%0.02f %" % (mapped_column_count * 100.0 / total_column_count) %>
90
+ <% else %>
91
+ <span class="text-muted">---</span>
92
+ <% end %>
93
+ </td>
94
+ <td><code class="default"><%= number_with_delimiter( total_column_count ) %></code></td>
95
+ <td><code class="success"><%= number_with_delimiter( mapped_column_count ) %></code></td>
96
+ <td><code><%= number_with_delimiter( total_column_count - mapped_column_count ) %></code></td>
97
+ </tr>
98
+ <% end %>
99
+ </tbody>
100
+ </table>
94
101
 
95
- <table class="table table-bordered table-hover">
96
- <thead>
97
- <tr>
98
- <th>CSV</th>
99
- <th>Column</th>
100
- <th>JSON File</th>
101
- <th>Variable ID</th>
102
- <th>Variable Type</th>
103
- <th>Variable Domain</th>
104
- <th>Values</th>
105
- </tr>
106
- </thead>
107
- <tfoot>
108
- <tr>
109
- <td style="text-align:middle"><p class="lead">Coverage</p></td>
110
- <td style="text-align:middle"><p class="lead"><%= total_count = @matching_results.count %></p></td>
111
- <td style="text-align:center">
112
- <% matched = @matching_results.count{|csv, column, scr| scr.file_name_test} %>
113
- <% matched_percent = (matched * 100.0 / total_count).floor %>
114
- <% missing_percent = 100 - matched_percent %>
115
- <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
116
- <div class="progress progress-striped">
117
- <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
118
- <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
119
- </div>
120
- </td>
121
- <td style="text-align:center">
122
- <% matched = @matching_results.count{|csv, column, scr| scr.json_id_test} %>
123
- <% matched_percent = (matched * 100.0 / total_count).floor %>
124
- <% missing_percent = 100 - matched_percent %>
125
- <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
126
- <div class="progress progress-striped">
127
- <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
128
- <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
129
- </div>
130
- </td>
131
- <td style="text-align:center">
132
- <% matched = @matching_results.count{|csv, column, scr| scr.variable_type_test} %>
133
- <% matched_percent = (matched * 100.0 / total_count).floor %>
134
- <% missing_percent = 100 - matched_percent %>
135
- <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
136
- <div class="progress progress-striped">
137
- <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
138
- <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
139
- </div>
140
- </td>
141
- <td style="text-align:center">
142
- <% matched = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices' and scr.domain_test} %>
143
- <% total_count = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices'} %>
144
- <% matched_percent = (matched * 100.0 / total_count).floor %>
145
- <% missing_percent = 100 - matched_percent %>
146
- <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
147
- <div class="progress progress-striped">
148
- <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
149
- <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
150
- </div>
151
- </td>
152
- <td>
153
- <ul class="list-unstyled">
154
- <li><code class="success">Value exists in dataset, and value exists in domain</code></li>
155
- <li><code class="default">Value <b>does not exist</b> in dataset, but value exists in domain</code></li>
156
- <li><code>Value exists in dataset, but value <b>does not exist</b> in domain</code></li>
157
- </ul>
158
- </td>
159
- </tr>
160
- </tfoot>
161
- <tbody>
162
- <% @matching_results.each do |csv, column, scr| %>
102
+ <table class="table table-bordered table-hover">
103
+ <thead>
163
104
  <tr>
164
- <td><code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv %></code></td>
165
- <td><%= column %></td>
166
- <td>
167
- <% if scr.file_name_test %>
168
- <div class="text-success" style="text-align:center"><span class="glyphicon glyphicon-ok"></span></div>
169
- <% else %>
170
- <span class="text-danger"><code><%= column %>.json</code> missing</span>
171
- <% end %>
105
+ <th>CSV</th>
106
+ <th>Column</th>
107
+ <th>JSON File</th>
108
+ <th>Variable ID</th>
109
+ <th>Variable Type</th>
110
+ <th>Variable Domain</th>
111
+ <th>Values</th>
112
+ </tr>
113
+ </thead>
114
+ <tfoot>
115
+ <tr>
116
+ <td style="text-align:middle"><p class="lead">Coverage</p></td>
117
+ <td style="text-align:middle"><p class="lead"><%= total_count = @matching_results.count %></p></td>
118
+ <td style="text-align:center">
119
+ <% matched = @matching_results.count{|csv, column, scr| scr.file_name_test} %>
120
+ <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
121
+ <% missing_percent = 100 - matched_percent %>
122
+ <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
123
+ <div class="progress progress-striped">
124
+ <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
125
+ <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
126
+ </div>
172
127
  </td>
173
- <td>
174
- <% if scr.file_name_test %>
175
- <% if scr.json_id_test %>
176
- <code class="success">"id": "<%= column %>"</code>
177
- <% else %>
178
- <code>"id": <%= scr.json['id'].inspect %></code>
179
- <% end %>
180
- <% end %>
128
+ <td style="text-align:center">
129
+ <% matched = @matching_results.count{|csv, column, scr| scr.json_id_test} %>
130
+ <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
131
+ <% missing_percent = 100 - matched_percent %>
132
+ <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
133
+ <div class="progress progress-striped">
134
+ <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
135
+ <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
136
+ </div>
181
137
  </td>
182
- <td>
183
- <% if scr.file_name_test %>
184
- <code class="<%= 'success' if scr.variable_type_test %>">"type": <%= scr.json['type'].inspect %></code>
185
- <% end %>
138
+ <td style="text-align:center">
139
+ <% matched = @matching_results.count{|csv, column, scr| scr.variable_type_test} %>
140
+ <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
141
+ <% missing_percent = 100 - matched_percent %>
142
+ <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
143
+ <div class="progress progress-striped">
144
+ <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
145
+ <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
146
+ </div>
147
+ </td>
148
+ <td style="text-align:center">
149
+ <% matched = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices' and scr.domain_test} %>
150
+ <% total_count = @matching_results.count{|csv, column, scr| scr.json['type'] == 'choices'} %>
151
+ <% matched_percent = (total_count == 0 ? 0 : (matched * 100.0 / total_count).floor) %>
152
+ <% missing_percent = 100 - matched_percent %>
153
+ <%= number_with_delimiter( matched ) %> of <%= number_with_delimiter( total_count ) %>
154
+ <div class="progress progress-striped">
155
+ <div class="progress-bar progress-bar-success" style="width: <%= matched_percent %>%"></div>
156
+ <div class="progress-bar progress-bar-danger" style="width: <%= missing_percent %>%"></div>
157
+ </div>
186
158
  </td>
187
159
  <td>
188
- <% if scr.json['type'] == 'choices' and scr.file_name_test %>
189
- <% if scr.domain_test or scr.json['domain'].to_s.strip == '' %>
190
- <code class="<%= 'success' if scr.domain_test %>">"domain": <%= scr.json['domain'].inspect %></code>
191
- <% else %>
192
- <span class="text-danger"><code><%= scr.json['domain'] %>.json</code> missing</span>
193
- <% end %>
194
- <% end %>
160
+ <ul class="list-unstyled">
161
+ <li><code class="success">Value exists in dataset, and value exists in domain</code></li>
162
+ <li><code class="default">Value <b>does not exist</b> in dataset, but value exists in domain</code></li>
163
+ <li><code>Value exists in dataset, but value <b>does not exist</b> in domain</code></li>
164
+ </ul>
195
165
  </td>
196
- <td style="white-space:nowrap">
197
- <% if scr.json['type'] == 'choices' %>
198
- <% unused_values = scr.valid_values - scr.csv_values %>
199
- <% if scr.values_test and unused_values.size == 0 %>
166
+ </tr>
167
+ </tfoot>
168
+ <tbody>
169
+ <% @matching_results.each do |csv, column, scr| %>
170
+ <tr>
171
+ <td><code class="<%= 'success' if scr.number_of_errors == 0 %>"><%= csv %></code></td>
172
+ <td><%= column %></td>
173
+ <td>
174
+ <% if scr.file_name_test %>
200
175
  <div class="text-success" style="text-align:center"><span class="glyphicon glyphicon-ok"></span></div>
201
176
  <% else %>
202
- <% (scr.valid_values + scr.csv_values.compact.sort).uniq.each do |value| %>
203
- <% class_type = '' %>
204
- <% class_type = 'success' if scr.valid_values.include?(value) %>
205
- <% class_type = 'default' if unused_values.include?(value) %>
206
- <code class="<%= class_type %>"><%= value %></code>
177
+ <span class="text-danger"><code><%= column %>.json</code> missing</span>
178
+ <% end %>
179
+ </td>
180
+ <td>
181
+ <% if scr.file_name_test %>
182
+ <% if scr.json_id_test %>
183
+ <code class="success">"id": "<%= column %>"</code>
184
+ <% else %>
185
+ <code>"id": <%= scr.json['id'].inspect %></code>
207
186
  <% end %>
208
187
  <% end %>
209
- <% end %>
210
- </td>
211
- </tr>
212
- <% end %>
213
- </tbody>
214
- </table>
215
-
216
- </div><!-- /.container -->
188
+ </td>
189
+ <td>
190
+ <% if scr.file_name_test %>
191
+ <code class="<%= 'success' if scr.variable_type_test %>">"type": <%= scr.json['type'].inspect %></code>
192
+ <% end %>
193
+ </td>
194
+ <td>
195
+ <% if scr.json['type'] == 'choices' and scr.file_name_test %>
196
+ <% if scr.domain_test or scr.json['domain'].to_s.strip == '' %>
197
+ <code class="<%= 'success' if scr.domain_test %>">"domain": <%= scr.json['domain'].inspect %></code>
198
+ <% else %>
199
+ <span class="text-danger"><code><%= scr.json['domain'] %>.json</code> missing</span>
200
+ <% end %>
201
+ <% end %>
202
+ </td>
203
+ <td style="white-space:nowrap">
204
+ <% if scr.json['type'] == 'choices' %>
205
+ <% unused_values = scr.valid_values - scr.csv_values %>
206
+ <% if scr.values_test and unused_values.size == 0 %>
207
+ <div class="text-success" style="text-align:center"><span class="glyphicon glyphicon-ok"></span></div>
208
+ <% else %>
209
+ <% (scr.valid_values + scr.csv_values.compact.sort).uniq.each do |value| %>
210
+ <% class_type = '' %>
211
+ <% class_type = 'success' if scr.valid_values.include?(value) %>
212
+ <% class_type = 'default' if unused_values.include?(value) %>
213
+ <code class="<%= class_type %>"><%= value %></code>
214
+ <% end %>
215
+ <% end %>
216
+ <% end %>
217
+ </td>
218
+ </tr>
219
+ <% end %>
220
+ </tbody>
221
+ </table>
222
+ </div><!-- /.container -->
223
+ <% end %>
217
224
 
218
225
  <div id="footer">
219
226
  <p class="text-muted" style="margin: 20px 0;">Generated by <a href="https://github.com/sleepepi/spout">Spout</a> v<%= Spout::VERSION::STRING %></p>
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.6.0.rc
4
+ version: 0.6.0.rc2
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-03-05 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake