spout 0.5.0 → 0.6.0.beta1

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: be9dd5c7f18cc586db19c9da6ff9db0f5589bad4
4
- data.tar.gz: 976f94993047c1e120ac42868d1eaed56c3bc2e2
3
+ metadata.gz: 7a6e21bcb87ee2582bbe4e201dbcb42b65e11259
4
+ data.tar.gz: 86edbf1fff97458cb2eb30d06b7d0b96f4e4226d
5
5
  SHA512:
6
- metadata.gz: bd0036bc4f0909752dc46e581cfc4834db93425685d2f5c2cb197a852a3107f574a5ee19cfa379a13948b35f1ad9c29f089c1b35bbbf8f462c2c674400a14b44
7
- data.tar.gz: 2279ce68cc63601f2e7958c2d2ef11b0f9b84da70bb744de1606083d61d6b68443ae4dcb245f25825dd3708f8bc467c460076e22f8890ee304cc330c1cdd8d75
6
+ metadata.gz: 74e71e9826b2b38a4090be8e8dba01ce504f8674f993a0403c858ddce35bfec8449989ff701503d19e3c8e882e4728ffe9f80fc59e3cbdbffa02016ee38672cc
7
+ data.tar.gz: 6664b2fa054288630ec72d6ee4def325ef0bce008cec0d7a235fc8e80af047b532494d9370a418d70a682e83bb6fa341355f63eee9e6970649f984a288b8f4b0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.6.0
2
+
3
+ ### Enhancement
4
+ - Added `spout match` command that generates a coverage report of how well a dataset matches the data dictionary
5
+ - Spout Match generates a viewable report in `dd\index.html` that shows which columns are covered in CSVs located in `dd\csvs`
6
+ - **Gem Changes**
7
+ - Updated to colorize 0.6.0
8
+
1
9
  ## 0.5.0 (February 28, 2014)
2
10
 
3
11
  ### Enhancement
data/lib/spout/actions.rb CHANGED
@@ -19,6 +19,8 @@ module Spout
19
19
  new_data_dictionary_export(argv)
20
20
  when 'hybrid', '-hybrid', '--hybrid', 'y', 'hy', '-y', '-hy'
21
21
  new_data_dictionary_export(argv, 'hybrid')
22
+ when 'dataset', '-dataset', '--dataset', 'd', '-d', 'match', '-match', '--match', 'm', '-m'
23
+ match_dataset_report(argv)
22
24
  else
23
25
  help
24
26
  end
@@ -112,6 +114,10 @@ EOT
112
114
  system "bundle install"
113
115
  end
114
116
 
117
+ def match_dataset_report(argv)
118
+ system "bundle exec rake dd:coverage"
119
+ end
120
+
115
121
  private
116
122
 
117
123
  def copy_file(template_file, file_name = '')
@@ -15,6 +15,7 @@ namespace :dd do
15
15
  require 'fileutils'
16
16
  require 'rubygems'
17
17
  require 'json'
18
+ require 'erb'
18
19
 
19
20
  desc 'Create Data Dictionary from repository'
20
21
  task :create do
@@ -42,6 +43,61 @@ namespace :dd do
42
43
  puts "\nPlease specify a valid CSV file.".colorize( :red ) + additional_csv_info
43
44
  end
44
45
  end
46
+
47
+ desc 'Match CSV dataset with JSON repository'
48
+ task :coverage do
49
+ puts 'MDR'
50
+ puts Dir.pwd
51
+ puts csvs = Dir.glob("dd/csvs/*.csv")
52
+
53
+ @all_column_headers = []
54
+
55
+ @variable_json_ids = []
56
+ @variable_file_names = []
57
+
58
+ Dir.glob("variables/**/*.json").each do |file|
59
+ if json = JSON.parse(File.read(file)) rescue false
60
+ @variable_json_ids << json['id']
61
+ end
62
+ @variable_file_names << file.split('/').last.to_s.split('.json').first.to_s
63
+ end
64
+
65
+ csvs.each do |csv_file|
66
+ column_headers = []
67
+
68
+ CSV.parse( File.open(csv_file, 'r:iso-8859-1:utf-8'){|f| f.read} ) do |line|
69
+ column_headers = line
70
+ break # Only read first line
71
+ end
72
+
73
+ column_headers.each do |column_header|
74
+
75
+ end
76
+
77
+ @all_column_headers += column_headers
78
+ end
79
+
80
+
81
+ @all_column_headers
82
+
83
+ # puts File.join(File.dirname(__FILE__), '../views/', "")
84
+
85
+ coverage_file = File.join(Dir.pwd, 'dd', 'index.html')
86
+
87
+ File.open(coverage_file, 'w+') do |file|
88
+ name = 'index.html'
89
+ erb_location = File.join(File.dirname(__FILE__), '../views/', "#{name}.erb")
90
+ file.puts ERB.new(File.read(erb_location)).result(binding)
91
+ end
92
+
93
+ open_command = 'open' if RUBY_PLATFORM.match(/darwin/) != nil
94
+ open_command = 'start' if RUBY_PLATFORM.match(/mingw/) != nil
95
+
96
+
97
+ system "#{open_command} #{coverage_file}" if ['start', 'open'].include?(open_command)
98
+ puts coverage_file
99
+ end
100
+
45
101
  end
