datapackage 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/bin/datapackage +34 -0
- data/lib/datapackage/version.rb +2 -2
- metadata +4 -2
data/README.md
CHANGED
data/bin/datapackage
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.join( File.dirname(__FILE__), "..", "lib")
|
3
|
+
|
4
|
+
require 'datapackage'
|
5
|
+
|
6
|
+
|
7
|
+
if ARGV.length == 0
|
8
|
+
puts "Usage: datapackage <location>"
|
9
|
+
puts "<location> should be a datapackage.json file, directory, or url"
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
package = DataPackage::Package.new(ARGV[0])
|
14
|
+
|
15
|
+
messages = package.validate
|
16
|
+
|
17
|
+
if messages[:errors].length == 0
|
18
|
+
puts "Package #{package.name} is valid"
|
19
|
+
else
|
20
|
+
puts "Package #{package.name} is invalid"
|
21
|
+
puts "Fix the following errors: "
|
22
|
+
messages[:errors].each_with_index do |error, idx|
|
23
|
+
msg = error[:message] if error.class == Hash
|
24
|
+
msg = error if error.class != Hash
|
25
|
+
puts "#{idx+1}. #{msg}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if !messages[:warnings].empty?
|
30
|
+
puts "Warnings: "
|
31
|
+
messages[:warnings].each_with_index do |warning, idx|
|
32
|
+
puts "#{idx+1}. #{warning}"
|
33
|
+
end
|
34
|
+
end
|
data/lib/datapackage/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module DataPackage
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.2"
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datapackage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -110,10 +110,12 @@ dependencies:
|
|
110
110
|
description:
|
111
111
|
email:
|
112
112
|
- leigh@ldodds.com
|
113
|
-
executables:
|
113
|
+
executables:
|
114
|
+
- datapackage
|
114
115
|
extensions: []
|
115
116
|
extra_rdoc_files: []
|
116
117
|
files:
|
118
|
+
- bin/datapackage
|
117
119
|
- etc/jsontable-schema.json
|
118
120
|
- etc/datapackage-schema.json
|
119
121
|
- etc/README.md
|