spout 0.6.0.beta7 → 0.6.0.rc
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 +4 -4
- data/CHANGELOG.md +3 -3
- data/README.md +12 -0
- data/lib/spout/actions.rb +14 -12
- data/lib/spout/tasks/engine.rake +7 -5
- data/lib/spout/templates/gitignore +2 -0
- 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: bbef72d6ca54c940ae287a25f94bd794a7ea7eb1
|
|
4
|
+
data.tar.gz: ab4f7c2e9b7ed6261f1307ac01902f1d76841bf7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae5344b68426a94036f75ed40d99cc13fb73eb180d5ecdfedc864acb6b7910fa1f46cc9371f58d2501f5ff536debef735bbc307248689693717e65fc27d2a5d0
|
|
7
|
+
data.tar.gz: 7d5bd440cf67393263bc339feb575876e9be618fdc0c83caf1c263abe9fa323bd88b41ca7af00811b72dad44360d1b6633032a6ac1ccbd9822d8f838031365a1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
## 0.6.0
|
|
2
2
|
|
|
3
3
|
### Enhancement
|
|
4
|
-
- Added `spout
|
|
5
|
-
-
|
|
6
|
-
-
|
|
4
|
+
- Added `spout coverage` command that generates a coverage report of how well a dataset matches the data dictionary
|
|
5
|
+
- Generates a viewable report in `<project_name>/coverage/index.html` that shows which columns are covered in CSVs located in `<project_name>/csvs/`
|
|
6
|
+
- Checks that all collected values for a variable with a domain exist in the associated domain
|
|
7
7
|
- **Gem Changes**
|
|
8
8
|
- Updated to colorize 0.6.0
|
|
9
9
|
|
data/README.md
CHANGED
|
@@ -120,6 +120,18 @@ end
|
|
|
120
120
|
Then run either `spout test` or `bundle exec rake` to run your tests.
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
### Test your data dictionary coverage of your dataset
|
|
124
|
+
|
|
125
|
+
Spout lets you generate a nice visual coverage report that displays how well the data dictionary covers your dataset. Place your dataset csvs into `./csvs/` and then run the following Spout command:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
spout coverage
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This will generate an `index.html` file that can be opened and viewed in any browser.
|
|
132
|
+
|
|
133
|
+
Spout coverage validates that values stored in your dataset match up with variables and domains defined in your data dictionary.
|
|
134
|
+
|
|
123
135
|
### Create a CSV Data Dictionary from your JSON repository
|
|
124
136
|
|
|
125
137
|
Provide an optional version parameter to name the folder the CSVs will be generated in, defaults to what is in `VERSION` file, or if that does not exist `1.0.0`.
|
data/lib/spout/actions.rb
CHANGED
|
@@ -19,8 +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 '
|
|
23
|
-
|
|
22
|
+
when 'coverage', '-coverage', '--coverage', 'c', '-c'
|
|
23
|
+
coverage_report(argv)
|
|
24
24
|
else
|
|
25
25
|
help
|
|
26
26
|
end
|
|
@@ -42,7 +42,7 @@ EOT
|
|
|
42
42
|
def import_from_csv(argv, type = "")
|
|
43
43
|
csv_file = File.join(argv[1].to_s.strip)
|
|
44
44
|
if File.exists?(csv_file)
|
|
45
|
-
system "bundle exec rake
|
|
45
|
+
system "bundle exec rake spout:import CSV=#{csv_file} #{'TYPE='+type if type.to_s != ''}"
|
|
46
46
|
else
|
|
47
47
|
puts csv_usage
|
|
48
48
|
end
|
|
@@ -55,15 +55,17 @@ Usage: spout COMMAND [ARGS]
|
|
|
55
55
|
|
|
56
56
|
The most common spout commands are:
|
|
57
57
|
[n]ew Create a new Spout dictionary.
|
|
58
|
-
|
|
59
|
-
dictionary
|
|
58
|
+
`spout new <project_name>` creates a new
|
|
59
|
+
data dictionary in `./<project_name>`
|
|
60
60
|
[t]est Run tests and show failing tests
|
|
61
61
|
[tv] Run the tests and show passing and failing
|
|
62
62
|
tests
|
|
63
|
-
[i]mport Import a CSV file into the JSON
|
|
64
|
-
[e]xport [1.0.0] Export the JSON
|
|
65
|
-
h[y]brid [1.0.0] Export the JSON
|
|
66
|
-
|
|
63
|
+
[i]mport Import a CSV file into the JSON dictionary
|
|
64
|
+
[e]xport [1.0.0] Export the JSON dictionary to a CSV
|
|
65
|
+
h[y]brid [1.0.0] Export the JSON dictionary in the Hybrid
|
|
66
|
+
dictionary format
|
|
67
|
+
[c]overage Coverage report, requires dataset CSVs
|
|
68
|
+
in `<project_name>/csvs/`
|
|
67
69
|
[v]ersion Returns the version of Spout
|
|
68
70
|
|
|
69
71
|
Commands can be referenced by the first letter:
|
|
@@ -77,7 +79,7 @@ EOT
|
|
|
77
79
|
version = argv[1].to_s.gsub(/[^a-zA-Z0-9\.-]/, '_').strip
|
|
78
80
|
version_string = (version == '' ? "" : "VERSION=#{version}")
|
|
79
81
|
type_string = type.to_s == '' ? "" : "TYPE=#{type}"
|
|
80
|
-
system "bundle exec rake
|
|
82
|
+
system "bundle exec rake spout:create #{version_string} #{type_string}"
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
def new_template_dictionary(argv)
|
|
@@ -114,8 +116,8 @@ EOT
|
|
|
114
116
|
system "bundle install"
|
|
115
117
|
end
|
|
116
118
|
|
|
117
|
-
def
|
|
118
|
-
system "bundle exec rake
|
|
119
|
+
def coverage_report(argv)
|
|
120
|
+
system "bundle exec rake spout:coverage"
|
|
119
121
|
end
|
|
120
122
|
|
|
121
123
|
private
|
data/lib/spout/tasks/engine.rake
CHANGED
|
@@ -8,9 +8,9 @@ Rake::TestTask.new do |t|
|
|
|
8
8
|
t.verbose = true
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
task :
|
|
11
|
+
task default: :test
|
|
12
12
|
|
|
13
|
-
namespace :
|
|
13
|
+
namespace :spout do
|
|
14
14
|
require 'csv'
|
|
15
15
|
require 'fileutils'
|
|
16
16
|
require 'rubygems'
|
|
@@ -60,7 +60,7 @@ namespace :dd do
|
|
|
60
60
|
value_hash = {}
|
|
61
61
|
csv_names = []
|
|
62
62
|
|
|
63
|
-
Dir.glob("
|
|
63
|
+
Dir.glob("csvs/*.csv").each do |csv_file|
|
|
64
64
|
csv_name = csv_file.split('/').last.to_s
|
|
65
65
|
csv_names << csv_name
|
|
66
66
|
puts "\nParsing: #{csv_name}"
|
|
@@ -104,8 +104,10 @@ namespace :dd do
|
|
|
104
104
|
@coverage_results << [ csv_name, total_column_count, mapped_column_count ]
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
coverage_folder = File.join(Dir.pwd, 'coverage')
|
|
108
|
+
FileUtils.mkpath coverage_folder
|
|
109
|
+
coverage_file = File.join(coverage_folder, 'index.html')
|
|
110
|
+
print "\nGenerating: index.html\n\n"
|
|
109
111
|
|
|
110
112
|
File.open(coverage_file, 'w+') do |file|
|
|
111
113
|
name = 'index.html'
|
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.6.0.
|
|
4
|
+
version: 0.6.0.rc
|
|
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-
|
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|