46
102
 
47
103
  def standard_version
data/lib/spout/version.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module Spout
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 5
4
+ MINOR = 6
5
5
  TINY = 0
6
- BUILD = nil # nil, "pre", "rc", "rc2"
6
+ BUILD = "beta1" # nil, "pre", "rc", "rc2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
@@ -0,0 +1,78 @@
1
+ <html lang="en"><head>
2
+ <meta charset="utf-8">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta name="description" content="">
6
+ <meta name="author" content="">
7
+ <link rel="shortcut icon" href="data:image/vnd.microsoft.icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABMLAAATCwAAAAAAAAAAAAAAAAAAAAAAIAAAAMIAAAAiAAAAAAAAAAAAAAAAAAAARAAAAEEAAAAcAAAAwQAAACEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAADCAAAAIgAAAAAAAAAAAAAAAAAAAEQAAABBAAAAHAAAAMEAAAAhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAwwAAACIAAAAAAAAAAAAAAAAAAABEAAAAQQAAABwAAADBAAAAIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAKoAAAAeAAAAAAAAAAAAAAAAAAAARAAAAEEAAAAYAAAAqwAAAB4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAWAAAAC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wQAAA8H8AAA==">
8
+
9
+ <title>Starter Template for Bootstrap</title>
10
+
11
+ <!-- Bootstrap core CSS -->
12
+ <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
13
+
14
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
15
+ <!--[if lt IE 9]>
16
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
17
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
18
+ <![endif]-->
19
+
20
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
21
+ <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
22
+ <style type="text/css">
23
+ body {
24
+ padding-top: 50px;
25
+ }
26
+ </style>
27
+ </head>
28
+
29
+ <body>
30
+
31
+ <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
32
+ <div class="container">
33
+ <div class="navbar-header">
34
+ <a class="navbar-brand" href="#">Spout Dataset and Data Dictionary Coverage</a>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="container" style="padding-top:50px">
40
+
41
+ <table class="table table-bordered table-hover">
42
+ <thead>
43
+ <tr>
44
+ <th>Dataset Column Header</th>
45
+ <th>JSON File</th>
46
+ <th>Found in Data Dictionary</th>
47
+ </tr>
48
+ </thead>
49
+ <tbody>
50
+ <% @all_column_headers.each do |column| %>
51
+ <tr>
52
+ <td><%= column %></td>
53
+ <td>
54
+ <% if @variable_file_names.include?(column) %>
55
+ <span class="text-success">File Found</span>
56
+ <% else %>
57
+ <span class="text-danger">No JSON File Found, expecting: <code><%= column %>.json</code></span>
58
+ <% end %>
59
+ </td>
60
+ <td>
61
+ <% if @variable_json_ids.include?(column) %>
62
+ <span class="text-success">JSON ID Found</span>
63
+ <% else %>
64
+ <span class="text-danger">No Matching JSON ID</span>
65
+ <pre>{
66
+ "id": "---", ...
67
+ }</pre>
68
+ <% end %>
69
+ </td>
70
+ </tr>
71
+ <% end %>
72
+ </tbody>
73
+ </table>
74
+
75
+ </div><!-- /.container -->
76
+
77
+
78
+ </body></html>
data/spout.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "rake"
30
30
  spec.add_dependency "turn"
31
31
  spec.add_dependency "json"
32
- spec.add_dependency "colorize", "~> 0.5.8"
32
+ spec.add_dependency "colorize", "~> 0.6.0"
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 1.3"
35
35
  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.5.0
4
+ version: 0.6.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.8
61
+ version: 0.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.8
68
+ version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +119,7 @@ files:
119
119
  - lib/spout/tests/variable_name_uniqueness.rb
120
120
  - lib/spout/tests/variable_type_validation.rb
121
121
  - lib/spout/version.rb
122
+ - lib/spout/views/index.html.erb
122
123
  - spout.gemspec
123
124
  homepage: https://github.com/sleepepi
124
125
  licenses:
@@ -135,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  requirements:
138
- - - ">="
139
+ - - ">"
139
140
  - !ruby/object:Gem::Version
140
- version: '0'
141
+ version: 1.3.1
141
142
  requirements: []
142
143
  rubyforge_project:
143
144
  rubygems_version: 2.2.2